Esempio n. 1
0
            public virtual void Visit(AndExpression expression)
            {
                expression.Left().Accept(this);
                IConstraint left = _constraint;

                expression.Right().Accept(this);
                left.And(_constraint);
                _constraint = left;
            }
Esempio n. 2
0
 public virtual void Visit(AndExpression expression)
 {
     expression.Left().Accept(this);
     expression.Right().Accept(this);
     this._enclosing.Invoke(this._enclosing.andRef);
 }
Esempio n. 3
0
 private IExpression CheckBoolean(IExpression cmp, IExpression trueExpr, IExpression
                                  falseExpr)
 {
     if (cmp is BoolConstExpression)
     {
         return(null);
     }
     if (trueExpr is BoolConstExpression)
     {
         bool leftNegative = trueExpr.Equals(BoolConstExpression.False);
         if (!leftNegative)
         {
             return(Or(cmp, falseExpr));
         }
         else
         {
             return(And(Not(cmp), falseExpr));
         }
     }
     if (falseExpr is BoolConstExpression)
     {
         bool rightNegative = falseExpr.Equals(BoolConstExpression.False);
         if (!rightNegative)
         {
             return(And(cmp, trueExpr));
         }
         else
         {
             return(Or(Not(cmp), falseExpr));
         }
     }
     if (cmp is NotExpression)
     {
         cmp = ((NotExpression)cmp).Expr();
         IExpression swap = trueExpr;
         trueExpr  = falseExpr;
         falseExpr = swap;
     }
     if (trueExpr is OrExpression)
     {
         OrExpression orExpr  = (OrExpression)trueExpr;
         IExpression  orLeft  = orExpr.Left();
         IExpression  orRight = orExpr.Right();
         if (falseExpr.Equals(orRight))
         {
             IExpression swap = orRight;
             orRight = orLeft;
             orLeft  = swap;
         }
         if (falseExpr.Equals(orLeft))
         {
             return(Or(orLeft, And(cmp, orRight)));
         }
     }
     if (falseExpr is AndExpression)
     {
         AndExpression andExpr  = (AndExpression)falseExpr;
         IExpression   andLeft  = andExpr.Left();
         IExpression   andRight = andExpr.Right();
         if (trueExpr.Equals(andRight))
         {
             IExpression swap = andRight;
             andRight = andLeft;
             andLeft  = swap;
         }
         if (trueExpr.Equals(andLeft))
         {
             return(And(andLeft, Or(cmp, andRight)));
         }
     }
     return(null);
 }