|
qflib 0.98.1 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--de.qfs.lib.tree.TreeUtil
This is a collection of static convenience methods that are useful for tree management.
All methods operate on trees in terms of a TreeAdapter.
| Constructor Summary | |
TreeUtil()
|
|
| Method Summary | |
static java.lang.Object |
copyTree(MutableTreeAdapter adapter,
java.lang.Object node)
Copy a whole (sub)tree. |
static java.lang.Object |
getFollowingNode(TreeAdapter adapter,
java.lang.Object node)
Get the following node in document order. |
static java.lang.Object |
getFollowingNode(TreeAdapter adapter,
java.lang.Object node,
java.lang.Object limit)
Get the following node in document order. |
static java.lang.Object |
getLastDescendant(TreeAdapter adapter,
java.lang.Object node)
Get the last descendant of a node. |
static java.lang.Object[] |
getPath(TreeAdapter adapter,
java.lang.Object node)
Get the path from a node's root to the node. |
static java.lang.Object[] |
getPath(TreeAdapter adapter,
java.lang.Object node,
java.lang.Object root)
Get the relative path from some root to a node. |
static java.lang.Object |
getPrecedingNode(TreeAdapter adapter,
java.lang.Object node)
Get the preceding node in document order. |
static java.lang.Object |
getPrecedingNode(TreeAdapter adapter,
java.lang.Object node,
java.lang.Object limit)
Get the preceding node in document order. |
static java.lang.Object |
getRoot(TreeAdapter adapter,
java.lang.Object node)
Get the root of a tree hierarchy, i.e. the first ancestor of node that has a null parent. |
static java.lang.Object |
traverse(TreeAdapter adapter,
java.lang.Object node,
TraversalCallback callback)
Traverse a tree and notify a Callback about every node entered and exited on the way. |
static java.lang.Object |
traverseFrom(TreeAdapter adapter,
java.lang.Object node,
java.lang.Object start,
TraversalCallback callback)
Traverse a tree and notify a Callback about every node entered and exited on the way. |
static java.lang.Object |
visitTree(TreeAdapter adapter,
java.lang.Object visitor,
java.lang.Object node)
Visit every node in a tree. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public TreeUtil()
| Method Detail |
public static java.lang.Object getRoot(TreeAdapter adapter,
java.lang.Object node)
adapter - The tree hierarchy adapter.node - The node to start the search from.
public static java.lang.Object[] getPath(TreeAdapter adapter,
java.lang.Object node)
adapter - The tree hierarchy adapter.node - The node whose path to get.
public static java.lang.Object[] getPath(TreeAdapter adapter,
java.lang.Object node,
java.lang.Object root)
adapter - The tree hierarchy adapter.node - The node whose path to get.root - The node to stop the search at
public static java.lang.Object getFollowingNode(TreeAdapter adapter,
java.lang.Object node)
adapter - The tree hierarchy adapter.node - The node to start from.
public static java.lang.Object getPrecedingNode(TreeAdapter adapter,
java.lang.Object node)
adapter - The tree hierarchy adapter.node - The node to start from.
public static java.lang.Object getFollowingNode(TreeAdapter adapter,
java.lang.Object node,
java.lang.Object limit)
adapter - The tree hierarchy adapter.node - The node to start from.limit - Limit the search to this node and its descendants.
public static java.lang.Object getPrecedingNode(TreeAdapter adapter,
java.lang.Object node,
java.lang.Object limit)
adapter - The tree hierarchy adapter.node - The node to start from.limit - Limit the search to this node and its descendants.
public static java.lang.Object getLastDescendant(TreeAdapter adapter,
java.lang.Object node)
adapter - The tree hierarchy adapter.node - The node to start from.
public static java.lang.Object copyTree(MutableTreeAdapter adapter,
java.lang.Object node)
adapter - The tree hierarchy adapter.node - The root node of the (sub)tree to copy.
public static java.lang.Object traverse(TreeAdapter adapter,
java.lang.Object node,
TraversalCallback callback)
External synchronization is required if multithreaded access to the tree is possible.
adapter - The tree hierarchy adapter.node - The node to start the traversal at.callback - The Callback to notify.
public static java.lang.Object traverseFrom(TreeAdapter adapter,
java.lang.Object node,
java.lang.Object start,
TraversalCallback callback)
External synchronization is required if multithreaded access to the tree is possible.
adapter - The tree hierarchy adapter.node - The root node for the traversal.start - The node to start the traversal at. All nodes befor
this one will be skipped. Must be a descendant of
node, or nothing is traversed.callback - The Callback to notify.
public static java.lang.Object visitTree(TreeAdapter adapter,
java.lang.Object visitor,
java.lang.Object node)
adapter - The tree hierarchy adapter.visitor - The visitor that visits the nodes.node - The node to start at.
|
qflib 0.98.1 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||