本文整理汇总了Java中kodkod.ast.Expression.project方法的典型用法代码示例。如果您正苦于以下问题:Java Expression.project方法的具体用法?Java Expression.project怎么用?Java Expression.project使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kodkod.ast.Expression
的用法示例。
在下文中一共展示了Expression.project方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visit
import kodkod.ast.Expression; //导入方法依赖的package包/类
/**
* Calls lookup(decls) and returns the cached value, if any. If a
* replacement has not been cached, visits each of the children's variable
* and expression. If nothing changes, the argument is cached and returned,
* otherwise a replacement Decls object is cached and returned.
*
* @return { d: Decls | d.size = decls.size && all i: [0..d.size) |
* d.declarations[i] = decls.declarations[i].accept(delegate) }
*/
public Expression visit(ProjectExpression project) {
Expression ret = lookup(project);
if (ret != null)
return ret;
final Expression expr = project.expression().accept(delegate);
final IntExpression[] cols = new IntExpression[project.arity()];
boolean allSame = expr == project.expression();
for (int i = 0, arity = project.arity(); i < arity; i++) {
cols[i] = project.column(i).accept(delegate);
allSame = allSame && (cols[i] == project.column(i));
}
ret = allSame ? project : expr.project(cols);
return cache(project, ret);
}
示例2: visit
import kodkod.ast.Expression; //导入方法依赖的package包/类
/**
* Calls lookup(decls) and returns the cached value, if any.
* If a replacement has not been cached, visits each of the children's
* variable and expression. If nothing changes, the argument is cached and
* returned, otherwise a replacement Decls object is cached and returned.
* @return { d: Decls | d.size = decls.size &&
* all i: [0..d.size) | d.declarations[i] = decls.declarations[i].accept(this) }
*/
public Expression visit(ProjectExpression project) {
Expression ret = lookup(project);
if (ret!=null) return ret;
final Expression expr = project.expression().accept(this);
final IntExpression[] cols = new IntExpression[project.arity()];
boolean allSame = expr==project.expression();
for(int i = 0, arity = project.arity(); i < arity; i++) {
cols[i] = project.column(i).accept(this);
allSame = allSame && (cols[i]==project.column(i));
}
ret = allSame ? project : expr.project(cols);
return cache(project, ret);
}