public static class TreeGuiImpl.TreeNode extends java.lang.Object implements Printable
Modifier and Type | Field and Description |
---|---|
java.util.List<TreeGuiImpl.TreeNode> |
nodes
Child nodes or
null if case of no children |
TreeGuiImpl.TreeNode |
parent
Parent node
|
TreeNodeEntry |
value
Related config node entry
|
Modifier | Constructor and Description |
---|---|
private |
TreeNode(TreeNodeEntry value)
The constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addChild(TreeGuiImpl.TreeNode node)
Adds a node to the list of child nodes.
|
private java.util.List<TreeGuiImpl.TreeNode> |
ancestorsAndThis()
Get a list consisting of this node and all ancestors of this node, the tree root will be
the first list item.
|
int |
childIndex()
Get this node index in the sibling list.
|
private int |
childIndex(TreeGuiImpl.TreeNode node)
Search this node children for a node with the given node value.
|
boolean |
descendsFrom(TreeGuiImpl.TreeNode other)
Test if this node descends from the given node.
|
int |
getLevel()
Returns the zero based node level.
|
int |
getNodeImageId(boolean nodeSelected)
Return the internal image identifier.
|
boolean |
isDFTBeforeThan(TreeGuiImpl.TreeNode other)
Test if this node precedes a given node in tree depth first traversal order.
|
private boolean |
isSiblingLowerThan(TreeGuiImpl.TreeNode other)
Test if this node is strictly lower than other sibling node in the sibling order.
|
private TreeGuiImpl.TreeNode |
lastVisibleChild()
Get the last child of this node or
null if this node has no children or is collapsed. |
TreeGuiImpl.TreeNode |
nextDFT()
Get the node next to this node on DFT order.
|
TreeGuiImpl.TreeNode |
nextSibling()
Get the next sibling of this node or
null if this node is the last child or the tree root. |
private TreeGuiImpl.TreeNode |
nextSiblingRecursively()
Get this node next sibling if exists, otherwise call this function recursively for this
node parent.
|
TreeGuiImpl.TreeNode |
nextVisible()
Get the next visible node in the hierarchy
|
TreeGuiImpl.TreeNode |
nodeAt(java.util.function.Function<TreeGuiImpl.TreeNode,TreeGuiImpl.TreeNode> getNext,
int distance)
Traverse from this node to the distance using the provided function returning the next node.
|
private TreeGuiImpl.TreeNode |
prevSibling()
Get the previous sibling of this node or
null if this node is the first child. |
TreeGuiImpl.TreeNode |
prevVisible()
Get the previous visible node in the tree or
null : |
void |
print(PrintHelper printer)
Add class-specific fields to the helper.
|
void |
remove()
Remove this node from its parent child nodes.
|
java.lang.String |
toString()
Returns a string representation of the object.
|
int |
visibleIndex()
Get node visible index.
|
java.lang.Iterable<TreeGuiImpl.TreeNode> |
visibleNodes(java.util.function.Function<TreeGuiImpl.TreeNode,TreeGuiImpl.TreeNode> getNext)
Get iterable for all visible tree nodes, starting from this node.
|
public java.util.List<TreeGuiImpl.TreeNode> nodes
null
if case of no childrenpublic TreeGuiImpl.TreeNode parent
public final TreeNodeEntry value
private TreeNode(TreeNodeEntry value)
public void addChild(TreeGuiImpl.TreeNode node)
node
- The node to add.public int childIndex()
public boolean descendsFrom(TreeGuiImpl.TreeNode other)
other
- the other nodepublic int getLevel()
public final int getNodeImageId(boolean nodeSelected)
nodeSelected
- The value indicates if the requested image is for the selected node.public boolean isDFTBeforeThan(TreeGuiImpl.TreeNode other)
other
- the node to compare withpublic final TreeGuiImpl.TreeNode nextDFT()
public final TreeGuiImpl.TreeNode nextSibling()
null
if this node is the last child or the tree root.public TreeGuiImpl.TreeNode nextVisible()
null
if this node is the last visible node.public final TreeGuiImpl.TreeNode nodeAt(java.util.function.Function<TreeGuiImpl.TreeNode,TreeGuiImpl.TreeNode> getNext, int distance)
getNext
- the function to navigate from one node to anotherdistance
- the number of steps to movepublic TreeGuiImpl.TreeNode prevVisible()
null
:
public void remove()
public final int visibleIndex()
public final java.lang.Iterable<TreeGuiImpl.TreeNode> visibleNodes(java.util.function.Function<TreeGuiImpl.TreeNode,TreeGuiImpl.TreeNode> getNext)
getNext
- a function to navigate to the next nodepublic void print(PrintHelper printer)
public java.lang.String toString()
toString
method returns a string that
"textually represents" this object. The result should
be a concise but informative representation that is easy for a
person to read.
It is recommended that all subclasses override this method.
The toString
method for class Object
returns a string consisting of the name of the class of which the
object is an instance, the at-sign character `@
', and
the unsigned hexadecimal representation of the hash code of the
object. In other words, this method returns a string equal to the
value of:
getClass().getName() + '@' + Integer.toHexString(hashCode())
toString
in class java.lang.Object
private final java.util.List<TreeGuiImpl.TreeNode> ancestorsAndThis()
private int childIndex(TreeGuiImpl.TreeNode node)
Object.equals(Object)
.node
- The node to search-1
if no matching node was found.private final boolean isSiblingLowerThan(TreeGuiImpl.TreeNode other)
other
- other node to compare, must be a sibling to this node, and differ from this nodeprivate final TreeGuiImpl.TreeNode lastVisibleChild()
null
if this node has no children or is collapsed.private TreeGuiImpl.TreeNode nextSiblingRecursively()
null
private final TreeGuiImpl.TreeNode prevSibling()
null
if this node is the first child.