use of kodkod.ast.operator.ExprCompOperator in project org.alloytools.alloy by AlloyTools.
the class FOL2BoolTranslator method visit.
/**
* Calls lookup(compFormula) and returns the cached value, if any. If a
* translation has not been cached, translates the formula, calls cache(...) on
* it and returns it.
*
* @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)))
*/
@Override
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();
switch(op) {
case SUBSET:
ret = left.subset(right, env);
break;
case EQUALS:
ret = left.eq(right, env);
break;
default:
throw new IllegalArgumentException("Unknown operator: " + compFormula.op());
}
return cache(compFormula, ret);
}
Aggregations