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


Java Node.accept方法代码示例

本文整理汇总了Java中kodkod.ast.Node.accept方法的典型用法代码示例。如果您正苦于以下问题:Java Node.accept方法的具体用法?Java Node.accept怎么用?Java Node.accept使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在kodkod.ast.Node的用法示例。


在下文中一共展示了Node.accept方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: visit

import kodkod.ast.Node; //导入方法依赖的package包/类
/**
 * Visits the given comprehension, quantified formula, or sum
 * expression. The method returns TRUE if the creator body contains any
 * variable not bound by the decls; otherwise returns FALSE.
 */
private Boolean visit(Node creator, Decls decls, Node body) {
	Boolean ret = lookup(creator);
	if (ret != null)
		return ret;
	boolean retVal = false;
	for (Decl decl : decls) {
		retVal = decl.expression().accept(this) || retVal;
		varsInScope.push(decl.variable());
	}
	retVal = ((Boolean) body.accept(this)) || retVal;
	for (int i = decls.size(); i > 0; i--) {
		varsInScope.pop();
	}
	return cache(creator, retVal);
}
 
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:21,代码来源:AnnotatedNode.java

示例2: visit

import kodkod.ast.Node; //导入方法依赖的package包/类
/**
 * Visits the given comprehension, quantified formula, or sum expression.  
 * The method returns TRUE if the creator body contains any 
 * variable not bound by the decls; otherwise returns FALSE.  
 */
private Boolean visit(Node creator, Decls decls, Node body) {
	Boolean ret = lookup(creator);
	if (ret!=null) return ret;
	boolean retVal = false;
	for(Decl decl : decls) {
		retVal = decl.expression().accept(this) || retVal;
		varsInScope.push(decl.variable());
	}
	retVal = ((Boolean)body.accept(this)) || retVal;
	for(int i = decls.size(); i > 0; i--) {
		varsInScope.pop();
	}
	return cache(creator, retVal);
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:20,代码来源:AnnotatedNode.java

示例3: visitChild

import kodkod.ast.Node; //导入方法依赖的package包/类
/**
 * @ensures this.tokenize' = (parenthesize => concat [ this.tokens, "(",
 *          tokenize[child], ")" ] else concat [ this.tokens,
 *          tokenize[child] ]
 */
private void visitChild(Node child, boolean parenthesize) {
	if (parenthesize) {
		append("(");
	}
	child.accept(this);
	if (parenthesize) {
		append(")");
	}
}
 
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:15,代码来源:PrettyPrinter.java

示例4: apply

import kodkod.ast.Node; //导入方法依赖的package包/类
static String apply(Node node) {
	final Dotifier dot = new Dotifier();
	dot.graph.append("digraph {\n");
	node.accept(dot);
	dot.graph.append("}");
	return dot.graph.toString();
}
 
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:8,代码来源:PrettyPrinter.java

示例5: visit

import kodkod.ast.Node; //导入方法依赖的package包/类
private void visit(Node parent, Object label, Node child) {
	if (visited(parent))
		return;
	node(parent, label.toString());
	child.accept(this);
	edge(parent, child);
}
 
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:8,代码来源:PrettyPrinter.java

示例6: accum

import kodkod.ast.Node; //导入方法依赖的package包/类
private <E extends Node> Boolean accum(Node n, Boolean acc, Iterable<E> subs) {
	for (Node child : subs) {
		Boolean res = (Boolean) child.accept(this);
		acc = acc || res;
	}
	return place(n, acc);
}
 
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:8,代码来源:AnnotatedNode.java

示例7: visit

import kodkod.ast.Node; //导入方法依赖的package包/类
private void visit(Node parent, Object label, Iterator<? extends Node> children) {
	if (visited(parent)) return;
	node(parent, label.toString());
	while(children.hasNext()) {
		Node child = children.next();
		child.accept(this);
		edge(parent, child);
	}
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:10,代码来源:PrettyPrinter.java

示例8: Skolemizer

import kodkod.ast.Node; //导入方法依赖的package包/类
/**
 * Constructs a skolem replacer from the given arguments. 
 */
private Skolemizer(AnnotatedNode<Formula> annotated, Bounds bounds, Options options) {
	super(annotated.sharedNodes());

	// only cache intermediate computations for expressions with no free variables
	// and formulas with no free variables and no quantified descendents
	final AbstractDetector fvdetect = annotated.freeVariableDetector();
	final AbstractDetector qdetect = annotated.quantifiedFormulaDetector();
	for(Node n: annotated.sharedNodes()) {
		if (!(Boolean)n.accept(fvdetect)) {
			if (!(n instanceof Formula) || !((Boolean)n.accept(qdetect)))
				this.cache.put(n, null);
		}
	}
	this.reporter = options.reporter();
	this.bounds = bounds;
	this.interpreter = LeafInterpreter.overapproximating(bounds, options);
	this.repEnv = Environment.empty();
	this.nonSkolems = new ArrayList<DeclInfo>();
	this.nonSkolemsView = new AbstractList<Decl>() {
		public Decl get(int index) { return nonSkolems.get(index).decl;	}
		public int size() { return nonSkolems.size(); }
	};
	this.topSkolemConstraints = new ArrayList<Formula>();
	this.negated = false;
	this.skolemDepth = options.skolemDepth();
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:30,代码来源:Skolemizer.java

示例9: apply

import kodkod.ast.Node; //导入方法依赖的package包/类
static String apply(Node node) { 
	final Dotifier dot = new Dotifier();
	dot.graph.append("digraph {\n");
	node.accept(dot);
	dot.graph.append("}");
	return dot.graph.toString();
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:8,代码来源:PrettyPrinter.java

示例10: make

import kodkod.ast.Node; //导入方法依赖的package包/类
/**
 * Given a node, call the visitor to dump its text out, then return its
 * name.
 */
private String make(Node x) {
	x.accept(this);
	return map.get(x);
}
 
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:9,代码来源:TranslateKodkodToJava.java

示例11: visitChild

import kodkod.ast.Node; //导入方法依赖的package包/类
/** @ensures this.tokenize' = 
 *   (parenthesize => concat [ this.tokens, "(", tokenize[child], ")" ] else 
 *                    concat [ this.tokens, tokenize[child] ]*/
private void visitChild(Node child, boolean parenthesize) { 
	if (parenthesize) { append("("); }
	child.accept(this);
	if (parenthesize) { append(")"); }
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:9,代码来源:PrettyPrinter.java

示例12: print

import kodkod.ast.Node; //导入方法依赖的package包/类
/**
 * Returns a pretty-printed string representation of the given node, with
 * each line offset by at least the given number of whitespaces. The line
 * parameter determines the length of each pretty-printed line, including
 * the offset.
 * 
 * @requires 0 <= offset < line
 * @return a pretty-printed string representation of the given node
 */
public static String print(Node node, int offset, int line) {
	final Formatter formatter = new Formatter(offset, line);
	node.accept(formatter);
	return formatter.tokens.toString();
}
 
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:15,代码来源:PrettyPrinter.java

示例13: print

import kodkod.ast.Node; //导入方法依赖的package包/类
/**
 * Returns a pretty-printed string representation of the 
 * given node, with each line offset by at least the given
 * number of whitespaces.  The line parameter determines the
 * length of each pretty-printed line, including the offset.
 * @requires 0 <= offset < line
 * @return a pretty-printed string representation of the 
 * given node
 */
public static String print(Node node, int offset, int line) { 
	final Formatter formatter = new Formatter(offset,line);
	node.accept(formatter);
	return formatter.tokens.toString();
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:15,代码来源:PrettyPrinter.java


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