public abstract class AbstractTree extends java.lang.Object implements Tree
Tree
implementation that enhances accept(NodeHierarchicalVisitor)
so that it accepts multiple child Node
s.Modifier and Type | Class and Description |
---|---|
static class |
AbstractTree.AbstractBuilder<T extends Node>
An abstract
Builder implementation that implements most methods, so you don't have to do it yourself. |
Tree.Builder<T extends Node>
Modifier | Constructor and Description |
---|---|
protected |
AbstractTree(AbstractTree.AbstractBuilder<?> abstractBuilder)
Constructs a new
AbstractTree instance. |
Modifier and Type | Method and Description |
---|---|
boolean |
accept(NodeHierarchicalVisitor nodeHierarchicalVisitor)
Accepts a
NodeHierarchicalVisitor . |
java.util.List<Node> |
getNodes()
Returns the
Node s currently added to this AbstractTree . |
protected AbstractTree(AbstractTree.AbstractBuilder<?> abstractBuilder)
AbstractTree
instance.
If abstractBuilder
is null
, a NullPointerException
will be thrown.
abstractBuilder
- an AbstractTree.AbstractBuilder
used in the building processjava.lang.NullPointerException
- thrown if, and only if, abstractBuilder
is null
public boolean accept(NodeHierarchicalVisitor nodeHierarchicalVisitor)
NodeHierarchicalVisitor
.
Returns the result of nodeHierarchicalVisitor.visitLeave(this)
.
If nodeHierarchicalVisitor
is null
, a NullPointerException
will be thrown.
If a RuntimeException
is thrown by the current NodeHierarchicalVisitor
, a NodeTraversalException
will be thrown with the RuntimeException
wrapped.
The default implementation will:
NullPointerException
if nodeHierarchicalVisitor
is null
.NodeTraversalException
if nodeHierarchicalVisitor
throws a RuntimeException
.Node
s.accept
in interface Node
nodeHierarchicalVisitor
- the NodeHierarchicalVisitor
to acceptnodeHierarchicalVisitor.visitLeave(this)
NodeTraversalException
- thrown if, and only if, a RuntimeException
is thrown by the current NodeHierarchicalVisitor
java.lang.NullPointerException
- thrown if, and only if, nodeHierarchicalVisitor
is null