Package kodkod.ast

Examples of kodkod.ast.BinaryExpression


       if (expr instanceof Relation) {
          TupleSet ans = findUpper ? bounds.upperBound((Relation)expr) : bounds.lowerBound((Relation)expr);
          if (ans!=null) return makeMutable ? ans.clone() : ans;
       }
       else if (expr instanceof BinaryExpression) {
          BinaryExpression b = (BinaryExpression)expr;
          if (b.op() == ExprOperator.UNION) {
             TupleSet left = query(findUpper, b.left(), true);
             TupleSet right = query(findUpper, b.right(), false);
             left.addAll(right);
             return left;
          }
       }
       throw new ErrorFatal("Unknown expression encountered during bounds computation: "+expr);
View Full Code Here


    }

    /** Simplify (a.(a->b)) into b when semantically equivalent */
    private final Expression condense(Expression x) {
       while (x instanceof BinaryExpression) {
          BinaryExpression b = (BinaryExpression)x;
          if (b.op() == ExprOperator.JOIN && b.left() instanceof Relation && b.right() instanceof BinaryExpression) {
             Relation r = (Relation) (b.left());
             try {
                if (sol.query(true, r, false).size()!=1) return x;
                if (sol.query(false, r, false).size()!=1) return x;
             } catch(Err er) {
                return x;
             }
             b = (BinaryExpression)(b.right());
             if (b.op() == ExprOperator.PRODUCT && b.left()==r) {
                x = b.right();
                continue;
             }
          }
          break;
       }
View Full Code Here

    //==============================================================================================================//

    /** If x = SOMETHING->RELATION where SOMETHING.arity==1, then return the RELATION, else return null. */
    private static Relation right(Expression x) {
        if (!(x instanceof BinaryExpression)) return null;
        BinaryExpression bin = (BinaryExpression)x;
        if (bin.op() != ExprOperator.PRODUCT) return null;
        if (bin.left().arity()==1 && bin.right() instanceof Relation) return (Relation)(bin.right()); else return null;
    }
View Full Code Here

            case ARROW:
                s=cset(a); return s.product(cset(b));
            case JOIN:
                a=a.deNOP(); s=cset(a); s2=cset(b);
                if (a instanceof Sig && ((Sig)a).isOne!=null && s2 instanceof BinaryExpression) {
                    BinaryExpression bin = (BinaryExpression)s2;
                    if (bin.op()==ExprOperator.PRODUCT && bin.left()==s) return bin.right();
                }
                return s.join(s2);
            case EQUALS:
                obj=visitThis(a);
                if (obj instanceof IntExpression) { i=(IntExpression)obj; f=i.eq(cint(b));}
View Full Code Here

TOP

Related Classes of kodkod.ast.BinaryExpression

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.