本文整理汇总了Java中kodkod.ast.ExprToIntCast.op方法的典型用法代码示例。如果您正苦于以下问题:Java ExprToIntCast.op方法的具体用法?Java ExprToIntCast.op怎么用?Java ExprToIntCast.op使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kodkod.ast.ExprToIntCast
的用法示例。
在下文中一共展示了ExprToIntCast.op方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visit
import kodkod.ast.ExprToIntCast; //导入方法依赖的package包/类
/**
* Calls lookup(intExpr) and returns the cached value, if any. If a
* translation has not been cached, translates the expression, calls
* cache(...) on it and returns it.
*
* @return let t = lookup(intExpr) | some t => t, cache(intExpr,
* translate(intExpr))
*/
public final Int visit(ExprToIntCast intExpr) {
Int ret = lookup(intExpr);
if (ret != null)
return ret;
vars = vars.createNested();
BooleanMatrix expr = intExpr.expression().accept(this);
switch (intExpr.op()) {
case CARDINALITY :
ret = expr.cardinality();
break;
case SUM :
final IntSet ints = interpreter.ints();
ret = sum(expr, ints.iterator(), 0, ints.size() - 1);
break;
default :
throw new IllegalArgumentException("unknown operator: " + intExpr.op());
}
for (Variable v : vars)
ret.defCond().addVar(v);
vars = vars.parent();
return cache(intExpr, ret);
}
示例2: visit
import kodkod.ast.ExprToIntCast; //导入方法依赖的package包/类
/**
* @ensures this.tokens' = concat[ this.tokens, "int","[",
* tokenize[node.expression], "]" ]
**/
public void visit(ExprToIntCast node) {
switch (node.op()) {
case SUM :
append("int");
append("[");
node.expression().accept(this);
append("]");
break;
case CARDINALITY :
append("#");
append("(");
node.expression().accept(this);
append(")");
break;
default :
throw new IllegalArgumentException("unknown operator: " + node.op());
}
}
示例3: visit
import kodkod.ast.ExprToIntCast; //导入方法依赖的package包/类
/** {@inheritDoc} */
public void visit(ExprToIntCast x) {
String newname = makename(x);
if (newname == null)
return;
String sub = make(x.expression());
switch (x.op()) {
case CARDINALITY :
file.printf("IntExpression %s=%s.count();%n", newname, sub);
break;
case SUM :
file.printf("IntExpression %s=%s.sum();%n", newname, sub);
break;
default :
throw new RuntimeException("Unknown kodkod operator \"" + x.op() + "\" encountered");
}
}
示例4: visit
import kodkod.ast.ExprToIntCast; //导入方法依赖的package包/类
/**
* Calls lookup(intExpr) and returns the cached value, if any.
* If a translation has not been cached, translates the expression,
* calls cache(...) on it and returns it.
* @return let t = lookup(intExpr) | some t => t,
* cache(intExpr, translate(intExpr))
*/
public final Int visit(ExprToIntCast intExpr) {
Int ret = lookup(intExpr);
if (ret!=null) return ret;
vars = vars.createNested();
BooleanMatrix expr = intExpr.expression().accept(this);
switch(intExpr.op()) {
case CARDINALITY :
ret = expr.cardinality(); break;
case SUM :
final IntSet ints = interpreter.ints();
ret = sum(expr, ints.iterator(), 0, ints.size()-1); break;
default:
throw new IllegalArgumentException("unknown operator: " + intExpr.op());
}
for (Variable v : vars) ret.defCond().addVar(v);
vars = vars.parent();
return cache(intExpr, ret);
}
示例5: visit
import kodkod.ast.ExprToIntCast; //导入方法依赖的package包/类
/** @ensures this.tokens' = concat[ this.tokens, "int","[",
* tokenize[node.expression], "]" ] **/
public void visit(ExprToIntCast node) {
switch(node.op()) {
case SUM:
append("int");
append("[");
node.expression().accept(this);
append("]");
break;
case CARDINALITY :
append("#");
append("(");
node.expression().accept(this);
append(")");
break;
default : throw new IllegalArgumentException("unknown operator: " + node.op());
}
}
示例6: visit
import kodkod.ast.ExprToIntCast; //导入方法依赖的package包/类
public IntExpression visit(ExprToIntCast expr) {
IntExpression ret = lookup(expr);
if (ret!=null) return ret;
final ExprCastOperator op = expr.op();
final Expression child = expr.expression().accept(this);
final int hash = hash(op, child);
for(Iterator<PartialCannonicalizer.Holder<IntExpression>> itr = intExprs.get(hash); itr.hasNext(); ) {
final IntExpression next = itr.next().obj;
if (next.getClass()==ExprToIntCast.class) {
if (((ExprToIntCast)next).expression()==child)
return cache(expr, next);
}
}
ret = child==expr.expression() ? expr : child.apply(op);
intExprs.add(new PartialCannonicalizer.Holder<IntExpression>(ret, hash));
return cache(expr,ret);
}
示例7: visit
import kodkod.ast.ExprToIntCast; //导入方法依赖的package包/类
/** @effects this.tokens' = concat[ this.tokens, "int","[",
* tokenize[node.expression], "]" ] **/
public void visit(ExprToIntCast node) {
if (displayed(node)) return;
final boolean oldTop = notTop();
switch(node.op()) {
case SUM:
append("int");
append("[");
node.expression().accept(this);
append("]");
break;
case CARDINALITY :
append("#");
append("(");
node.expression().accept(this);
append(")");
break;
default : throw new IllegalArgumentException("unknown operator: " + node.op());
}
top = oldTop;
}
示例8: visit
import kodkod.ast.ExprToIntCast; //导入方法依赖的package包/类
/** {@inheritDoc} */
public void visit(ExprToIntCast x) {
String newname=makename(x); if (newname==null) return;
String sub=make(x.expression());
switch(x.op()) {
case CARDINALITY: file.printf("IntExpression %s=%s.count();%n", newname, sub); break;
case SUM: file.printf("IntExpression %s=%s.sum();%n", newname, sub); break;
default: throw new RuntimeException("Unknown kodkod operator \""+x.op()+"\" encountered");
}
}
示例9: visit
import kodkod.ast.ExprToIntCast; //导入方法依赖的package包/类
/**
* Calls lookup(intExpr) and returns the cached value, if any.
* If a translation has not been cached, translates the expression,
* calls cache(...) on it and returns it.
* @return let t = lookup(intExpr) | some t => t,
* cache(intExpr, translate(intExpr))
*/
public final Int visit(ExprToIntCast intExpr) {
Int ret = lookup(intExpr);
if (ret!=null) return ret;
switch(intExpr.op()) {
case CARDINALITY :
ret = intExpr.expression().accept(this).cardinality(); break;
case SUM :
final IntSet ints = interpreter.ints();
ret = sum(intExpr.expression().accept(this), ints.iterator(), 0, ints.size()-1); break;
default:
throw new IllegalArgumentException("unknown operator: " + intExpr.op());
}
return cache(intExpr, ret);
}