本文整理汇总了Java中kodkod.ast.UnaryIntExpression.op方法的典型用法代码示例。如果您正苦于以下问题:Java UnaryIntExpression.op方法的具体用法?Java UnaryIntExpression.op怎么用?Java UnaryIntExpression.op使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kodkod.ast.UnaryIntExpression
的用法示例。
在下文中一共展示了UnaryIntExpression.op方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visit
import kodkod.ast.UnaryIntExpression; //导入方法依赖的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.op(intExpr.expression.accept(this)))
*/
public final Int visit(UnaryIntExpression intExpr) {
Int ret = lookup(intExpr);
if (ret != null)
return ret;
final Int child = intExpr.intExpr().accept(this);
switch (intExpr.op()) {
case NEG :
ret = child.negate();
break;
case NOT :
ret = child.not();
break;
case ABS :
ret = child.abs();
break;
case SGN :
ret = child.sgn();
break;
default :
throw new IllegalArgumentException("Unknown operator: " + intExpr.op());
}
return cache(intExpr, ret);
}
示例2: visit
import kodkod.ast.UnaryIntExpression; //导入方法依赖的package包/类
/** {@inheritDoc} */
public void visit(UnaryIntExpression x) {
String newname = makename(x);
if (newname == null)
return;
String sub = make(x.intExpr());
switch (x.op()) {
case MINUS :
file.printf("IntExpression %s=%s.negate();%n", newname, sub);
break;
case NOT :
file.printf("IntExpression %s=%s.not();%n", newname, sub);
break;
case ABS :
file.printf("IntExpression %s=%s.abs();%n", newname, sub);
break;
case SGN :
file.printf("IntExpression %s=%s.signum();%n", newname, sub);
break;
default :
throw new RuntimeException("Unknown kodkod operator \"" + x.op() + "\" encountered");
}
}
示例3: visit
import kodkod.ast.UnaryIntExpression; //导入方法依赖的package包/类
public IntExpression visit(UnaryIntExpression expr) {
IntExpression ret = lookup(expr);
if (ret!=null) return ret;
final IntOperator op = expr.op();
final IntExpression child = expr.intExpr().accept(this);
ret = simplify(op, child);
if (ret==null) {
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()==UnaryIntExpression.class) {
if (((UnaryIntExpression)next).intExpr()==child)
return cache(expr, next);
}
}
ret = child==expr.intExpr() ? expr : child.apply(op);
intExprs.add(new PartialCannonicalizer.Holder<IntExpression>(ret, hash));
}
return cache(expr,ret);
}
示例4: visit
import kodkod.ast.UnaryIntExpression; //导入方法依赖的package包/类
/**
* @ensures appends the given op and child to this.tokens; the child is
* parenthesized if it's not an instance of unary int
* expression or int constant.
**/
public void visit(UnaryIntExpression node) {
final IntExpression child = node.intExpr();
final IntOperator op = node.op();
final boolean parens = (op == IntOperator.ABS) || (op == IntOperator.SGN) || parenthesize(child);
append(node.op());
visitChild(child, parens);
}
示例5: visit
import kodkod.ast.UnaryIntExpression; //导入方法依赖的package包/类
/** {@inheritDoc} */
public void visit(UnaryIntExpression x) {
String newname=makename(x); if (newname==null) return;
String sub=make(x.intExpr());
switch(x.op()) {
case MINUS: file.printf("IntExpression %s=%s.negate();%n", newname, sub); break;
case NOT: file.printf("IntExpression %s=%s.not();%n", newname, sub); break;
case ABS: file.printf("IntExpression %s=%s.abs();%n", newname, sub); break;
case SGN: file.printf("IntExpression %s=%s.signum();%n", newname, sub); break;
default: throw new RuntimeException("Unknown kodkod operator \""+x.op()+"\" encountered");
}
}
示例6: visit
import kodkod.ast.UnaryIntExpression; //导入方法依赖的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.op(intExpr.expression.accept(this)))
*/
public final Int visit(UnaryIntExpression intExpr) {
Int ret = lookup(intExpr);
if (ret!=null) return ret;
final Int child = intExpr.intExpr().accept(this);
switch(intExpr.op()) {
case NEG : ret = child.negate(); break;
case NOT : ret = child.not(); break;
case ABS : ret = child.abs(); break;
case SGN : ret = child.sgn(); break;
default :
throw new IllegalArgumentException("Unknown operator: " + intExpr.op());
}
return cache(intExpr, ret);
}
示例7: visit
import kodkod.ast.UnaryIntExpression; //导入方法依赖的package包/类
/** @ensures appends the given op and child to this.tokens; the child is
* parenthesized if it's not an instance of unary int expression or int constant. **/
public void visit(UnaryIntExpression node) {
final IntExpression child = node.intExpr();
final IntOperator op = node.op();
final boolean parens =
(op==IntOperator.ABS) || (op==IntOperator.SGN) ||
parenthesize(child);
append(node.op());
visitChild(child, parens);
}
示例8: visit
import kodkod.ast.UnaryIntExpression; //导入方法依赖的package包/类
/** @effects appends the given op and child to this.tokens; the child is
* parenthesized if it's not an instance of unary int expression or int constant. **/
public void visit(UnaryIntExpression node) {
if (displayed(node)) return;
final boolean oldTop = notTop();
final IntExpression child = node.intExpr();
final IntOperator op = node.op();
final boolean parens =
(op==IntOperator.ABS) || (op==IntOperator.SGN) ||
parenthesize(child);
append(node.op());
visitChild(child, parens);
top = oldTop;
}
示例9: visit
import kodkod.ast.UnaryIntExpression; //导入方法依赖的package包/类
public IntExpression visit(UnaryIntExpression expr) {
IntExpression ret = lookup(expr);
if (ret!=null) return ret;
final IntOperator op = expr.op();
final IntExpression child = expr.intExpr().accept(this);
ret = simplify(op, child);
if (ret==null) {
ret = child==expr.intExpr() ? expr : child.apply(op);
}
return cache(expr,ret);
}