本文整理汇总了Java中kodkod.ast.IntComparisonFormula.op方法的典型用法代码示例。如果您正苦于以下问题:Java IntComparisonFormula.op方法的具体用法?Java IntComparisonFormula.op怎么用?Java IntComparisonFormula.op使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kodkod.ast.IntComparisonFormula
的用法示例。
在下文中一共展示了IntComparisonFormula.op方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visit
import kodkod.ast.IntComparisonFormula; //导入方法依赖的package包/类
/**
* Calls lookup(intComp) and returns the cached value, if any.
* If a translation has not been cached, translates the formula,
* calls cache(...) on it and returns it.
*
* This is the only place where <code>Int</code>s are turned into
* formulas, so that's where the overflow circuits of individual
* <code>Int</code>s are built into the translated formula.
*
* @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, env); break;
case NEQ : ret = left.neq(right, env); break;
case LT : ret = left.lt(right, env); break;
case LTE : ret = left.lte(right, env); break;
case GT : ret = left.gt(right, env); break;
case GTE : ret = left.gte(right, env); break;
default:
throw new IllegalArgumentException("Unknown operator: " + intComp.op());
}
return cache(intComp, ret);
}
示例2: visit
import kodkod.ast.IntComparisonFormula; //导入方法依赖的package包/类
/**
* Calls lookup(intComp) 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(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;
case LT : ret = left.lt(right); break;
case LTE : ret = left.lte(right); break;
case GT : ret = left.gt(right); break;
case GTE : ret = left.gte(right); break;
default:
throw new IllegalArgumentException("Unknown operator: " + intComp.op());
}
return cache(intComp, ret);
}
示例3: visit
import kodkod.ast.IntComparisonFormula; //导入方法依赖的package包/类
public Formula visit(IntComparisonFormula formula) {
Formula ret = lookup(formula);
if (ret!=null) return ret;
final IntCompOperator op = formula.op();
final IntExpression left = formula.left().accept(this);
final IntExpression 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 IntComparisonFormula) {
final IntComparisonFormula hit = (IntComparisonFormula) 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);
}
示例4: visit
import kodkod.ast.IntComparisonFormula; //导入方法依赖的package包/类
/** @see #visitFormula(Formula) */
public final void visit(IntComparisonFormula cf) {
if (visited(cf))
return;
if (!negated) {
addConjunct(cf);
} else {
switch (cf.op()) {
case GT :
addConjunct(cf.left().lte(cf.right()), false, cf);
hasChanged = true;
break;
case GTE :
addConjunct(cf.left().lt(cf.right()), false, cf);
hasChanged = true;
break;
case LT :
addConjunct(cf.left().gte(cf.right()), false, cf);
hasChanged = true;
break;
case LTE :
addConjunct(cf.left().gt(cf.right()), false, cf);
hasChanged = true;
break;
case EQ :
addConjunct(cf.left().neq(cf.right()), false, cf);
hasChanged = true;
break;
case NEQ :
addConjunct(cf.left().eq(cf.right()), false, cf);
hasChanged = true;
break;
default :
addConjunct(cf);
}
}
}
示例5: visit
import kodkod.ast.IntComparisonFormula; //导入方法依赖的package包/类
/**
* Calls lookup(intComp) and returns the cached value, if any. If a
* translation has not been cached, translates the formula, calls cache(...)
* on it and returns it. This is the only place where <code>Int</code>s are
* turned into formulas, so that's where the overflow circuits of individual
* <code>Int</code>s are built into the translated formula.
*
* @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, env);
break;
case NEQ :
ret = left.neq(right, env);
break;
case LT :
ret = left.lt(right, env);
break;
case LTE :
ret = left.lte(right, env);
break;
case GT :
ret = left.gt(right, env);
break;
case GTE :
ret = left.gte(right, env);
break;
default :
throw new IllegalArgumentException("Unknown operator: " + intComp.op());
}
return cache(intComp, ret);
}
示例6: visit
import kodkod.ast.IntComparisonFormula; //导入方法依赖的package包/类
/** {@inheritDoc} */
public void visit(IntComparisonFormula x) {
String newname = makename(x);
if (newname == null)
return;
String left = make(x.left());
String right = make(x.right());
switch (x.op()) {
case NEQ :
file.printf("Formula %s=%s.neq(%s);%n", newname, left, right);
break;
case EQ :
file.printf("Formula %s=%s.eq(%s);%n", newname, left, right);
break;
case GT :
file.printf("Formula %s=%s.gt(%s);%n", newname, left, right);
break;
case GTE :
file.printf("Formula %s=%s.gte(%s);%n", newname, left, right);
break;
case LT :
file.printf("Formula %s=%s.lt(%s);%n", newname, left, right);
break;
case LTE :
file.printf("Formula %s=%s.lte(%s);%n", newname, left, right);
break;
default :
throw new RuntimeException("Unknown kodkod operator \"" + x.op() + "\" encountered");
}
}
示例7: visit
import kodkod.ast.IntComparisonFormula; //导入方法依赖的package包/类
/** {@inheritDoc} */
public void visit(IntComparisonFormula x) {
String newname=makename(x); if (newname==null) return;
String left=make(x.left());
String right=make(x.right());
switch(x.op()) {
case NEQ: file.printf("Formula %s=%s.neq(%s);%n", newname, left, right); break;
case EQ: file.printf("Formula %s=%s.eq(%s);%n", newname, left, right); break;
case GT: file.printf("Formula %s=%s.gt(%s);%n", newname, left, right); break;
case GTE: file.printf("Formula %s=%s.gte(%s);%n", newname, left, right); break;
case LT: file.printf("Formula %s=%s.lt(%s);%n", newname, left, right); break;
case LTE: file.printf("Formula %s=%s.lte(%s);%n", newname, left, right); break;
default: throw new RuntimeException("Unknown kodkod operator \""+x.op()+"\" encountered");
}
}
示例8: visit
import kodkod.ast.IntComparisonFormula; //导入方法依赖的package包/类
/** @see #visitFormula(Formula) */
public final void visit(IntComparisonFormula cf) {
if (visited(cf)) return;
if (!negated) {
addConjunct(cf);
} else {
switch (cf.op()) {
case GT:
addConjunct(cf.left().lte(cf.right()), false, cf);
hasChanged = true;
break;
case GTE:
addConjunct(cf.left().lt(cf.right()), false, cf);
hasChanged = true;
break;
case LT:
addConjunct(cf.left().gte(cf.right()), false, cf);
hasChanged = true;
break;
case LTE:
addConjunct(cf.left().gt(cf.right()), false, cf);
hasChanged = true;
break;
case EQ:
addConjunct(cf.left().neq(cf.right()), false, cf);
hasChanged = true;
break;
case NEQ:
addConjunct(cf.left().eq(cf.right()), false, cf);
hasChanged = true;
break;
default:
addConjunct(cf);
}
}
}
示例9: visit
import kodkod.ast.IntComparisonFormula; //导入方法依赖的package包/类
/** @see #visitFormula(Formula) */
public final Formula visit(IntComparisonFormula cf) {
//if (visited(cf)) return;
IntExpression lh = cf.left().accept(this);
IntExpression rh = cf.right().accept(this);
if (!negated) {
if (lh == cf.left() && rh == cf.right()) {
return addMapping(cf, cf);
} else {
return addMapping(lh.compare(cf.op(), rh), cf);
}
} else {
switch (cf.op()) {
case GT:
return addMapping(lh.lte(rh), cf);
case GTE:
return addMapping(lh.lt(rh), cf);
case LT:
return addMapping(lh.gte(rh), cf);
case LTE:
return addMapping(lh.gt(rh), cf);
case EQ:
return addMapping(lh.neq(rh), cf);
case NEQ:
return addMapping(lh.eq(rh), cf);
default:
return addMapping(cf, cf);
}
}
}
示例10: visit
import kodkod.ast.IntComparisonFormula; //导入方法依赖的package包/类
public Formula visit(IntComparisonFormula formula) {
Formula ret = lookup(formula);
if (ret!=null) return ret;
final IntCompOperator op = formula.op();
final IntExpression left = formula.left().accept(this);
final IntExpression 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);
}