pal.tree
public class SimpleTree extends java.lang.Object implements Tree, Report, Units, java.io.Serializable
Tree.TreeBase
IdGroup.Utils
DAYS, EXPECTED_SUBSTITUTIONS, GENERATIONS, MONTHS, SAMPLE, SHORT_UNIT_NAMES, UNIT_NAMES, UNKNOWN, YEARS
Constructor and Description |
---|
SimpleTree()
constructor tree consisting solely of root node
|
SimpleTree(Node r)
constructor taking a root node
|
SimpleTree(Tree tree)
clone constructor
|
SimpleTree(Tree tree,
boolean keepIdentifiers)
clone constructor
|
SimpleTree(Tree tree,
LabelMapping lm)
clone constructor
|
Modifier and Type | Method and Description |
---|---|
void |
createNodeList()
count and list external and internal nodes and
compute heights of each node
|
Node |
findNode(int num)
return node with number num (as displayed in ASCII tree)
|
java.lang.Object |
getAttribute(Node node,
java.lang.String name) |
Tree |
getCopy() |
Node |
getExternalNode(int i)
Returns the ith external node.
|
int |
getExternalNodeCount()
Returns the number of external nodes.
|
int |
getIdCount()
Returns the number of identifiers in this group
|
Identifier |
getIdentifier(int i)
Returns the ith identifier.
|
Node |
getInternalNode(int i)
Returns the ith internal node.
|
int |
getInternalNodeCount()
Returns the number of internal nodes.
|
Node |
getRoot()
Returns the root node of this tree.
|
int |
getUnits()
Return the units that this tree is expressed in.
|
void |
report(java.io.PrintWriter out)
print human readable report (e.g., on parameters and associated model)
|
void |
reroot(int num)
make node with number num to root node
|
void |
reroot(Node node)
make provided node the root node
|
void |
setAttribute(Node node,
java.lang.String name,
java.lang.Object value)
Sets an named attribute for a given node.
|
void |
setIdentifier(int i,
Identifier id)
Sets the ith identifier.
|
void |
setRoot(Node r)
Set a new node as root node.
|
void |
setUnits(int units)
Sets the units that this tree is expressed in.
|
java.lang.String |
toString() |
int |
whichIdNumber(java.lang.String s)
returns the index of the identifier with the given name.
|
public SimpleTree()
public SimpleTree(Node r)
public SimpleTree(Tree tree)
public SimpleTree(Tree tree, boolean keepIdentifiers)
public SimpleTree(Tree tree, LabelMapping lm)
lm
- - a label mapping use for translating the original label names into something elsepublic final int getUnits()
getUnits
in interface UnitsProvider
getUnits
in interface Tree
public final void setUnits(int units)
public final int getExternalNodeCount()
getExternalNodeCount
in interface Tree
public final Node getExternalNode(int i)
getExternalNode
in interface Tree
public final int getInternalNodeCount()
getInternalNodeCount
in interface Tree
public final Node getInternalNode(int i)
getInternalNode
in interface Tree
public final Node getRoot()
public final void setRoot(Node r)
public void createNodeList()
createNodeList
in interface Tree
public java.lang.String toString()
toString
in class java.lang.Object
public Node findNode(int num)
num
- number of nodepublic void setAttribute(Node node, java.lang.String name, java.lang.Object value)
setAttribute
in interface Tree
node
- the node whose attribute is being set.name
- the name of the attribute.value
- the new value of the attribute.public int getIdCount()
IdGroup
getIdCount
in interface IdGroup
public Identifier getIdentifier(int i)
IdGroup
getIdentifier
in interface IdGroup
public void setIdentifier(int i, Identifier id)
IdGroup
setIdentifier
in interface IdGroup
public int whichIdNumber(java.lang.String s)
IdGroup
whichIdNumber
in interface IdGroup
public java.lang.Object getAttribute(Node node, java.lang.String name)
getAttribute
in interface Tree
node
- the node being interrogated.name
- the name of the attribute of interest.public void reroot(int num)
num
- number of nodepublic void reroot(Node node)
node
- the node to make the root.public void report(java.io.PrintWriter out)
Report