Package kodkod.engine.bool

Examples of kodkod.engine.bool.BooleanValue


   * calls cache(...) on it and returns it.
   * @return let t = lookup(formula) | some t => t,
   *   cache(formula, formula.op(formula.left.accept(this), formula.right.accept(this))
   */
  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;
    default   : throw new IllegalArgumentException("Unknown nary operator: " + op);
    }
   
    final BooleanAccumulator acc = BooleanAccumulator.treeGate(boolOp);
    final BooleanValue shortCircuit = boolOp.shortCircuit();
    for(Formula child : formula) {
      if (acc.add(child.accept(this))==shortCircuit)
        break;
    }
   
View Full Code Here


   * calls cache(...) on it and returns it.
   * @return let t = lookup(binFormula) | some t => t,
   *   cache(binFormula, binFormula.op(binFormula.left.accept(this), binFormula.right.accept(this))
   */
  public final BooleanValue visit(BinaryFormula binFormula) {
    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;
View Full Code Here

   * calls cache(...) on it and returns it.
   * @return let t = lookup(not) | some t => t,
   *   cache(not, !not.formula.accept(this))
   */
  public final BooleanValue visit(NotFormula not) {
    BooleanValue ret = lookup(not);
    return ret==null ?
        cache(not, interpreter.factory().not(not.formula().accept(this))) : ret;
  }
View Full Code Here

   * @return let t = lookup(compFormula) | some t => t,
   *      let op = (binExpr.op).(SUBSET->subset + EQUALS->eq) |
   *       cache(compFormula, op(compFormula.left.accept(this), compFormula.right.accept(this)))
   */
  public final BooleanValue visit(ComparisonFormula compFormula) {
    BooleanValue ret = lookup(compFormula);
    if (ret!=null) return ret;

    final BooleanMatrix left = compFormula.left().accept(this);
    final BooleanMatrix right = compFormula.right().accept(this);
    final ExprCompOperator op = compFormula.op();
View Full Code Here

   * @return let t = lookup(multFormula) | some t => t,
   *      let op = (multFormula.mult).(NO->none + SOME->some + ONE->one + LONE->lone) |
   *       cache(multFormula, op(multFormula.expression.accept(this)))
   */
  public final BooleanValue visit(MultiplicityFormula multFormula) {
    BooleanValue ret = lookup(multFormula);
    if (ret!=null) return ret;

    final BooleanMatrix child = multFormula.expression().accept(this);
    final Multiplicity mult = multFormula.multiplicity();

View Full Code Here

   * calls cache(...) on it and returns it.
   * @return let t = lookup(pred) | some t => t,
   *   cache(pred, pred.toConstraints().accept(this))
   */
  public final BooleanValue visit(RelationPredicate pred) {
    BooleanValue ret = lookup(pred);
    return ret != null ? ret : cache(pred, pred.toConstraints().accept(this));
  }
View Full Code Here

   */
  public final Int visit(IfIntExpression intExpr) {
    Int ret = lookup(intExpr);
    if (ret!=null) return ret;

    final BooleanValue condition = intExpr.condition().accept(this);
    final Int thenExpr = intExpr.thenExpr().accept(this);
    final Int elseExpr = intExpr.elseExpr().accept(this);
    ret = thenExpr.choice(condition, elseExpr);

    return cache(intExpr, ret);
View Full Code Here

   * calls cache(...) on it and returns it.
   * @return let t = lookup(intComp) | some t => t,
   *   cache(intComp, intComp.left.accept(this) intComp.op intComp.right.accept(this))
   */
  public final BooleanValue visit(IntComparisonFormula intComp) {
    BooleanValue ret = lookup(intComp);
    if (ret!=null) return ret;
    final Int left = intComp.left().accept(this);
    final Int right = intComp.right().accept(this);
    switch(intComp.op()) {
    case EQ  : ret = left.eq(right); break;
View Full Code Here

TOP

Related Classes of kodkod.engine.bool.BooleanValue

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.