本文整理汇总了Java中kodkod.ast.BinaryIntExpression.op方法的典型用法代码示例。如果您正苦于以下问题:Java BinaryIntExpression.op方法的具体用法?Java BinaryIntExpression.op怎么用?Java BinaryIntExpression.op使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kodkod.ast.BinaryIntExpression
的用法示例。
在下文中一共展示了BinaryIntExpression.op方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visit
import kodkod.ast.BinaryIntExpression; //导入方法依赖的package包/类
/** {@inheritDoc} */
public void visit(BinaryIntExpression x) {
String newname=makename(x); if (newname==null) return;
String left=make(x.left());
String right=make(x.right());
switch(x.op()) {
case PLUS: file.printf("IntExpression %s=%s.plus(%s);%n", newname, left, right); break;
case MINUS: file.printf("IntExpression %s=%s.minus(%s);%n", newname, left, right); break;
case MULTIPLY: file.printf("IntExpression %s=%s.multiply(%s);%n", newname, left, right); break;
case DIVIDE: file.printf("IntExpression %s=%s.divide(%s);%n", newname, left, right); break;
case MODULO: file.printf("IntExpression %s=%s.modulo(%s);%n", newname, left, right); break;
case AND: file.printf("IntExpression %s=%s.and(%s);%n", newname, left, right); break;
case OR: file.printf("IntExpression %s=%s.or(%s);%n", newname, left, right); break;
case XOR: file.printf("IntExpression %s=%s.xor(%s);%n", newname, left, right); break;
case SHA: file.printf("IntExpression %s=%s.sha(%s);%n", newname, left, right); break;
case SHL: file.printf("IntExpression %s=%s.shl(%s);%n", newname, left, right); break;
case SHR: file.printf("IntExpression %s=%s.shr(%s);%n", newname, left, right); break;
default: throw new RuntimeException("Unknown kodkod operator \""+x.op()+"\" encountered");
}
}
示例2: visit
import kodkod.ast.BinaryIntExpression; //导入方法依赖的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, intExpr.left.accept(this) intExpr.op intExpr.right.accept(this))
*/
public final Int visit(BinaryIntExpression intExpr) {
Int ret = lookup(intExpr);
if (ret!=null) return ret;
final Int left = intExpr.left().accept(this);
final Int right = intExpr.right().accept(this);
switch(intExpr.op()) {
case PLUS : ret = left.plus(right); break;
case MINUS : ret = left.minus(right); break;
case MULTIPLY : ret = left.multiply(right); break;
case DIVIDE : ret = left.divide(right); break;
case MODULO : ret = left.modulo(right); break;
case AND : ret = left.and(right); break;
case OR : ret = left.or(right); break;
case XOR : ret = left.xor(right); break;
case SHL : ret = left.shl(right); break;
case SHR : ret = left.shr(right); break;
case SHA : ret = left.sha(right); break;
default :
throw new IllegalArgumentException("Unknown operator: " + intExpr.op());
}
return cache(intExpr, ret);
}
示例3: visit
import kodkod.ast.BinaryIntExpression; //导入方法依赖的package包/类
/**
* @ensures appends the tokenization of the given node to this.tokens
*/
public void visit(BinaryIntExpression node) {
final IntOperator op = node.op();
visitChild(node.left(), parenthesize(op, node.left()));
infix(op);
visitChild(node.right(), parenthesize(op, node.right()));
}
示例4: visit
import kodkod.ast.BinaryIntExpression; //导入方法依赖的package包/类
/** @ensures appends the tokenization of the given node to this.tokens */
public void visit(BinaryIntExpression node) {
final IntOperator op = node.op();
visitChild(node.left(), parenthesize(op, node.left()));
infix(op);
visitChild(node.right(), parenthesize(op, node.right()));
}
示例5: visit
import kodkod.ast.BinaryIntExpression; //导入方法依赖的package包/类
public IntExpression visit(BinaryIntExpression expr) {
IntExpression ret = lookup(expr);
if (ret!=null) return ret;
final IntOperator op = expr.op();
final IntExpression left = expr.left().accept(this);
final IntExpression right = expr.right().accept(this);
ret = simplify(op, left, right);
if (ret==null) {
final int hash = hash(op, left, right);
for(Iterator<PartialCannonicalizer.Holder<IntExpression>> itr = intExprs.get(hash); itr.hasNext(); ) {
final IntExpression next = itr.next().obj;
if (next instanceof BinaryIntExpression) {
final BinaryIntExpression hit = (BinaryIntExpression) next;
if (hit.op()==op && hit.left()==left && hit.right()==right) {
return cache(expr, hit);
}
}
}
ret = left==expr.left()&&right==expr.right() ? expr : left.compose(op, right);
intExprs.add(new PartialCannonicalizer.Holder<IntExpression>(ret, hash));
}
return cache(expr,ret);
}
示例6: visit
import kodkod.ast.BinaryIntExpression; //导入方法依赖的package包/类
/** @effects appends the tokenization of the given node to this.tokens */
public void visit(BinaryIntExpression node) {
if (displayed(node)) return;
final boolean oldTop = notTop();
final IntOperator op = node.op();
visitChild(node.left(), parenthesize(op, node.left()));
infix(op);
visitChild(node.right(), parenthesize(op, node.right()));
top = oldTop;
}
示例7: visit
import kodkod.ast.BinaryIntExpression; //导入方法依赖的package包/类
public IntExpression visit(BinaryIntExpression expr) {
IntExpression ret = lookup(expr);
if (ret!=null) return ret;
final IntOperator op = expr.op();
final IntExpression left = expr.left().accept(this);
final IntExpression right = expr.right().accept(this);
ret = simplify(op, left, right);
if (ret==null) {
ret = left==expr.left()&&right==expr.right() ? expr : left.compose(op, right);
}
return cache(expr,ret);
}
示例8: visit
import kodkod.ast.BinaryIntExpression; //导入方法依赖的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,
* intExpr.left.accept(this) intExpr.op intExpr.right.accept(this))
*/
public final Int visit(BinaryIntExpression intExpr) {
Int ret = lookup(intExpr);
if (ret != null)
return ret;
final Int left = intExpr.left().accept(this);
final Int right = intExpr.right().accept(this);
switch (intExpr.op()) {
case PLUS :
ret = left.plus(right);
break;
case MINUS :
ret = left.minus(right);
break;
case MULTIPLY :
ret = left.multiply(right);
break;
case DIVIDE :
ret = left.divide(right);
break;
case MODULO :
ret = left.modulo(right);
break;
case AND :
ret = left.and(right);
break;
case OR :
ret = left.or(right);
break;
case XOR :
ret = left.xor(right);
break;
case SHL :
ret = left.shl(right);
break;
case SHR :
ret = left.shr(right);
break;
case SHA :
ret = left.sha(right);
break;
default :
throw new IllegalArgumentException("Unknown operator: " + intExpr.op());
}
return cache(intExpr, ret);
}
示例9: visit
import kodkod.ast.BinaryIntExpression; //导入方法依赖的package包/类
/** {@inheritDoc} */
public void visit(BinaryIntExpression x) {
String newname = makename(x);
if (newname == null)
return;
String left = make(x.left());
String right = make(x.right());
switch (x.op()) {
case PLUS :
file.printf("IntExpression %s=%s.plus(%s);%n", newname, left, right);
break;
case MINUS :
file.printf("IntExpression %s=%s.minus(%s);%n", newname, left, right);
break;
case MULTIPLY :
file.printf("IntExpression %s=%s.multiply(%s);%n", newname, left, right);
break;
case DIVIDE :
file.printf("IntExpression %s=%s.divide(%s);%n", newname, left, right);
break;
case MODULO :
file.printf("IntExpression %s=%s.modulo(%s);%n", newname, left, right);
break;
case AND :
file.printf("IntExpression %s=%s.and(%s);%n", newname, left, right);
break;
case OR :
file.printf("IntExpression %s=%s.or(%s);%n", newname, left, right);
break;
case XOR :
file.printf("IntExpression %s=%s.xor(%s);%n", newname, left, right);
break;
case SHA :
file.printf("IntExpression %s=%s.sha(%s);%n", newname, left, right);
break;
case SHL :
file.printf("IntExpression %s=%s.shl(%s);%n", newname, left, right);
break;
case SHR :
file.printf("IntExpression %s=%s.shr(%s);%n", newname, left, right);
break;
default :
throw new RuntimeException("Unknown kodkod operator \"" + x.op() + "\" encountered");
}
}