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


Java Expression.accept方法代码示例

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

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

示例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);
	}
}
 
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:14,代码来源:AbstractVoidVisitor.java

示例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);
}
 
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:20,代码来源:AbstractDetector.java

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

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


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