Package io.github.astrapi69.gen.tree
Class TreeIdNode<T,K>
java.lang.Object
io.github.astrapi69.gen.tree.TreeIdNode<T,K>
- Type Parameters:
T- the generic type of the valueK- the generic type of the id of the node
The generic class
TreeIdNode keeps no references to the parent or the children, only the
id's are kept.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddChild(TreeIdNode<T, K> child) Adds the child.intGets the child count.booleanChecks for children.booleanChecks for parentbooleanisNode()Checks if thisTreeIdNodeobject is a nodebooleanisRoot()Checks if thisTreeIdNodeis the rootTreeIdNodeobjectvoidremoveChild(TreeIdNode<T, K> child) Removes the child.
-
Constructor Details
-
TreeIdNode
Instantiates a newTreeIdNodeobject- Parameters:
value- the value
-
-
Method Details
-
addChild
Adds the child.- Parameters:
child- the child
-
getChildCount
public int getChildCount()Gets the child count.- Returns:
- the child count
-
hasChildren
public boolean hasChildren()Checks for children.- Returns:
- true, if successful
-
hasParent
public boolean hasParent()Checks for parent- Returns:
- true, if successful
-
isNode
public boolean isNode()Checks if thisTreeIdNodeobject is a node- Returns:
- true, if this
TreeIdNodeobject is a node otherwise false
-
isRoot
public boolean isRoot()Checks if thisTreeIdNodeis the rootTreeIdNodeobject- Returns:
- true, if this
TreeIdNodeis the rootTreeIdNodeobject
-
removeChild
Removes the child.- Parameters:
child- the child
-