@FunctionalInterface
public interface NodeVisitor
NodeVisitor
is used for traversing the structure of a Node
.
It uses a design pattern called Visitor.
Implement it in order to perform various operations on various Node
s in sequence.
Modifier and Type | Method and Description |
---|---|
void |
visit(Node node)
Called by a concrete
Node implementation. |
void visit(Node node)
Node
implementation.
It should happen soon after its accept(NodeVisitor)
method has been called, with this NodeVisitor
as its parameter argument.
If node
is null
, a NullPointerException
may be thrown. But no guarantees can be made.
If node
could not be traversed by this NodeVisitor
, a NodeTraversalException
may be thrown. But no guarantees can be made.
node
- the Node
currently being visitedNodeTraversalException
- thrown if, and only if, node
could not be traversed by this NodeVisitor
java.lang.NullPointerException
- thrown if, and only if, node
is null