本文整理汇总了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);
}
示例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);
}
示例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(")");
}
}
示例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();
}
示例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);
}
示例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);
}
示例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);
}
}
示例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();
}
示例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();
}
示例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);
}
示例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(")"); }
}
示例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();
}
示例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();
}