public interface Visitor<Node>
ParseTreeTraverser to each Node of a tree.
It is intended that visitBefore(Object, Object[]) and visitAfter(Object, Object[]) are called for each node in the tree.
The order of traversal is both pre- and post-order: visitBefore(Object, Object[]) is called on a parent before the children are called,
and visitAfter(Object, Object[]) is called after the children are called.
The returned boolean is interpreted by the caller and its meaning is not part of the Visitor contract.
| Modifier and Type | Method and Description |
|---|---|
boolean |
visitAfter(Node parent,
Node[] children)
Visit a place in the tree: the Node for this place in the tree, and an array of
Nodes of the immediate children, are passed as parameters. |
boolean |
visitBefore(Node parent,
Node[] children)
Visit a place in the tree: the Node for this place in the tree, and an array of
Nodes of the immediate children, are passed as parameters. |
boolean visitBefore(Node parent, Node[] children)
Nodes of the immediate children, are passed as parameters.parent - - the node (value) of the parent at this point in the tree; can be updated.children - - array of the nodes of the children of this parent (can be zero-length array; must not be null).true or false - interpreted by the caller (typically a tree traversal algorithm).boolean visitAfter(Node parent, Node[] children)
Nodes of the immediate children, are passed as parameters.parent - - the node (value) of the parent at this point in the tree; can be updated.children - - array of the nodes of the children of this parent (can be zero-length array; must not be null).true or false - interpreted by the caller (typically a tree traversal algorithm).Copyright © 2022. All rights reserved.