Package kodkod.ast

Examples of kodkod.ast.BinaryFormula.left()


      final Formula f = itr.next();
      if (f instanceof BinaryFormula) {
        final BinaryFormula bin = (BinaryFormula) f;
        if (bin.op()==FormulaOperator.AND) {
          itr.remove();
          itr.add(bin.left());
          itr.add(bin.right());
          itr.previous();
          itr.previous();
        }
      } else if (f instanceof NaryFormula) {
View Full Code Here


   */
  public static Set<Formula> conjuncts(Formula formula) {
    if (formula instanceof BinaryFormula) {
      final BinaryFormula bin = (BinaryFormula) formula;
      if (bin.op()==FormulaOperator.AND) {
        final Formula left = bin.left(), right = bin.right();
        if (left==right) return Collections.singleton(left);
        else return new AbstractSet<Formula>() {
          @Override
          public boolean contains(Object o) { return left==o || right==o; }
          @Override
View Full Code Here

        if (solved) throw new ErrorFatal("Cannot alter the k->pos mapping since solve() has completed.");
        if (formula==null || expr==null || k2pos.containsKey(formula)) return formula;
        k2pos.put(formula, expr);
        if (formula instanceof BinaryFormula) {
            BinaryFormula b = (BinaryFormula)formula;
            if (b.op() == FormulaOperator.AND) { k2pos(b.left(), expr); k2pos(b.right(), expr); }
        }
        return formula;
    }

    /** Associates the Kodkod formula to a particular Alloy Pos (if the Kodkod formula is not already associated with an Alloy Expr or Alloy Pos) */
 
View Full Code Here

        if (solved) throw new ErrorFatal("Cannot alter the k->pos mapping since solve() has completed.");
        if (formula==null || pos==null || pos==Pos.UNKNOWN || k2pos.containsKey(formula)) return formula;
        k2pos.put(formula, pos);
        if (formula instanceof BinaryFormula) {
            BinaryFormula b = (BinaryFormula)formula;
            if (b.op() == FormulaOperator.AND) { k2pos(b.left(), pos); k2pos(b.right(), pos); }
        }
        return formula;
    }

    //===================================================================================================//
View Full Code Here

          }
       }
       if (form instanceof BinaryFormula) {
          BinaryFormula f = (BinaryFormula)form;
          if (f.op() == FormulaOperator.AND) {
             return simplify_in(f.left()) && simplify_in(f.right());
          }
       }
       if (form instanceof ComparisonFormula) {
          ComparisonFormula f = (ComparisonFormula)form;
          if (f.op() == ExprCompOperator.SUBSET) {
View Full Code Here

          }
       }
       if (form instanceof ComparisonFormula) {
          ComparisonFormula f = (ComparisonFormula)form;
          if (f.op() == ExprCompOperator.SUBSET) {
             if (!simplify_in(f.left(), f.right())) return false;
          }
          if (f.op() == ExprCompOperator.EQUALS) {
             if (!simplify_in(f.left(), f.right())) return false;
             if (!simplify_in(f.right(), f.left())) return false;
          }
View Full Code Here

          ComparisonFormula f = (ComparisonFormula)form;
          if (f.op() == ExprCompOperator.SUBSET) {
             if (!simplify_in(f.left(), f.right())) return false;
          }
          if (f.op() == ExprCompOperator.EQUALS) {
             if (!simplify_in(f.left(), f.right())) return false;
             if (!simplify_in(f.right(), f.left())) return false;
          }
       }
       return true;
    }
View Full Code Here

          if (f.op() == ExprCompOperator.SUBSET) {
             if (!simplify_in(f.left(), f.right())) return false;
          }
          if (f.op() == ExprCompOperator.EQUALS) {
             if (!simplify_in(f.left(), f.right())) return false;
             if (!simplify_in(f.right(), f.left())) return false;
          }
       }
       return true;
    }
View Full Code Here

          }
       }
       if (form instanceof BinaryFormula) {
          BinaryFormula f = (BinaryFormula)form;
          if (f.op() == FormulaOperator.AND) {
             return simplify_eq(f.left()) && simplify_eq(f.right());
          }
       }
       if (form instanceof ComparisonFormula) {
          ComparisonFormula f = (ComparisonFormula)form;
          if (f.op() == ExprCompOperator.EQUALS) {
View Full Code Here

          }
       }
       if (form instanceof ComparisonFormula) {
          ComparisonFormula f = (ComparisonFormula)form;
          if (f.op() == ExprCompOperator.EQUALS) {
             if (!simplify_equal(f.left(), f.right())) return false;
          }
       }
       return true;
    }
}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.