当前位置: 首页>>代码示例>>Java>>正文


Java Expression.project方法代码示例

本文整理汇总了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);
}
 
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:25,代码来源:AbstractReplacer.java

示例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);
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:23,代码来源:AbstractReplacer.java


注:本文中的kodkod.ast.Expression.project方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。