- java.lang.Object
-
- io.github.astrapi69.tree.TreeNode<T>
-
- Type Parameters:
T
- the generic type of the value
- All Implemented Interfaces:
io.github.astrapi69.design.pattern.visitor.Acceptable<io.github.astrapi69.design.pattern.visitor.Visitor<TreeNode<T>>>
,ITreeNode<T,TreeNode<T>>
,java.io.Serializable
public class TreeNode<T> extends java.lang.Object implements ITreeNode<T,TreeNode<T>>
The generic class TreeNode.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addChild(TreeNode<T> child)
Adds the given childboolean
contains(TreeNode<T> treeNode)
Checks if the givenITreeNode
object is a descendant of this tree nodejava.util.Collection<TreeNode<T>>
getChildren()
Gets the children.void
removeChild(TreeNode<T> child)
Removes the child.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.github.astrapi69.tree.api.ITreeNode
accept, addChildren, clearAll, clearChildren, containsAll, findAllByValue, findByValue, getAllSiblings, getChildCount, getDisplayValue, getLevel, getNextSibling, getParent, getPreviousSibling, getRoot, getValue, hasChildren, hasParent, isLeaf, isNode, isRoot, removeChildren, removeChildren, setChildren, setDisplayValue, setLeaf, setParent, setValue, toList, traverse
-
-
-
-
Constructor Detail
-
TreeNode
public TreeNode(T value)
Instantiates a new tree node.- Parameters:
value
- the value
-
-
Method Detail
-
getChildren
public java.util.Collection<TreeNode<T>> getChildren()
Gets the children.- Specified by:
getChildren
in interfaceITreeNode<T,TreeNode<T>>
- Returns:
- the children
-
removeChild
public void removeChild(TreeNode<T> child)
Removes the child.- Specified by:
removeChild
in interfaceITreeNode<T,TreeNode<T>>
- Parameters:
child
- the child
-
-