public class JavaTree
extends java.lang.Object
TreeNode
Modifier and Type | Field and Description |
---|---|
java.util.ArrayList<JavaTreeNode> |
nodes
The list of nodes of the tree indexed by their keys, indexed by key
|
protected JavaTreeNode |
root
Root node of this tree
|
Constructor and Description |
---|
JavaTree()
Default tree constructor.
|
JavaTree(JavaTree treeToCopy)
Copy constructor used to create versions of trees that are identical to the supplied input tree.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Clean up method, called when the tree is deleted.
|
protected void |
finalize()
Calls to #close() when tree is deleted.
|
int |
getHeight()
Accessor for height of tree.
|
int |
getKey()
Accessor for key.
|
JavaTreeNode |
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<JavaTreeNode> |
getLeaves(JavaTreeNode node)
Get the leaves under this node.
|
JavaTreeNode |
getLeftmostLeaf()
Left most leaf accessor.
|
float |
getMaxObjectValue()
Stub function
|
float |
getMinObjectValue()
Stub function
|
java.lang.String |
getName()
File name accessor.
|
int |
getNexusIndex() |
JavaTreeNode |
getNodeByKey(int key)
Returns the node indexed by the given key.
|
JavaTreeNode |
getNodeByName(java.lang.String s)
Returns the node given by the string.
|
JavaTreeNode |
getRoot()
Root accessor.
|
protected int |
getTotalNodeCount()
Returns the node count, for internal and leaf nodes.
|
void |
postProcess()
Post processing includes computing size of each node,
linking nodes in different order, etc.
|
void |
setFileName(java.lang.String tn)
Sets the file name.
|
void |
setKey(int i)
Mutator for key
|
void |
setRootNode(JavaTreeNode newRoot) |
void |
setUpNameLists()
Traverse the tree and initialize the
nodesByName and nodes data structures. |
public java.util.ArrayList<JavaTreeNode> nodes
protected JavaTreeNode root
public JavaTree()
public JavaTree(JavaTree treeToCopy)
treeToCopy
- Tree used to make a copy.public void close()
TreeNode#close()
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
protected int getTotalNodeCount()
nodes
array, which contains all nodes.public JavaTreeNode getNodeByKey(int key)
key
- Key of the node to retrieve.public JavaTreeNode getNodeByName(java.lang.String s)
s
- Name/label of node to retrieve.public int getHeight()
height
.public void setKey(int i)
i
- New value for key
.public int getKey()
key
.public java.lang.String getName()
fileName
.public JavaTreeNode getLeftmostLeaf()
public JavaTreeNode getRoot()
root
public void setRootNode(JavaTreeNode newRoot)
public void setFileName(java.lang.String tn)
tn
- New value for file name.public int getLeafCount()
numLeaves
.public void postProcess()
TreeNode
public void setUpNameLists()
nodesByName
and nodes
data structures.
Used when modifying the names of nodes as well as initialization.public JavaTreeNode getLeaf(int index)
index
- A leaf index of interest.public float getMinObjectValue()
public float getMaxObjectValue()
public int getNexusIndex()
public java.util.LinkedList<JavaTreeNode> getLeaves(JavaTreeNode node)
node
- Node to get leaves under. The root node will return all leaves in the tree, leaves return a list of just themselves.