info.bioinfweb.treegraph.document
Class TreePath
java.lang.Object
info.bioinfweb.treegraph.document.TreePath
public class TreePath
- extends Object
This class stores the path to an node from the root of the tree. It can be used to
find equivalent nodes in different trees.
- Author:
- Ben Stöver
|
Method Summary |
int |
comparePosition(TreePath other)
Calculates which of the two target nodes is further upwards in the tree. |
Node |
findNode(Node root)
Finds the node specidied by the stored path relative to the given root node. |
private void |
setPath(Node end)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
path
private Vector<Integer> path
TreePath
public TreePath(Node end)
setPath
private void setPath(Node end)
findNode
public Node findNode(Node root)
- Finds the node specidied by the stored path relative to the given root node.
- Parameters:
root - - the start of the path
- Returns:
- the end of the path
comparePosition
public int comparePosition(TreePath other)
- Calculates which of the two target nodes is further upwards in the tree.
- Parameters:
other - - the path that leads to the node that should be compared with the
target of this path (The given path has to allude to the same tree as the path
contained in this object.)
- Returns:
- -1 if the target of the comapared path is further upwards, 1 if the target of
this path is further upwards or 0 if both paths lead to the same node