Package lupos.rif.model

Examples of lupos.rif.model.Conjunction


      conjunction.addExpr(obj);
    return conjunction == null ? obj : conjunction;
  }

  public IRuleNode visit(RuleList obj, Object arg) throws RIFException {
    Conjunction conjunction = null;
    ArrayList<IExpression> items = new ArrayList<IExpression>(
        obj.getItems());
    for (IExpression expr : obj.getItems()) {
      final IRuleNode result = expr.accept(this, obj);
      if (result instanceof Conjunction) {
        conjunction = conjunction == null ? new Conjunction()
            : conjunction;
        for (IExpression item : ((Conjunction) result).exprs)
          if (item instanceof Equality)
            conjunction.addExpr(item);
          else
            items.set(items.indexOf(expr), item);
      }
    }
    obj.getItems().clear();
    obj.getItems().addAll(items);
    if (conjunction != null)
      conjunction.addExpr(obj);
    return conjunction != null ? conjunction : obj;
  }
View Full Code Here


            List<IExpression> formulas = new ArrayList<IExpression>();
            // TODO: Parent
            formulas.add((IExpression) conjunct.accept(this, null));
            formulas.add((IExpression) disjunct.accept(this, null));

            Conjunction temp = new Conjunction();
            temp.exprs.addAll(formulas);
            andFormulas.add(temp);
          }

          // Or(And(Fi G1) ... And(Fi Gm))
          Disjunction orFormula = new Disjunction();
          orFormula.exprs.addAll(andFormulas);

          // normalize(Or(And(Fi G1) ... And(Fi Gm)))
          // TODO: Parent
          newConjuncts
              .add((IExpression) orFormula.accept(this, null));

          hasChanged = true;

          i++;
        } else {
          // TODO: Parent
          newConjuncts.add((IExpression) conjunct.accept(this, null));
        }
      }
    }

    if (hasChanged) {
      if (newConjuncts.size() > 1) {
        // normalize(And(...)) is either an atomic, an or formula or a
        // and formula.
        // TODO: Parent
        Conjunction conj = new Conjunction();
        conj.exprs.addAll(newConjuncts);
        return (IExpression) conj.accept(this, null);
      } else {
        // Either an atomic formula or an or formula.
        return newConjuncts.get(0);
      }
    }
View Full Code Here

TOP

Related Classes of lupos.rif.model.Conjunction

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.