kodkod.ast.visitor.VoidVisitor Java Examples
The following examples show how to use
kodkod.ast.visitor.VoidVisitor.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Nodes.java From kodkod with MIT License | 5 votes |
/** * Returns a minimal subset of {@linkplain #roots(Formula) roots} of the given formula such that all nodes in the given collection * are reachable from those roots. The returned subset is a local minimum in that none of its members can be removed without leaving * some node in the descendants set unreachable from the remaining roots. * @requires descendants in formula.*components * @return { s: Set<Formula> | s.elements in roots(formula) and descendants in s.elements.*components and * no s': Set<Formula> | s.containsAll(s') and s'.size()<s.size() and descendants in s.elements.*components } * @throws IllegalArgumentException descendants !in formula.*components */ public static Set<Formula> minRoots(Formula formula, Collection<? extends Node> descendants) { final Set<Node> desc = new IdentityHashSet<Node>(descendants); final VoidVisitor visitor = new AbstractVoidVisitor() { final Set<Node> visited = new IdentityHashSet<Node>(); @Override protected boolean visited(Node n) { if (visited.add(n)) { desc.remove(n); return false; } return true; } }; final Set<Formula> roots = new LinkedHashSet<Formula>(); for(Formula root : roots(formula)) { final int size = desc.size(); root.accept(visitor); if (desc.size()<size) { roots.add(root); } if (desc.isEmpty()) { break; } } if (!desc.isEmpty()) throw new IllegalArgumentException("descendants !in formula.*components: formula="+formula+" ; descendants="+descendants); return roots; }
Example #2
Source File: Nodes.java From org.alloytools.alloy with Apache License 2.0 | 5 votes |
/** * Returns a minimal subset of {@linkplain #roots(Formula) roots} of the given * formula such that all nodes in the given collection are reachable from those * roots. The returned subset is a local minimum in that none of its members can * be removed without leaving some node in the descendants set unreachable from * the remaining roots. * * @requires descendants in formula.*components * @return { s: Set<Formula> | s.elements in roots(formula) and descendants in * s.elements.*components and no s': Set<Formula> | s.containsAll(s') * and s'.size()<s.size() and descendants in s.elements.*components } * @throws IllegalArgumentException descendants !in formula.*components */ public static Set<Formula> minRoots(Formula formula, Collection< ? extends Node> descendants) { final Set<Node> desc = new IdentityHashSet<Node>(descendants); final VoidVisitor visitor = new AbstractVoidVisitor() { final Set<Node> visited = new IdentityHashSet<Node>(); @Override protected boolean visited(Node n) { if (visited.add(n)) { desc.remove(n); return false; } return true; } }; final Set<Formula> roots = new LinkedHashSet<Formula>(); for (Formula root : roots(formula)) { final int size = desc.size(); root.accept(visitor); if (desc.size() < size) { roots.add(root); } if (desc.isEmpty()) { break; } } if (!desc.isEmpty()) throw new IllegalArgumentException("descendants !in formula.*components: formula=" + formula + " ; descendants=" + descendants); return roots; }
Example #3
Source File: SumExpression.java From kodkod with MIT License | 4 votes |
/** * {@inheritDoc} * @see kodkod.ast.IntExpression#accept(kodkod.ast.visitor.VoidVisitor) */ @Override public void accept(VoidVisitor visitor) { visitor.visit(this); }
Example #4
Source File: IntConstant.java From kodkod with MIT License | 4 votes |
/** * {@inheritDoc} * @see kodkod.ast.IntExpression#accept(kodkod.ast.visitor.VoidVisitor) */ @Override public void accept(VoidVisitor visitor) { visitor.visit(this); }
Example #5
Source File: NaryFormula.java From kodkod with MIT License | 4 votes |
/** * {@inheritDoc} * @see kodkod.ast.Node#accept(kodkod.ast.visitor.VoidVisitor) */ @Override public void accept(VoidVisitor visitor) { visitor.visit(this); }
Example #6
Source File: UnaryIntExpression.java From kodkod with MIT License | 4 votes |
/** * {@inheritDoc} * @see kodkod.ast.IntExpression#accept(kodkod.ast.visitor.VoidVisitor) */ @Override public void accept(VoidVisitor visitor) { visitor.visit(this); }
Example #7
Source File: NaryIntExpression.java From kodkod with MIT License | 4 votes |
/** * {@inheritDoc} * @see kodkod.ast.IntExpression#accept(kodkod.ast.visitor.VoidVisitor) */ @Override public void accept(VoidVisitor visitor) { visitor.visit(this); }
Example #8
Source File: IfIntExpression.java From kodkod with MIT License | 4 votes |
/** * {@inheritDoc} * @see kodkod.ast.IntExpression#accept(kodkod.ast.visitor.VoidVisitor) */ @Override public void accept(VoidVisitor visitor) { visitor.visit(this); }
Example #9
Source File: NaryExpression.java From kodkod with MIT License | 4 votes |
/** * {@inheritDoc} * @see kodkod.ast.Node#accept(kodkod.ast.visitor.VoidVisitor) */ @Override public void accept(VoidVisitor visitor) { visitor.visit(this); }
Example #10
Source File: FixFormula.java From org.alloytools.alloy with Apache License 2.0 | 4 votes |
@Override public void accept(VoidVisitor visitor) { visitor.visit(this); }
Example #11
Source File: BinaryIntExpression.java From kodkod with MIT License | 4 votes |
/** * {@inheritDoc} * @see kodkod.ast.IntExpression#accept(kodkod.ast.visitor.VoidVisitor) */ @Override public void accept(VoidVisitor visitor) { visitor.visit(this); }
Example #12
Source File: ExprToIntCast.java From kodkod with MIT License | 4 votes |
/** * {@inheritDoc} * @see kodkod.ast.IntExpression#accept(kodkod.ast.visitor.VoidVisitor) */ @Override public void accept(VoidVisitor visitor) { visitor.visit(this); }
Example #13
Source File: IntComparisonFormula.java From kodkod with MIT License | 2 votes |
/** * {@inheritDoc} * @see kodkod.ast.Node#accept(kodkod.ast.visitor.VoidVisitor) */ public void accept(VoidVisitor visitor) { visitor.visit(this); }
Example #14
Source File: Comprehension.java From kodkod with MIT License | 2 votes |
/** * {@inheritDoc} * @see kodkod.ast.Node#accept(kodkod.ast.visitor.VoidVisitor) */ public void accept(VoidVisitor visitor) { visitor.visit(this); }
Example #15
Source File: ComparisonFormula.java From kodkod with MIT License | 2 votes |
/** * {@inheritDoc} * @see kodkod.ast.Node#accept(kodkod.ast.visitor.VoidVisitor) */ public void accept(VoidVisitor visitor) { visitor.visit(this); }
Example #16
Source File: Node.java From kodkod with MIT License | 2 votes |
/** * Accepts the given void visitor by calling visitor.visit(this). * @throws NullPointerException visitor = null */ public abstract void accept(VoidVisitor visitor);
Example #17
Source File: BinaryExpression.java From kodkod with MIT License | 2 votes |
/** * {@inheritDoc} * @see kodkod.ast.Node#accept(kodkod.ast.visitor.VoidVisitor) */ public void accept(VoidVisitor visitor) { visitor.visit(this); }
Example #18
Source File: IntToExprCast.java From kodkod with MIT License | 2 votes |
/** * {@inheritDoc} * @see kodkod.ast.Node#accept(kodkod.ast.visitor.VoidVisitor) */ public void accept(VoidVisitor visitor) { visitor.visit(this); }
Example #19
Source File: ProjectExpression.java From kodkod with MIT License | 2 votes |
/** * {@inheritDoc} * @see kodkod.ast.Node#accept(kodkod.ast.visitor.VoidVisitor) */ public void accept(VoidVisitor visitor) { visitor.visit(this); }
Example #20
Source File: ConstantFormula.java From kodkod with MIT License | 2 votes |
/** * {@inheritDoc} * @see kodkod.ast.Node#accept(kodkod.ast.visitor.VoidVisitor) */ public void accept(VoidVisitor visitor) { visitor.visit(this); }
Example #21
Source File: Variable.java From org.alloytools.alloy with Apache License 2.0 | 2 votes |
/** * {@inheritDoc} * * @see kodkod.ast.Node#accept(kodkod.ast.visitor.VoidVisitor) */ @Override public void accept(VoidVisitor visitor) { visitor.visit(this); }
Example #22
Source File: NotFormula.java From kodkod with MIT License | 2 votes |
/** * {@inheritDoc} * @see kodkod.ast.Node#accept(kodkod.ast.visitor.VoidVisitor) */ public void accept(VoidVisitor visitor) { visitor.visit(this); }
Example #23
Source File: RelationPredicate.java From kodkod with MIT License | 2 votes |
/** * {@inheritDoc} * @see kodkod.ast.Node#accept(kodkod.ast.visitor.VoidVisitor) */ public void accept(VoidVisitor visitor) { visitor.visit(this); }
Example #24
Source File: Decls.java From kodkod with MIT License | 2 votes |
/** * {@inheritDoc} * @see kodkod.ast.Node#accept(kodkod.ast.visitor.VoidVisitor) */ public void accept(VoidVisitor visitor) { visitor.visit(this); }
Example #25
Source File: UnaryExpression.java From kodkod with MIT License | 2 votes |
/** * {@inheritDoc} * @see kodkod.ast.Node#accept(kodkod.ast.visitor.VoidVisitor) */ public void accept(VoidVisitor visitor) { visitor.visit(this); }
Example #26
Source File: Relation.java From kodkod with MIT License | 2 votes |
/** * {@inheritDoc} * @see kodkod.ast.Node#accept(kodkod.ast.visitor.VoidVisitor) */ public void accept(VoidVisitor visitor) { visitor.visit(this); }
Example #27
Source File: IntExpression.java From kodkod with MIT License | 2 votes |
/** * {@inheritDoc} * @see kodkod.ast.Node#accept(kodkod.ast.visitor.VoidVisitor) */ public abstract void accept(VoidVisitor visitor);
Example #28
Source File: IfExpression.java From kodkod with MIT License | 2 votes |
/** * {@inheritDoc} * @see kodkod.ast.Node#accept(kodkod.ast.visitor.VoidVisitor) */ public void accept(VoidVisitor visitor) { visitor.visit(this); }
Example #29
Source File: QuantifiedFormula.java From kodkod with MIT License | 2 votes |
/** * {@inheritDoc} * @see kodkod.ast.Node#accept(kodkod.ast.visitor.VoidVisitor) */ public void accept(VoidVisitor visitor) { visitor.visit(this); }
Example #30
Source File: Decl.java From kodkod with MIT License | 2 votes |
/** * {@inheritDoc} * @see kodkod.ast.Node#accept(kodkod.ast.visitor.VoidVisitor) */ public void accept(VoidVisitor visitor) { visitor.visit(this); }