Package io.github.astrapi69.tree.api
Interface IChainableTreeNode<T>
-
- Type Parameters:
T
- the generic type of the value
- All Known Implementing Classes:
ChainableTreeNode
public interface IChainableTreeNode<T>
The interfaceIChainableTreeNode
represents a chainable tree node
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default java.util.List<IChainableTreeNode<T>>
getAllParent()
Gets all parentIChainableTreeNode
from the current tree nodeIChainableTreeNode<T>
getChild()
Gets the child.default int
getChildCount()
Gets the child count.default java.util.List<IChainableTreeNode<T>>
getChildren()
Gets the children from the current tree nodedefault int
getLevel()
Returns the distance from the root to this node.IChainableTreeNode<T>
getParent()
Gets the parentdefault IChainableTreeNode<T>
getRoot()
Gets the rootIChainableTreeNode
objectT
getValue()
Gets the value.default boolean
hasChild()
Checks if this tree node has a childdefault boolean
hasParent()
Checks for parentdefault boolean
isRoot()
Checks if this treenode is root.void
setChild(IChainableTreeNode<T> child)
Sets the child.void
setParent(IChainableTreeNode<T> parent)
Sets the parent.void
setValue(T value)
Sets the value.default java.util.List<IChainableTreeNode<T>>
toList()
Transforms this tree node object to an orderedLinkedList
with all tree nodes
-
-
-
Method Detail
-
getAllParent
default java.util.List<IChainableTreeNode<T>> getAllParent()
Gets all parentIChainableTreeNode
from the current tree node- Returns:
- all parent
IChainableTreeNode
from the current tree node
-
getChild
IChainableTreeNode<T> getChild()
Gets the child.- Returns:
- the child
-
getChildCount
default int getChildCount()
Gets the child count.- Returns:
- the child count
-
getChildren
default java.util.List<IChainableTreeNode<T>> getChildren()
Gets the children from the current tree node- Returns:
- the children from the current tree node
-
getLevel
default int getLevel()
Returns the distance from the root to this node. Returns 0 if this node is the root.- Returns:
- the level from this node.
-
getParent
IChainableTreeNode<T> getParent()
Gets the parent- Returns:
- the parent
-
getRoot
default IChainableTreeNode<T> getRoot()
Gets the rootIChainableTreeNode
object- Returns:
- the root
IChainableTreeNode
object
-
getValue
T getValue()
Gets the value.- Returns:
- the value
-
hasChild
default boolean hasChild()
Checks if this tree node has a child- Returns:
- true, if successful
-
hasParent
default boolean hasParent()
Checks for parent- Returns:
- true, if successful
-
isRoot
default boolean isRoot()
Checks if this treenode is root.- Returns:
- true, if is root
-
setChild
void setChild(IChainableTreeNode<T> child)
Sets the child.- Parameters:
child
- the new child
-
setParent
void setParent(IChainableTreeNode<T> parent)
Sets the parent.- Parameters:
parent
- the new parent
-
setValue
void setValue(T value)
Sets the value.- Parameters:
value
- the new value
-
toList
default java.util.List<IChainableTreeNode<T>> toList()
Transforms this tree node object to an orderedLinkedList
with all tree nodes- Returns:
- the ordered
LinkedList
with all tree nodes
-
-