Class GenericTree<T>
java.lang.Object
org.tasktide.parser.generic_tree.GenericTree<T>
- Type Parameters:
T- - Data Type of Tree
Generic implementation of tree
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd child under provided addressbooleancontainsData(T query) Check whether tree contains queried valuefindByAddress(String path) FindGenericTreeNodeat provided addressfindByData(T query) Find first node matching query depth-firstgetChildrenAtAddress(String path) Get map of child nodes under addressgetChildrenDataAtAddress(String path, String delim) Get map of data values for children under addressgetDataForAddress(String path) Fetch data value for addressgetImmutableChildren(GenericTreeNode<T> node) Get children as an immutable mapgetPathToRoot(GenericTreeNode<T> node) Get path to the root node of the tree, from current nodegetRoot()Get root nodebooleanremoveByAddress(String path) Remove address from Tree without reshapingintsize()Return size of treesubStringPathToFlag(String path, String flag) Substring provided path up to a flag using the delimiter of the treeConvert tree to aLinkedHashMapof address-node value pairs
-
Constructor Details
-
GenericTree
-
-
Method Details
-
getImmutableChildren
Get children as an immutable map- Parameters:
node-- Returns:
- Map-String,
GenericTreeNode
-
getRoot
-
addChild
-
findByAddress
FindGenericTreeNodeat provided address- Parameters:
path-- Returns:
GenericTreeNode-T
-
getDataForAddress
-
removeByAddress
Remove address from Tree without reshaping- Parameters:
path-- Returns:
- boolean
-
getChildrenAtAddress
Get map of child nodes under address- Parameters:
path-- Returns:
- Map-String,
GenericTreeNode-T
-
getChildrenDataAtAddress
-
findByData
Find first node matching query depth-first- Parameters:
query-- Returns:
GenericTreeNode-t
-
containsData
Check whether tree contains queried value- Parameters:
query-- Returns:
- query
-
size
public int size()Return size of tree- Returns:
- int
-
getPathToRoot
Get path to the root node of the tree, from current node- Parameters:
node-- Returns:
- List-
GenericTreeNode-T
-
toAddressDataMap
Convert tree to aLinkedHashMapof address-node value pairs- Returns:
- Map-String, Value
-
subStringPathToFlag
-