private int SortOperatorsByOrder(F_OPERATOR oper1, F_OPERATOR oper2) { if (oper1.OPER_ORDER > oper2.OPER_ORDER) { return(1); } if (oper1.OPER_ORDER == oper2.OPER_ORDER) { return(0); } return(-1); }
private void WriteFormulaOperator(XmlWriter xml_writer, F_OPERATOR oper) { xml_writer.WriteStartElement("F_OPERATOR"); xml_writer.WriteAttributeString("OPER_ORDER", oper.OPER_ORDER.ToString()); if (oper.PRE_OPERANDS != null) { xml_writer.WriteAttributeString("PRE_OPERANDS", oper.PRE_OPERANDS); } xml_writer.WriteAttributeString("OPER_TYPE", ((int)oper.OPER_TYPE).ToString()); xml_writer.WriteAttributeString("OPER_ID", oper.OPER_ID); if (oper.TI_CHANNEL != null) { xml_writer.WriteAttributeString("TI_CHANNEL", ((int)oper.TI_CHANNEL.Value).ToString()); } if (oper.AFTER_OPERANDS != null) { xml_writer.WriteAttributeString("AFTER_OPERANDS", oper.AFTER_OPERANDS); } xml_writer.WriteEndElement(); }
private F_OPERATOR ReadOperator(XmlReader xml_reader, FORMULA f) { var oper = new F_OPERATOR { AFTER_OPERANDS = xml_reader.GetAttribute("AFTER_OPERANDS"), OPER_ID = xml_reader.GetAttribute("OPER_ID"), OPER_ORDER = Convert.ToInt32(xml_reader.GetAttribute("OPER_ORDER")), OPER_TYPE = (F_OPERATOR.F_OPERAND_TYPE)Convert.ToInt32(xml_reader.GetAttribute("OPER_TYPE")), PRE_OPERANDS = xml_reader.GetAttribute("PRE_OPERANDS"), }; if (oper.OPER_TYPE == F_OPERATOR.F_OPERAND_TYPE.TI_channel) { oper.TI_CHANNEL = Convert.ToByte(xml_reader.GetAttribute("TI_CHANNEL")); } else { oper.TI_CHANNEL = null; } oper.INNER_FORMULA = f; return(oper); }