本文整理汇总了Java中kodkod.ast.UnaryIntExpression类的典型用法代码示例。如果您正苦于以下问题:Java UnaryIntExpression类的具体用法?Java UnaryIntExpression怎么用?Java UnaryIntExpression使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UnaryIntExpression类属于kodkod.ast包,在下文中一共展示了UnaryIntExpression类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:32,代码来源:FOL2BoolTranslator.java
示例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");
}
}
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:24,代码来源:TranslateKodkodToJava.java
示例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);
}
开发者ID:wala,项目名称:MemSAT,代码行数:23,代码来源:PartialCannonicalizer.java
示例4: visit
import kodkod.ast.UnaryIntExpression; //导入依赖的package包/类
/**
* Calls lookup(intExpr) and returns the cached value, if any. If a
* replacement has not been cached, visits the expression's child. If
* nothing changes, the argument is cached and returned, otherwise a
* replacement expression is cached and returned.
*
* @return { u: UnaryIntExpression | u.expression =
* intExpr.expression.accept(delegate) && u.op = intExpr.op }
*/
public IntExpression visit(UnaryIntExpression intExpr) {
IntExpression ret = lookup(intExpr);
if (ret != null)
return ret;
final IntExpression child = intExpr.intExpr().accept(delegate);
ret = (child == intExpr.intExpr()) ? intExpr : child.apply(intExpr.op());
return cache(intExpr, ret);
}
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:19,代码来源:AbstractReplacer.java
示例5: visit
import kodkod.ast.UnaryIntExpression; //导入依赖的package包/类
/**
* Calls lookup(intExpr) and returns the cached value, if any. If no cached
* value exists, visits the child, caches its return value and returns it.
*
* @return let x = lookup(intExpr) | x != null => x, cache(intExpr,
* intExpr.expression.accept(this))
*/
public Set<T> visit(UnaryIntExpression intExpr) {
Set<T> ret = lookup(intExpr);
if (ret != null)
return ret;
ret = newSet();
ret.addAll(intExpr.intExpr().accept(this));
return cache(intExpr, ret);
}
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:16,代码来源:AbstractCollector.java
示例6: 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);
}
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:13,代码来源:PrettyPrinter.java
示例7: 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");
}
}
开发者ID:ModelWriter,项目名称:Tarski,代码行数:13,代码来源:TranslateKodkodToJava.java
示例8: visit
import kodkod.ast.UnaryIntExpression; //导入依赖的package包/类
/**
* Calls lookup(intExpr) and returns the cached value, if any.
* If a replacement has not been cached, visits the expression's
* child. If nothing changes, the argument is cached and
* returned, otherwise a replacement expression is cached and returned.
* @return { u: UnaryIntExpression | u.expression = intExpr.expression.accept(this) && u.op = intExpr.op }
*/
public IntExpression visit(UnaryIntExpression intExpr) {
IntExpression ret = lookup(intExpr);
if (ret!=null) return ret;
final IntExpression child = intExpr.intExpr().accept(this);
ret = (child==intExpr.intExpr()) ? intExpr : child.apply(intExpr.op());
return cache(intExpr,ret);
}
开发者ID:ModelWriter,项目名称:Tarski,代码行数:16,代码来源:AbstractReplacer.java
示例9: visit
import kodkod.ast.UnaryIntExpression; //导入依赖的package包/类
/**
* Calls lookup(intExpr) and returns the cached value, if any.
* If no cached value exists, visits the child, caches its return value and returns it.
* @return let x = lookup(intExpr) |
* x != null => x,
* cache(intExpr, intExpr.expression.accept(this))
*/
public Set<T> visit(UnaryIntExpression intExpr) {
Set<T> ret = lookup(intExpr);
if (ret!=null) return ret;
ret = newSet();
ret.addAll(intExpr.intExpr().accept(this));
return cache(intExpr,ret);
}
开发者ID:ModelWriter,项目名称:Tarski,代码行数:15,代码来源:AbstractCollector.java
示例10: 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);
}
开发者ID:ModelWriter,项目名称:Tarski,代码行数:22,代码来源:FOL2BoolTranslator.java
示例11: 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);
}
开发者ID:ModelWriter,项目名称:Tarski,代码行数:12,代码来源:PrettyPrinter.java
示例12: 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;
}
开发者ID:wala,项目名称:MemSAT,代码行数:15,代码来源:PrettyPrinter.java
示例13: 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);
}
开发者ID:wala,项目名称:MemSAT,代码行数:14,代码来源:Simplifier.java
示例14: visit
import kodkod.ast.UnaryIntExpression; //导入依赖的package包/类
@Override
public I visit(UnaryIntExpression intExpr) {
start(intExpr);
return end(intExpr, visitor.visit(intExpr));
}
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:6,代码来源:AspectReturnVisitor.java
示例15: visit
import kodkod.ast.UnaryIntExpression; //导入依赖的package包/类
@Override
public IntExpression visit(UnaryIntExpression intExpr) {
return intExpr;
}
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:5,代码来源:HOLTranslator.java
示例16: parenthesize
import kodkod.ast.UnaryIntExpression; //导入依赖的package包/类
/**
* @return true if the given expression should be parenthesized when a
* child of a compound parent
*/
private boolean parenthesize(IntExpression child) {
return !(child instanceof UnaryIntExpression || child instanceof IntConstant
|| child instanceof ExprToIntCast);
}
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:9,代码来源:PrettyPrinter.java
示例17: visit
import kodkod.ast.UnaryIntExpression; //导入依赖的package包/类
public Boolean visit(UnaryIntExpression e) {
return checkVisitedThenAccumA(e, Boolean.FALSE, e.intExpr());
}
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:4,代码来源:AnnotatedNode.java
示例18: parenthesize
import kodkod.ast.UnaryIntExpression; //导入依赖的package包/类
/** @return true if the given expression should be parenthesized when a
* child of a compound parent */
private boolean parenthesize(IntExpression child) {
return !(child instanceof UnaryIntExpression ||
child instanceof IntConstant ||
child instanceof ExprToIntCast);
}
开发者ID:ModelWriter,项目名称:Tarski,代码行数:8,代码来源:PrettyPrinter.java
示例19: visit
import kodkod.ast.UnaryIntExpression; //导入依赖的package包/类
/**
* Visits the given unary integer expression.
*/
public void visit(UnaryIntExpression intExpr);
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:5,代码来源:VoidVisitor.java
示例20: visit
import kodkod.ast.UnaryIntExpression; //导入依赖的package包/类
/**
* Visits the subexpression if this.visited(intExpr) returns false.
* Otherwise does nothing.
*
* @ensures unaryExpr.expression.accept(this)
*/
public void visit(UnaryIntExpression intExpr) {
if (visited(intExpr))
return;
intExpr.intExpr().accept(this);
}
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:12,代码来源:AbstractVoidVisitor.java
注:本文中的kodkod.ast.UnaryIntExpression类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论