- java.lang.Object
-
- io.github.astrapi69.tree.TreeIdNode<T,K>
-
- Type Parameters:
T
- the generic type of the valueK
- the generic type of the id of the node
public class TreeIdNode<T,K> extends java.lang.Object
The generic classTreeIdNode
keeps no references to the parent or the children, only the id's are kept.
-
-
Constructor Summary
Constructors Constructor Description TreeIdNode(T value)
Instantiates a newTreeIdNode
object
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addChild(TreeIdNode<T,K> child)
Adds the child.int
getChildCount()
Gets the child count.boolean
hasChildren()
Checks for children.boolean
hasParent()
Checks for parentboolean
isNode()
Checks if thisTreeIdNode
object is a nodeboolean
isRoot()
Checks if thisTreeIdNode
is the rootTreeIdNode
objectvoid
removeChild(TreeIdNode<T,K> child)
Removes the child.
-
-
-
Constructor Detail
-
TreeIdNode
public TreeIdNode(T value)
Instantiates a newTreeIdNode
object- Parameters:
value
- the value
-
-
Method Detail
-
addChild
public void addChild(TreeIdNode<T,K> child)
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 thisTreeIdNode
object is a node- Returns:
- true, if this
TreeIdNode
object is a node otherwise false
-
isRoot
public boolean isRoot()
Checks if thisTreeIdNode
is the rootTreeIdNode
object- Returns:
- true, if this
TreeIdNode
is the rootTreeIdNode
object
-
removeChild
public void removeChild(TreeIdNode<T,K> child)
Removes the child.- Parameters:
child
- the child
-
-