public class TraversalContext
extends java.lang.Object
Constructor and Description |
---|
TraversalContext() |
Modifier and Type | Method and Description |
---|---|
int |
countNodes()
Returns the number of current and parent nodes in this traversal.
|
Node |
getNode()
Gets the current node in this traversal.
|
Node |
getNode(int index)
Gets the node in this traversal with specified index.
|
Node[] |
getNodes()
Gets an array of nodes representing the state of this traversal.
|
void |
popNode()
Restores the most recently saved (pushed) node.
|
void |
pushNode(Node node)
Saves the current node, and then makes the specified node current.
|
public int countNodes()
public Node getNode()
public Node getNode(int index)
countNodes()
, then the
current node has index count-1, and the root node has index zero.
If the specified index is negative, then count is added to the index. Therefore, the index -1 will get the current node, the index -2 will get its parent node, and so on.
index
- the index.public Node[] getNodes()
public void pushNode(Node node)
node
- the new current node.public void popNode()