public final class Trees
extends java.lang.Object
Node
s.Modifier and Type  Method and Description 

static java.util.Collection<Node> 
findBottomNodes(Node startingNode)
Searches for all bottom nodes of the tree.

static <T extends Node> 
findClosestAncestorNodeFromNodesToRootOfType(Node childNode,
Node rootNode,
com.google.common.reflect.TypeToken<T> nodeToken)
Searches ancestor nodes which match the given
TypeToken (taking into account all generic parameters!),
starting from the given child not while using the tree as defined by the given rootNode. 
static <T extends Node> 
findHighestNodeOfClass(Node rootNode,
java.lang.Class<T> nodeClassToFind)
walks through the tree, starting from the given rootNode and collects the highest node which implement the given
class.

static <T> java.util.Set<T> 
findNodesOfClass(Node rootNode,
java.lang.Class<T> nodeClassToFind)
walks through the tree, starting from the given rootNode and collects all the nodes which implement the given
class.

static java.util.List<Path> 
getPathsFromChildToAncestor(Node childNode,
Node ancestorNode)
Searches in the tree for paths between the two given nodes.

static <T extends Node> 
rebuildTree(T rootNode,
RebuildingContext rebuildingContext)
Rebuilds the tree by taking elements from given context.

static java.util.List<Node> 
subTreeContent(Node rootNode)
Retrieves the content of the given subtree.

static void 
walkParentAfterChildren(Node startingNode,
NodeCallback callback)
Traverses the tree, starting from the given node in a way, such that all children are visited before the parent
node is visited.

public static void walkParentAfterChildren(Node startingNode, NodeCallback callback)
startingNode
 the node which should be considered as the root node for the walkthroughcallback
 the callback which will be called at certain points of the traversal, depending on the interfaces
which are implemented by the callback.TreeWalker
,
NodeCallback
public static java.util.List<Node> subTreeContent(Node rootNode)
rootNode
 The node which shall be taken as root of the tree.public static java.util.List<Path> getPathsFromChildToAncestor(Node childNode, Node ancestorNode)
childNode
 the node from which the paths to be found shall startancestorNode
 the ancestor node, which will be the end node of each pathpublic static java.util.Collection<Node> findBottomNodes(Node startingNode)
startingNode
 the node which shall be used as root of the tree.public static <T extends Node> T rebuildTree(T rootNode, RebuildingContext rebuildingContext)
rootNode
 the root node of the treerebuildingContext
 the context containing the elements needed for rebuilding of the treepublic static <T> java.util.Set<T> findNodesOfClass(Node rootNode, java.lang.Class<T> nodeClassToFind)
rootNode
 the node from which to start the searchnodeClassToFind
 the class of the nodes to findpublic static <T extends Node> java.util.Set<? extends T> findHighestNodeOfClass(Node rootNode, java.lang.Class<T> nodeClassToFind)
rootNode
 the node from which to start the searchnodeClassToFind
 the class of the nodes to findpublic static <T extends Node> java.util.Set<T> findClosestAncestorNodeFromNodesToRootOfType(Node childNode, Node rootNode, com.google.common.reflect.TypeToken<T> nodeToken) throws NoMatchingNodeFoundException
TypeToken
(taking into account all generic parameters!),
starting from the given child not while using the tree as defined by the given rootNode. This is eg. used for
finding nodes, that can handle Exceptions. If the child node id not part of the tree then an empty set is
returned. If there exist paths between the two nodes, then it is enforced, that in this paths a matching node is
found. If this is not the case, an exception will be thrown. If the same node is found in different paths, then
the corresponding node is only contained once in the set.childNode
 the node for which the closest ancestors shall be found.rootNode
 the node which defines the root of the tree.nodeToken
 the token, against which the nodes are matched.Node
containing for each path the closest Node
that match the given
TypeToken
NoMatchingNodeFoundException
 if there exists a path, that does not contain a matching node.