Interface UBtree<T>
-
public interface UBtree<T>Unbalanced tree implementation to manage hierarchy data- Since:
- 1.0.0
- Author:
- Abhishek Kumar
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description Node<T>convertToNode(T node)default List<Node<T>>createTree(List<T> list)Method to create an unbalanced tree using the input listdefault List<Node<T>>findLeafs(Node<T> node)Method to find the leaf nodes using the passed nodedefault List<T>findLeafsValue(Node<T> node)default Node<T>findNode(List<Node<T>> list, String id)default Node<T>findRootNode(Node<T> node)Method to find the root node for the input nodedefault TfindRootNodeValue(Node<T> node)Method to find the root node and their valuedefault List<T>getChildHierarchy(Node<T> node)Method to fetch the hierarchy for the input nodedefault List<T>getParentHierarchy(Node<T> node)default Node<T>searchNode(Node<T> root, String id)Method to Search Node the specified node
-
-
-
Method Detail
-
createTree
default List<Node<T>> createTree(List<T> list)
Method to create an unbalanced tree using the input list- Parameters:
list- input list- Returns:
- list of
Node
-
findLeafs
default List<Node<T>> findLeafs(Node<T> node)
Method to find the leaf nodes using the passed node
-
findRootNode
default Node<T> findRootNode(Node<T> node)
Method to find the root node for the input node- Parameters:
node- input node- Returns:
- root
Node
-
findRootNodeValue
default T findRootNodeValue(Node<T> node)
Method to find the root node and their value- Parameters:
node- input node- Returns:
- node value
-
getChildHierarchy
default List<T> getChildHierarchy(Node<T> node)
Method to fetch the hierarchy for the input node- Parameters:
node- input node- Returns:
Listof node value
-
searchNode
default Node<T> searchNode(Node<T> root, String id)
Method to Search Node the specified node- Parameters:
root- input root nodeid- id of the node- Returns:
Node
-
-