Class GenericTree<T>
java.lang.Object
de.captaingoldfish.scim.sdk.common.tree.GenericTree<T>
this implementation represents a tree with several root-nodes and each node might have several parents and
several children. This tree implementation is not thread-safe!
- Since:
- 25.03.2022
- Author:
- Pascal Knueppel
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddDistinctNode(T value) creates a new node if a node with the same value does not exist yet and returns the existing node if a node with an identical value does already existprotected voidmethod is only called by tree nodesaddNewNode(T value) creates a new tree node with this tree as its parentprotected voidprotected voidgetLeafs()getRoots()booleanhasNodes()if this tree still has any nodes leftvoidremoveBranchFromTree(TreeNode<T> treeNode) removes the branch from the tree represented by the given treenodeprotected voidremoveLeaf(TreeNode<T> treeNode) voidremoveNodeFromTree(TreeNode<T> treeNode) removes a single node from the tree.protected voidremoveRoot(TreeNode<T> treeNode)
-
Constructor Details
-
GenericTree
public GenericTree()
-
-
Method Details
-
addNewNode
creates a new tree node with this tree as its parent- Parameters:
parents- the parents of the new node. May be nullvalue- the actual value of the nodechildren- the children of the node. May be null- Returns:
- a new tree-node that is a child of this tree
-
addLeaf
method is only called by tree nodes -
removeLeaf
-
addRoot
-
removeRoot
-
addNode
-
removeNodeFromTree
removes a single node from the tree. If the node was somewhere in the middle of the tree we will basically get a second tree because its branch was cut off from the first tree -
removeBranchFromTree
removes the branch from the tree represented by the given treenode- Parameters:
treeNode- the branch to remove
-
addDistinctNode
creates a new node if a node with the same value does not exist yet and returns the existing node if a node with an identical value does already exist -
hasNodes
public boolean hasNodes()if this tree still has any nodes left -
getAllNodes
- See Also:
-
allNodes
-
getRoots
- See Also:
-
roots
-
getLeafs
- See Also:
-
leafs
-