Class Tree<T>
java.lang.Object
com.illumon.iris.db.v2.locations.util.Tree<T>
- Type Parameters:
T
-
Simple tree/node structure.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Tree
Construct a Tree with the given value and no children.- Parameters:
value
- the value at this node
-
-
Method Details
-
add
Add a child node.- Parameters:
child
- the child to add
-
leaves
Traverse the tree and return a list of all leaf nodes.- Returns:
- all the leaf items
-
visit
Visit all the nodes of the tree. The provided Consumer may take actions such as printing, and may modify the context (e.g. to change indentation).// This example prints out the TLP tree with indentation System.out.println("visit:"); result.vist((tlp1, context) -> { System.out.println(context + tlp1.getName()); return context + " "; }, " ");
- Type Parameters:
R
- the context type- Parameters:
consumer
- will be called on each node, may transform the contextcontext
- a context that may be useful in the visitation
-