Beispiel #1
0
 /// <summary>
 /// Two atomic conditions are equal, if they belong to the same ConditionDef, and they have
 /// the same Operator and Value.
 /// This method can be used to determine whether an atomic condition is modified.
 /// </summary>
 public override bool Equals(object obj)
 {
     if (obj is AbstractAtomicCondition)
     {
         AbstractAtomicCondition condition = obj as AbstractAtomicCondition;
         return(GetConditionDef() == condition.GetConditionDef() &&
                m_operator == condition.m_operator &&
                m_value == condition.m_value);
     }
     return(false);
 }
Beispiel #2
0
        private ICondition ProcessConditionNode(XmlNode conditionNode)
        {
            AbstractConditionManager conditionManager = RuleEngine.GetConditionManager();
            ICondition condition = conditionManager.CreateCondition(conditionNode.Name);

            if (condition is AbstractCompositeCondition)
            {
                if (condition is AbstractMultipleCondition)
                {
                    AbstractMultipleCondition multipleCondition =
                        condition as AbstractMultipleCondition;
                    foreach (XmlNode childConditionNode in conditionNode.ChildNodes)
                    {
                        ICondition childCondition = ProcessConditionNode(childConditionNode);
                        multipleCondition.AppendCondition(childCondition);
                    }
                    return(multipleCondition);
                }
                else
                {
                    AbstractSingleCondition singleCondition =
                        condition as AbstractSingleCondition;
                    ICondition childCondition = ProcessConditionNode(conditionNode.ChildNodes[0]);
                    singleCondition.AppendCondition(childCondition);
                    return(singleCondition);
                }
            }
            else
            {
                AbstractAtomicCondition atomicCondition = condition as AbstractAtomicCondition;
                string operatorName = conditionNode.Attributes[RuleFileConstants.Operator].InnerText;
                atomicCondition.Operator = RuleEngine.GetOperatorManager().GetOperator(operatorName);
                atomicCondition.Value    =
                    conditionNode.Attributes[RuleFileConstants.Value].InnerText;
                return(atomicCondition);
            }
        }