Package kodkod.ast.operator

Examples of kodkod.ast.operator.FormulaOperator


     * binFormula.op==AND && !negated or binFormula.op==OR && negated.  Otherwise does nothing.
     * @see kodkod.ast.visitor.AbstractVoidVisitor#visit(kodkod.ast.BinaryFormula)
     */
    public void visit(BinaryFormula binFormula) {
      if (visited(binFormula)) return;
      final FormulaOperator op = binFormula.op();
   
      if ((!negated && op==AND) || (negated && op==OR)) { // op==AND || op==OR
        binFormula.left().accept(this);
        binFormula.right().accept(this);
      } else if (negated && op==IMPLIES) { // !(a => b) = !(!a || b) = a && !b
View Full Code Here


     * formula.op==AND && !negated. Otherwise does nothing.
     * @see kodkod.ast.visitor.AbstractVoidVisitor#visit(kodkod.ast.NaryFormula)
     */
    public void visit(NaryFormula formula) {
      if (visited(formula)) return;
      final FormulaOperator op = formula.op();
      if ((!negated && op==AND) || (negated && op==OR)) { // op==AND || op==OR
        for(Formula child : formula) {
          child.accept(this);
        }
      }
View Full Code Here

               ((BinaryFormula)child).op()!=op));
    }
 
    /** @effects appends the tokenization of the given node to this.tokens */
    public void visit(BinaryFormula node) {
      final FormulaOperator op = node.op();
      final boolean pleft = parenthesize(op, node.left());
      if (pleft) indent++;
      visitChild(node.left(), pleft);
      if (pleft) indent--;
      infix(op);
View Full Code Here

        visitChild(node.child(i), parenthesize(op, node.child(i)));
      }
    }
    /** @effects appends the tokenization of the given node to this.tokens */
    public void visit(NaryFormula node) {
      final FormulaOperator op = node.op();
      boolean parens = parenthesize(op, node.child(0));
      if (parens) indent++;
      visitChild(node.child(0), parens);
      if (parens) indent--;
      for(int i = 1, size = node.size(); i < size; i++) {
View Full Code Here

   * @see kodkod.ast.visitor.AbstractReplacer#visit(kodkod.ast.BinaryFormula)
   */
  public final Formula visit(BinaryFormula bf) {
    Formula ret = lookup(bf);
    if (ret!=null) return ret;     
    final FormulaOperator op = bf.op();
    final int oldDepth = skolemDepth;
    if (op==IFF || (negated && op==AND) || (!negated && (op==OR || op==IMPLIES))) { // cannot skolemize in these cases
      skolemDepth = -1;
    }
    final Formula left, right;
View Full Code Here

  public final Formula visit(NaryFormula bf) {
    Formula ret = lookup(bf);
    if (ret!=null) return ret;     
   
    final int oldDepth = skolemDepth;
    final FormulaOperator op = bf.op();
   
    switch(op) {
    case AND : if (negatedskolemDepth = -1; break;
    case OR  : if (!negated) skolemDepth = -1; break;
    default  : throw new IllegalArgumentException("Unknown nary operator: " + op);
View Full Code Here

   */
  public final BooleanValue visit(NaryFormula formula) {
    final BooleanValue ret = lookup(formula);
    if (ret!=null) return ret;

    final FormulaOperator op = formula.op();   
    final Operator.Nary boolOp;
   
    switch(op) {
    case AND : boolOp = Operator.AND; break;
    case OR  : boolOp = Operator.OR;  break;
View Full Code Here

    BooleanValue ret = lookup(binFormula);
    if (ret!=null) return ret;

    final BooleanValue left = binFormula.left().accept(this);
    final BooleanValue right = binFormula.right().accept(this);
    final FormulaOperator op = binFormula.op();
    final BooleanFactory f = interpreter.factory();

    switch(op) {
    case AND    : ret = f.and(left, right); break;
    case OR      : ret = f.or(left, right); break;
View Full Code Here

   * for the negated flag if bf  has not been visited before.
   * @see kodkod.ast.visitor.AbstractVoidVisitor#visit(kodkod.ast.BinaryFormula)
   */
  public final void visit(BinaryFormula bf) {
    if (visited(bf)) return;
    final FormulaOperator op = bf.op();
    if (op==IFF || (negated && op==AND) || (!negated && (op==OR || op==IMPLIES))) { // can't break down further in these cases
      addConjunct(bf);
    } else { // will break down further
      if (negated && op==IMPLIES) { // !(a => b) = !(!a || b) = a && !b
        negated = !negated;
View Full Code Here

   * for the negated flag if bf  has not been visited before.
   * @see kodkod.ast.visitor.AbstractVoidVisitor#visit(kodkod.ast.NaryFormula)
   */
  public final void visit(NaryFormula nf) {
    if (visited(nf)) return;
    final FormulaOperator op = nf.op();
    if ((negated && op==AND) || (!negated && op==OR)) { // can't break down further in these cases
      addConjunct(nf);
    } else { // will break down further
      for(Formula f : nf) {
        f.accept(this);
View Full Code Here

TOP

Related Classes of kodkod.ast.operator.FormulaOperator

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.