A - The type of values contained within the treeJOTreeNodeReadableType<A>, JOTreeNodeType<A>public final class JOTreeNode<A> extends Object implements JOTreeNodeType<A>
JOTreeNodeType type.| Modifier and Type | Method | Description |
|---|---|---|
JOTreeNodeType<A> |
childAdd(JOTreeNodeType<A> child) |
Add a child to this node.
|
JOTreeNodeType<A> |
childRemove(JOTreeNodeType<A> child) |
Remove a child from this node.
|
Collection<JOTreeNodeType<A>> |
children() |
|
Collection<JOTreeNodeReadableType<A>> |
childrenReadable() |
|
static <A> JOTreeNodeType<A> |
create(A in_value) |
Create a new node with the given value.
|
static <A> JOTreeNodeType<A> |
createWithDetachCheck(A in_value,
BooleanSupplier in_detach_check) |
Create a new node with the given value.
|
JOTreeNodeType<A> |
detach() |
Detach this node from its parent node.
|
<T> void |
forEachBreadthFirst(T context,
JOTreeNodeForEachFunctionType<A,T> f) |
Visit each node in the tree in breadth-first order.
|
<T> void |
forEachDepthFirst(T context,
JOTreeNodeForEachFunctionType<A,T> f) |
Visit each node in the tree in depth-first order.
|
boolean |
isDescendantOf(JOTreeNodeReadableType<A> other) |
|
boolean |
isDetachAllowed() |
|
<T,B> JOTreeNodeType<B> |
mapBreadthFirst(T context,
JOTreeNodeMapFunctionType<A,T,B> f) |
Visit each node in the tree in breadth-first order.
|
<T,B> JOTreeNodeType<B> |
mapDepthFirst(T context,
JOTreeNodeMapFunctionType<A,T,B> f) |
Visit each node in the tree in depth-first order.
|
Optional<JOTreeNodeType<A>> |
parent() |
|
Optional<JOTreeNodeReadableType<A>> |
parentReadable() |
|
JOTreeNodeType<A> |
setParent(JOTreeNodeType<A> parent_new) |
Set this node's parent to
new_parent. |
String |
toString() |
|
A |
value() |
isRootpublic static <A> JOTreeNodeType<A> create(A in_value)
A - The type of valuesin_value - The valuepublic static <A> JOTreeNodeType<A> createWithDetachCheck(A in_value, BooleanSupplier in_detach_check)
true value
indicating that the node is allowed to be detached.A - The type of valuesin_value - The valuein_detach_check - A detach check functionpublic boolean isDetachAllowed()
isDetachAllowed in interface JOTreeNodeReadableType<A>true iff this node may be detached from its parentpublic A value()
value in interface JOTreeNodeReadableType<A>public Optional<JOTreeNodeReadableType<A>> parentReadable()
parentReadable in interface JOTreeNodeReadableType<A>public Collection<JOTreeNodeReadableType<A>> childrenReadable()
childrenReadable in interface JOTreeNodeReadableType<A>public JOTreeNodeType<A> setParent(JOTreeNodeType<A> parent_new)
JOTreeNodeTypenew_parent.setParent in interface JOTreeNodeType<A>parent_new - The new parent nodepublic Optional<JOTreeNodeType<A>> parent()
parent in interface JOTreeNodeType<A>public JOTreeNodeType<A> detach()
JOTreeNodeTypedetach in interface JOTreeNodeType<A>public Collection<JOTreeNodeType<A>> children()
children in interface JOTreeNodeType<A>public JOTreeNodeType<A> childRemove(JOTreeNodeType<A> child)
JOTreeNodeTypechildRemove in interface JOTreeNodeType<A>child - A child nodepublic JOTreeNodeType<A> childAdd(JOTreeNodeType<A> child)
JOTreeNodeTypechildAdd in interface JOTreeNodeType<A>child - A child nodepublic boolean isDescendantOf(JOTreeNodeReadableType<A> other)
isDescendantOf in interface JOTreeNodeReadableType<A>other - A nodetrue iff this node is a descendant of otherpublic <T> void forEachDepthFirst(T context,
JOTreeNodeForEachFunctionType<A,T> f)
JOTreeNodeReadableTypeVisit each node in the tree in depth-first order.
The function allows for the use of a context value. This is useful for avoiding the use of capturing lambdas, reducing GC pressure.
forEachDepthFirst in interface JOTreeNodeReadableType<A>T - The type of context valuescontext - A context value passed to each application of ff - A function used to receive each nodepublic <T> void forEachBreadthFirst(T context,
JOTreeNodeForEachFunctionType<A,T> f)
JOTreeNodeReadableTypeVisit each node in the tree in breadth-first order.
The function allows for the use of a context value. This is useful for avoiding the use of capturing lambdas, reducing GC pressure.
forEachBreadthFirst in interface JOTreeNodeReadableType<A>T - The type of context valuescontext - A context value passed to each application of ff - A function used to receive each nodepublic <T,B> JOTreeNodeType<B> mapDepthFirst(T context, JOTreeNodeMapFunctionType<A,T,B> f)
JOTreeNodeReadableTypeVisit each node in the tree in depth-first order.
The function allows for the use of a context value. This is useful for avoiding the use of capturing lambdas, reducing GC pressure.
mapDepthFirst in interface JOTreeNodeReadableType<A>T - The type of context valuesB - The type of values in the returned treecontext - A context value passed to each application of ff - A function used to receive each nodeBpublic <T,B> JOTreeNodeType<B> mapBreadthFirst(T context, JOTreeNodeMapFunctionType<A,T,B> f)
JOTreeNodeReadableTypeVisit each node in the tree in breadth-first order.
The function allows for the use of a context value. This is useful for avoiding the use of capturing lambdas, reducing GC pressure.
mapBreadthFirst in interface JOTreeNodeReadableType<A>T - The type of context valuesB - The type of values in the returned treecontext - A context value passed to each application of ff - A function used to receive each nodeBCopyright © 2017 <code@io7m.com> http://io7m.com