public final class TreeWalker
extends java.lang.Object
Node.arrive
, Node.leave/code> and
Node.walkNextChild
. Node implementations are required
to delegate these calls to corresponding methods of the supplied node
visitor.
Constructor and Description |
---|
TreeWalker() |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
walk(Node node,
NodeVisitor visitor)
Walks the tree specified by the argument
node
implementing a depth first algorithm. |
public java.lang.Object walk(Node node, NodeVisitor visitor)
node
implementing a depth first algorithm.
Executes the visitor instance callback arrive
when starting to walk the argument node
.
Subsequently iterates that node's children and
executes the visitor instance callback walkNextChild
before the current child is walked. For the case that
walkNextChild
returns true
,
this tree walker walkes the next child.
Otherwise, the next child and all remaining childs are not walked.
In both cases, this tree walker
executes the visitor instance callback leave
indicating
that the argument node
and its children have been walked.
The result of leave
is returned.
when starting to traverse a node.node
- the tree instancevisitor
- the node visitor instanceleave
Copyright © 2005-2012 Apache Software Foundation. All Rights Reserved.