コード例 #1
0
        /// <summary>
        /// if x = y, then y = x
        /// </summary>
        /// <param name="currentEq"></param>
        /// <param name="rootEq"></param>
        /// <returns></returns>
        public static Equation ApplySymmetric(this Equation currentEq, Equation rootEq)
        {
            Equation localEq = currentEq;
            object   lhs     = currentEq.Lhs;
            object   rhs     = currentEq.Rhs;

            if (SatisfySymmetricCondition(lhs, rhs))
            {
                var    cloneEq = currentEq.Clone();
                object tempObj = cloneEq.Lhs;
                cloneEq.Lhs = cloneEq.Rhs;
                cloneEq.Rhs = tempObj;

                string rule        = EquationsRule.Rule(EquationsRule.EquationRuleType.Symmetric);
                string appliedRule = EquationsRule.Rule(
                    EquationsRule.EquationRuleType.Symmetric,
                    localEq, null);
                string KC = EquationsRule.RuleConcept(EquationsRule.EquationRuleType.Symmetric);

                var ts = new TraceStep(localEq, cloneEq, KC, rule, appliedRule);
                rootEq._innerLoop.Add(ts);
                localEq = cloneEq;
            }
            return(localEq);
        }