info.bioinfweb.treegraph.document
Class TreePath

java.lang.Object
  extended by info.bioinfweb.treegraph.document.TreePath

public class TreePath
extends java.lang.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

Field Summary
private  java.util.Vector<java.lang.Integer> path
           
 
Constructor Summary
TreePath(Node end)
           
 
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
 

Field Detail

path

private java.util.Vector<java.lang.Integer> path
Constructor Detail

TreePath

public TreePath(Node end)
Method Detail

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