Package kodkod.ast

Examples of kodkod.ast.NaryFormula


          itr.add(bin.right());
          itr.previous();
          itr.previous();
        }
      } else if (f instanceof NaryFormula) {
        final NaryFormula nf = (NaryFormula) f;
        if (nf.op()==FormulaOperator.AND) {
          itr.remove();
          for(Formula child : nf) {
            itr.add(child);
          }
          for(int i = nf.size(); i>0; i--) {
            itr.previous();
          }
        }
      }
    }
View Full Code Here


          public int size() { return 2}
         
        };
      }
    } else if (formula instanceof NaryFormula) {
      final NaryFormula nf = (NaryFormula) formula;
      if (nf.op()==FormulaOperator.AND) {
        final LinkedHashSet<Formula> children = new LinkedHashSet<Formula>(1+(nf.size()*4)/3);
        for(Formula child : nf) { children.add(child); }
        return Collections.unmodifiableSet(children);
      }
    }
   
View Full Code Here

    }

    /** Simplify the bounds based on the fact that "form is true"; return false if we discover the formula is unsat. */
    private final boolean simplify_in (Formula form) {
       if (form instanceof NaryFormula) {
          NaryFormula f = (NaryFormula)form;
          if (f.op() == FormulaOperator.AND) {
             for(Iterator<Formula> i = f.iterator(); i.hasNext();) if (!simplify_in(i.next())) return false;
          }
       }
       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) {
             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

    }

    /** Simplify the bounds based on the fact that "form is true"; return false if we discover the formula is unsat. */
    private final boolean simplify_eq (Formula form) {
       if (form instanceof NaryFormula) {
          NaryFormula f = (NaryFormula)form;
          if (f.op() == FormulaOperator.AND) {
             for(Iterator<Formula> i = f.iterator(); i.hasNext();) if (!simplify_eq(i.next())) return false;
          }
       }
       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) {
             if (!simplify_equal(f.left(), f.right())) return false;
          }
       }
       return true;
    }
View Full Code Here

TOP

Related Classes of kodkod.ast.NaryFormula

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.