public abstract class AbstractTreeWalker<N>
extends java.lang.Object
Constructor and Description |
---|
AbstractTreeWalker(TreeVisitor visitor)
Creates a new tree walker with the specified tree visitor.
|
AbstractTreeWalker(TreeVisitor visitor,
java.util.function.Function<? super N,java.lang.Object> converter)
Creates a new tree walker with the specified node converter,
which allows to generate a tree path expected by the given tree visitor.
|
Modifier and Type | Method and Description |
---|---|
protected abstract java.util.Collection<N> |
getChildren(N node)
Returns a list of child nodes for the specified node.
|
Promise<javax.swing.tree.TreePath> |
promise() |
void |
setChildren(java.util.Collection<? extends N> children)
Sets the children, awaited by the walker, and continues to traverse a tree structure.
|
void |
setError(java.lang.Throwable error)
Stops visiting a tree structure by specifying a cause.
|
void |
start(N node)
Starts visiting a tree structure from the specified root node.
|
void |
start(javax.swing.tree.TreePath parent,
N node)
Starts visiting a tree structure from the specified node.
|
public AbstractTreeWalker(TreeVisitor visitor)
visitor
- an object that controls visiting a tree structurepublic AbstractTreeWalker(TreeVisitor visitor, java.util.function.Function<? super N,java.lang.Object> converter)
visitor
- an object that controls visiting a tree structureconverter
- a node converter for the path componentsprotected abstract java.util.Collection<N> getChildren(N node)
CONTINUE
action.
The walker will be paused if it returns null
.
To continue user should call the setChildren(java.util.Collection<? extends N>)
method.node
- a node in a tree structurenull
if children will be set laterpublic void setChildren(java.util.Collection<? extends N> children)
children
- a list of child nodes for the node specified in the getChildren(N)
methodjava.lang.IllegalStateException
- if it is called in unexpected statepublic Promise<javax.swing.tree.TreePath> promise()
public void setError(java.lang.Throwable error)
public void start(N node)
node
- a tree root or null
if nothing to traversepublic void start(javax.swing.tree.TreePath parent, N node)
parent
- a parent tree path or null
for a root nodenode
- a tree node or null
if nothing to traverse