本文整理汇总了Java中kodkod.ast.ComparisonFormula.op方法的典型用法代码示例。如果您正苦于以下问题:Java ComparisonFormula.op方法的具体用法?Java ComparisonFormula.op怎么用?Java ComparisonFormula.op使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kodkod.ast.ComparisonFormula
的用法示例。
在下文中一共展示了ComparisonFormula.op方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visit
import kodkod.ast.ComparisonFormula; //导入方法依赖的package包/类
/**
* 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)))
*/
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);
}
示例2: visit
import kodkod.ast.ComparisonFormula; //导入方法依赖的package包/类
/** {@inheritDoc} */
public void visit(ComparisonFormula x) {
String newname = makename(x);
if (newname == null)
return;
String left = make(x.left());
String right = make(x.right());
switch (x.op()) {
case EQUALS :
file.printf("Formula %s=%s.eq(%s);%n", newname, left, right);
break;
case SUBSET :
file.printf("Formula %s=%s.in(%s);%n", newname, left, right);
break;
default :
throw new RuntimeException("Unknown kodkod operator \"" + x.op() + "\" encountered");
}
}
示例3: visit
import kodkod.ast.ComparisonFormula; //导入方法依赖的package包/类
/**
* 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)))
*/
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);
}
示例4: visit
import kodkod.ast.ComparisonFormula; //导入方法依赖的package包/类
/**
* 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)))
*/
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); break;
case EQUALS : ret = left.eq(right); break;
default :
throw new IllegalArgumentException("Unknown operator: " + compFormula.op());
}
return cache(compFormula,ret);
}
示例5: visit
import kodkod.ast.ComparisonFormula; //导入方法依赖的package包/类
public Formula visit(ComparisonFormula formula) {
Formula ret = lookup(formula);
if (ret!=null) return ret;
final ExprCompOperator op = formula.op();
final Expression left = formula.left().accept(this);
final Expression right = formula.right().accept(this);
if (left==right) return cache(formula,Formula.TRUE);
final int hash = hash(op, left, right);
for(Iterator<PartialCannonicalizer.Holder<Formula>> itr = formulas.get(hash); itr.hasNext(); ) {
final Formula next = itr.next().obj;
if (next instanceof ComparisonFormula) {
final ComparisonFormula hit = (ComparisonFormula) next;
if (hit.op()==op && hit.left()==left && hit.right()==right) {
return cache(formula, hit);
}
}
}
ret = left==formula.left()&&right==formula.right() ? formula : left.compare(op, right);
formulas.add(new PartialCannonicalizer.Holder<Formula>(ret, hash));
return cache(formula,ret);
}
示例6: visit
import kodkod.ast.ComparisonFormula; //导入方法依赖的package包/类
/** {@inheritDoc} */
public void visit(ComparisonFormula x) {
String newname=makename(x); if (newname==null) return;
String left=make(x.left());
String right=make(x.right());
switch(x.op()) {
case EQUALS: file.printf("Formula %s=%s.eq(%s);%n", newname, left, right); break;
case SUBSET: file.printf("Formula %s=%s.in(%s);%n", newname, left, right); break;
default: throw new RuntimeException("Unknown kodkod operator \""+x.op()+"\" encountered");
}
}
示例7: visit
import kodkod.ast.ComparisonFormula; //导入方法依赖的package包/类
public Formula visit(ComparisonFormula formula) {
Formula ret = lookup(formula);
if (ret!=null) return ret;
final ExprCompOperator op = formula.op();
final Expression left = formula.left().accept(this);
final Expression right = formula.right().accept(this);
if (left==right) return cache(formula,Formula.TRUE);
ret = left==formula.left()&&right==formula.right() ? formula : left.compare(op, right);
return cache(formula,ret);
}