Package pal.tree
Class Tree.TreeBase
java.lang.Object
pal.tree.Tree.TreeBase
- All Implemented Interfaces:
Serializable
,IdGroup
,Report
,Units
,UnitsProvider
,Tree
- Enclosing interface:
Tree
public abstract static class Tree.TreeBase
extends Object
implements Tree, Report, Units, Serializable
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface pal.misc.IdGroup
IdGroup.Utils
Nested classes/interfaces inherited from interface pal.tree.Tree
Tree.TreeBase
-
Field Summary
Fields inherited from interface pal.misc.Units
DAYS, EXPECTED_SUBSTITUTIONS, GENERATIONS, MONTHS, SAMPLE, SHORT_UNIT_NAMES, UNIT_NAMES, UNKNOWN, YEARS
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
count and list external and internal nodes and compute heights of each nodefindNode
(int num) return node with number num (as displayed in ASCII tree)getAttribute
(Node node, String name) final Node
getExternalNode
(int i) Returns the ith external node.final int
Returns the number of external nodes.int
Returns the number of identifiers in this groupgetIdentifier
(int i) Returns the ith identifier.final Node
getInternalNode
(int i) Returns the ith internal node.final int
Returns the number of internal nodes.final Node
getRoot()
Returns the root node of this tree.final int
getUnits()
Return the units that this tree is expressed in.void
report
(PrintWriter out) print human readable report (e.g., on parameters and associated model)void
reroot
(int num) make node with number num to root nodevoid
make provided node the root nodevoid
setAttribute
(Node node, String name, Object value) Sets an named attribute for a given node.void
setIdentifier
(int i, Identifier id) Sets the ith identifier.void
Called by subclasses that can't give root at time of construction (of this class)protected void
setSetupLengthsAndHeights
(boolean value) Set whether or not this class should call methods to adjust either heights or lengths automaticallyfinal void
setUnits
(int units) Sets the units that this tree is expressed in.toString()
int
returns the index of the identifier with the given name.
-
Constructor Details
-
TreeBase
constructor- Parameters:
theRoot
- the node to base tree on
-
TreeBase
protected TreeBase()constructor -
TreeBase
clone constructor
-
-
Method Details
-
setRoot
Called by subclasses that can't give root at time of construction (of this class) -
getUnits
public final int getUnits()Return the units that this tree is expressed in.- Specified by:
getUnits
in interfaceTree
- Specified by:
getUnits
in interfaceUnitsProvider
- Returns:
- the units relating to this object.
-
setUnits
public final void setUnits(int units) Sets the units that this tree is expressed in. -
getExternalNodeCount
public final int getExternalNodeCount()Returns the number of external nodes.- Specified by:
getExternalNodeCount
in interfaceTree
- Returns:
- a count of the number of external nodes (tips) in this tree.
-
getExternalNode
Returns the ith external node.- Specified by:
getExternalNode
in interfaceTree
- Returns:
- the ith external node in the tree.
-
getInternalNodeCount
public final int getInternalNodeCount()Returns the number of internal nodes.- Specified by:
getInternalNodeCount
in interfaceTree
- Returns:
- a count of the number of internal nodes (and hence clades) in this tree.
-
getInternalNode
Returns the ith internal node.- Specified by:
getInternalNode
in interfaceTree
- Returns:
- the ith internal node in the tree.
-
getRoot
Returns the root node of this tree. -
findNode
return node with number num (as displayed in ASCII tree)- Parameters:
num
- number of node- Returns:
- node
-
createNodeList
public void createNodeList()count and list external and internal nodes and compute heights of each node- Specified by:
createNodeList
in interfaceTree
-
setSetupLengthsAndHeights
protected void setSetupLengthsAndHeights(boolean value) Set whether or not this class should call methods to adjust either heights or lengths automatically -
toString
-
setAttribute
Sets an named attribute for a given node.- Specified by:
setAttribute
in interfaceTree
- Parameters:
node
- the node whose attribute is being set.name
- the name of the attribute.value
- the new value of the attribute.
-
getAttribute
- Specified by:
getAttribute
in interfaceTree
- Parameters:
node
- the node being interrogated.name
- the name of the attribute of interest.- Returns:
- an object representing the named attributed for the numbered node.
-
reroot
public void reroot(int num) make node with number num to root node- Parameters:
num
- number of node
-
reroot
make provided node the root node- Parameters:
node
- the node to make the root.
-
getIdCount
public int getIdCount()Description copied from interface:IdGroup
Returns the number of identifiers in this group- Specified by:
getIdCount
in interfaceIdGroup
-
getIdentifier
Description copied from interface:IdGroup
Returns the ith identifier.- Specified by:
getIdentifier
in interfaceIdGroup
-
setIdentifier
Description copied from interface:IdGroup
Sets the ith identifier.- Specified by:
setIdentifier
in interfaceIdGroup
-
whichIdNumber
Description copied from interface:IdGroup
returns the index of the identifier with the given name.- Specified by:
whichIdNumber
in interfaceIdGroup
-
report
Description copied from interface:Report
print human readable report (e.g., on parameters and associated model)
-