@PublicApi public class NodeTraverser extends java.lang.Object
Node
tree.Constructor and Description |
---|
NodeTraverser() |
NodeTraverser(java.util.Map<java.lang.Class<?>,java.lang.Object> rootVars,
java.util.function.Function<? super Node,? extends java.util.List<Node>> getChildren) |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
depthFirst(NodeVisitor nodeVisitor,
java.util.Collection<? extends Node> roots)
depthFirst traversal with a enter/leave phase.
|
java.lang.Object |
depthFirst(NodeVisitor nodeVisitor,
Node root)
depthFirst traversal with a enter/leave phase.
|
static <T> T |
oneVisitWithResult(Node node,
NodeVisitor nodeVisitor) |
java.lang.Object |
postOrder(NodeVisitor nodeVisitor,
java.util.Collection<? extends Node> roots)
Post-Order traversal: This is a specialized version of depthFirst with only the leave phase.
|
java.lang.Object |
postOrder(NodeVisitor nodeVisitor,
Node root)
Version of
postOrder(NodeVisitor, Collection) with one root. |
java.lang.Object |
preOrder(NodeVisitor nodeVisitor,
java.util.Collection<? extends Node> roots)
Pre-Order traversal: This is a specialized version of depthFirst with only the enter phase.
|
java.lang.Object |
preOrder(NodeVisitor nodeVisitor,
Node root)
Version of
preOrder(NodeVisitor, Collection) with one root. |
public NodeTraverser(java.util.Map<java.lang.Class<?>,java.lang.Object> rootVars, java.util.function.Function<? super Node,? extends java.util.List<Node>> getChildren)
public NodeTraverser()
public java.lang.Object depthFirst(NodeVisitor nodeVisitor, Node root)
nodeVisitor
- the visitor of the nodesroot
- the root nodepublic java.lang.Object depthFirst(NodeVisitor nodeVisitor, java.util.Collection<? extends Node> roots)
nodeVisitor
- the visitor of the nodesroots
- the root nodespublic java.lang.Object preOrder(NodeVisitor nodeVisitor, Node root)
preOrder(NodeVisitor, Collection)
with one root.nodeVisitor
- the visitor of the nodesroot
- the root nodepublic java.lang.Object preOrder(NodeVisitor nodeVisitor, java.util.Collection<? extends Node> roots)
nodeVisitor
- the visitor of the nodesroots
- the root nodespublic java.lang.Object postOrder(NodeVisitor nodeVisitor, Node root)
postOrder(NodeVisitor, Collection)
with one root.nodeVisitor
- the visitor of the nodesroot
- the root nodepublic java.lang.Object postOrder(NodeVisitor nodeVisitor, java.util.Collection<? extends Node> roots)
nodeVisitor
- the visitor of the nodesroots
- the root nodespublic static <T> T oneVisitWithResult(Node node, NodeVisitor nodeVisitor)