本文整理汇总了Java中kodkod.ast.Expression.accept方法的典型用法代码示例。如果您正苦于以下问题:Java Expression.accept方法的具体用法?Java Expression.accept怎么用?Java Expression.accept使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kodkod.ast.Expression
的用法示例。
在下文中一共展示了Expression.accept方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visit
import kodkod.ast.Expression; //导入方法依赖的package包/类
/**
* Calls lookup(expr) and returns the cached value, if any. If a replacement
* has not been cached, visits the expr's children. If nothing changes, the
* argument is cached and returned, otherwise a replacement expr is cached
* and returned.
*
* @return { e: Expression | e.op = expr.op && #e.children = #expr.children
* && all i: [0..expr.children) | e.child(i) =
* expr.child(i).accept(delegate) }
*/
public Expression visit(NaryExpression expr) {
Expression ret = lookup(expr);
if (ret != null)
return ret;
final Expression[] visited = new Expression[expr.size()];
boolean allSame = true;
for (int i = 0; i < visited.length; i++) {
final Expression child = expr.child(i);
visited[i] = child.accept(delegate);
allSame = allSame && visited[i] == child;
}
ret = allSame ? expr : Expression.compose(expr.op(), visited);
return cache(expr, ret);
}
示例2: visit
import kodkod.ast.Expression; //导入方法依赖的package包/类
/**
* Calls lookup(expr) and returns the cached value, if any.
* If a replacement has not been cached, visits the expr's
* children. If nothing changes, the argument is cached and
* returned, otherwise a replacement expr is cached and returned.
* @return { e: Expression | e.op = expr.op && #e.children = #expr.children && all i: [0..expr.children) | e.child(i) = expr.child(i).accept(this) }
*/
public Expression visit(NaryExpression expr) {
Expression ret = lookup(expr);
if (ret!=null) return ret;
final Expression[] visited = new Expression[expr.size()];
boolean allSame = true;
for(int i = 0 ; i < visited.length; i++) {
final Expression child = expr.child(i);
visited[i] = child.accept(this);
allSame = allSame && visited[i]==child;
}
ret = allSame ? expr : Expression.compose(expr.op(), visited);
return cache(expr,ret);
}
示例3: visit
import kodkod.ast.Expression; //导入方法依赖的package包/类
/**
* Visits the children if this.visited(expr) returns false. Otherwise does
* nothing.
*
* @ensures all i: [0..#expr.children) | expr.child(i).accept(this)
*/
public void visit(NaryExpression expr) {
if (visited(expr))
return;
for (Expression child : expr) {
child.accept(this);
}
}
示例4: visit
import kodkod.ast.Expression; //导入方法依赖的package包/类
/**
* Calls lookup(expr) and returns the cached value, if any. If no cached
* value exists, visits each child, caches the disjunction of the children's
* return values and returns it.
*
* @return let x = lookup(expr) | x != null => x, cache(expr,
* expr.child(0).accept(this) || ... ||
* expr.child(expr.size()-1).accept(this))
*/
public Boolean visit(NaryExpression expr) {
final Boolean ret = lookup(expr);
if (ret != null)
return ret;
for (Expression child : expr) {
if (child.accept(this))
return cache(expr, true);
}
return cache(expr, false);
}
示例5: visit
import kodkod.ast.Expression; //导入方法依赖的package包/类
/**
* Visits the children if this.visited(expr) returns false. Otherwise does nothing.
* @ensures all i: [0..#expr.children) | expr.child(i).accept(this)
*/
public void visit(NaryExpression expr) {
if (visited(expr)) return;
for(Expression child : expr) {
child.accept(this);
}
}
示例6: visit
import kodkod.ast.Expression; //导入方法依赖的package包/类
/**
* Calls lookup(expr) and returns the cached value, if any.
* If no cached value exists, visits each child, caches the
* disjunction of the children's return values and returns it.
* @return let x = lookup(expr) |
* x != null => x,
* cache(expr, expr.child(0).accept(this) || ... || expr.child(expr.size()-1).accept(this))
*/
public Boolean visit(NaryExpression expr) {
final Boolean ret = lookup(expr);
if (ret!=null) return ret;
for(Expression child : expr) {
if (child.accept(this))
return cache(expr, true);
}
return cache(expr, false);
}