|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sourceforge.olduvai.treejuxtaposer.drawer.Tree
public class Tree
A public class representing a (phylognenetic) tree. Nodes of the tree are of type TreeNode. Nodes are traversed in pre- and post-orders.
TreeNode
Field Summary | |
---|---|
private java.lang.String |
fileName
File name for this tree. |
private int |
height
Height of tree, which is also the longest path from the root to some leaf node. |
private int |
key
key should be unique for each tree, set by object that creates trees |
private StaticSplitAxis |
leafSplitAxis
Split axis reference for leaf recovery (leaves are attached to split line culling objects) |
private int |
nexusIndex
Index of tree in nexus file, if this tree is from a nexus file. |
java.util.ArrayList |
nodes
The list of nodes of the tree indexed by their keys, indexed by key |
private java.util.HashMap |
nodesByName
Most internal nodes don't have names. |
private int |
numLeaves
Leaf counter, for determining grid size, making arrays for tree comparisons |
protected TreeNode |
root
Root node of this tree |
Constructor Summary | |
---|---|
Tree()
Default tree constructor. |
|
Tree(Tree treeToCopy)
Copy constructor used to create versions of trees that are identical to the supplied input tree. |
Method Summary | |
---|---|
void |
close()
Clean up method, called when the tree is deleted. |
protected void |
finalize()
Calls to #close() when tree is deleted. |
protected int |
getHeight()
Accessor for height of tree. |
private int |
getInteriorCount()
Returns the number of interior nodes in this tree. |
int |
getKey()
Accessor for key. |
TreeNode |
getLeaf(int index)
Get the leaf associated with the given leaf index. |
int |
getLeafCount()
Returns the number of leaves in this tree. |
java.util.LinkedList |
getLeaves(TreeNode node)
Get the leaves under this node. |
TreeNode |
getLeftmostLeaf()
Left most leaf accessor. |
float |
getMaxObjectValue()
Stub function |
float |
getMinObjectValue()
Stub function |
java.lang.String |
getName()
File name accessor. |
int |
getNexusIndex()
|
TreeNode |
getNodeByKey(int key)
Returns the node indexed by the given key. |
TreeNode |
getNodeByName(java.lang.String s)
Returns the node given by the string. |
TreeNode |
getRoot()
Root accessor. |
protected int |
getTotalNodeCount()
Returns the node count, for internal and leaf nodes. |
private void |
linkLeaves(javax.swing.JProgressBar jpb)
Links leaves of the tree in pre-order, check to see whether leaves have distinct names. |
private void |
linkNodesInPreorder()
Wrapper for initiating linkSubtreeNodesInPreorder(TreeNode) with the root node. |
private void |
linkSubtreeNodesInPreorder(TreeNode n)
Traverses the subtree rooted at TreeNode n in pre-order, stores the ordering in the preorderNext field of TreeNodes. |
void |
postProcess(javax.swing.JProgressBar jpb)
Post processing includes computing size of each node, linking nodes in different order, etc. |
private void |
preorderPostProcess()
Traverses the tree in pre-order, stores the ordering in the preorderNext field of TreeNodes Sets node count for the tree. |
void |
setFileName(java.lang.String tn)
Sets the file name. |
void |
setKey(int i)
Mutator for key |
void |
setLeafSplitAxis(StaticSplitAxis leafSplitAxis)
|
void |
setRootNode(TreeNode newRoot)
|
void |
setUpNameLists()
Traverse the tree and initialize the nodesByName and nodes data structures. |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public java.util.ArrayList nodes
private java.util.HashMap nodesByName
private int key
private int numLeaves
private StaticSplitAxis leafSplitAxis
private int height
private java.lang.String fileName
private int nexusIndex
protected TreeNode root
Constructor Detail |
---|
public Tree()
public Tree(Tree treeToCopy)
treeToCopy
- Tree used to make a copy.Method Detail |
---|
public void close()
TreeNode.close()
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
private int getInteriorCount()
protected int getTotalNodeCount()
nodes
array, which contains all nodes.public TreeNode getNodeByKey(int key)
key
- Key of the node to retrieve.
public TreeNode getNodeByName(java.lang.String s)
s
- Name/label of node to retrieve.
protected int getHeight()
height
.public void setKey(int i)
i
- New value for key
.public int getKey()
key
.public java.lang.String getName()
fileName
.public TreeNode getLeftmostLeaf()
public TreeNode getRoot()
root
public void setRootNode(TreeNode newRoot)
public void setFileName(java.lang.String tn)
tn
- New value for file name.public int getLeafCount()
numLeaves
.public void postProcess(javax.swing.JProgressBar jpb)
jpb
- Progress barTreeNode
private void preorderPostProcess()
TreeNode
public void setUpNameLists()
nodesByName
and nodes
data structures.
Used when modifying the names of nodes as well as initialization.
private void linkNodesInPreorder()
linkSubtreeNodesInPreorder(TreeNode)
with the root node.
private void linkSubtreeNodesInPreorder(TreeNode n)
n
- the root of the subtreeTreeNode
private void linkLeaves(javax.swing.JProgressBar jpb)
jpb
- Progress bar.linkNodesInPreorder()
,
TreeNode
,
NameComparator
public TreeNode getLeaf(int index)
index
- A leaf index of interest.
public float getMinObjectValue()
public float getMaxObjectValue()
public int getNexusIndex()
public void setLeafSplitAxis(StaticSplitAxis leafSplitAxis)
leafSplitAxis
- The leafSplitLine to set.public java.util.LinkedList getLeaves(TreeNode node)
node
- Node to get leaves under. The root node will return all leaves in the tree, leaves return a list of just themselves.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |