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 interfaceIChainableTreeNoderepresents 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 parentIChainableTreeNodefrom the current tree nodeIChainableTreeNode<T>getChild()Gets the child.default intgetChildCount()Gets the child count.default java.util.List<IChainableTreeNode<T>>getChildren()Gets the children from the current tree nodedefault intgetLevel()Returns the distance from the root to this node.IChainableTreeNode<T>getParent()Gets the parentdefault IChainableTreeNode<T>getRoot()Gets the rootIChainableTreeNodeobjectTgetValue()Gets the value.default booleanhasChild()Checks if this tree node has a childdefault booleanhasParent()Checks for parentdefault booleanisRoot()Checks if this treenode is root.voidsetChild(IChainableTreeNode<T> child)Sets the child.voidsetParent(IChainableTreeNode<T> parent)Sets the parent.voidsetValue(T value)Sets the value.default java.util.List<IChainableTreeNode<T>>toList()Transforms this tree node object to an orderedLinkedListwith all tree nodes
-
-
-
Method Detail
-
getAllParent
default java.util.List<IChainableTreeNode<T>> getAllParent()
Gets all parentIChainableTreeNodefrom the current tree node- Returns:
- all parent
IChainableTreeNodefrom 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 rootIChainableTreeNodeobject- Returns:
- the root
IChainableTreeNodeobject
-
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 orderedLinkedListwith all tree nodes- Returns:
- the ordered
LinkedListwith all tree nodes
-
-