public class SimpleNode implements AttributeNode
data structure for a node (includes branch) in a binary/non-binary rooted/unrooted tree
public SimpleNode()
constructor default node
public SimpleNode(java.lang.String name,
double branchLength)
protected SimpleNode(Node[] children, double branchLength)
Constructor
children - branchLength - IllegalArgumentException - if only one child!protected SimpleNode(Node[] children)
public SimpleNode(Node n)
constructor used to clone a node and all children
public SimpleNode(Node n, boolean keepIds)
public SimpleNode(Node n, LabelMapping lm)
public void reset()
protected void init(Node n)
protected void init(Node n, boolean keepId)
Initialized node instance variables based on given Node. children are ignored.
protected void init(Node n, boolean keepId, LabelMapping lm)
Initialized node instance variables based on given Node. children are ignored.
lm - - may be nullpublic Node getParent()
Returns the parent node of this node.
public void setParent(Node node)
Set the parent node of this node.
public void removeParent()
removes parent.
public java.lang.String getSequenceString()
Returns the sequence at this node, in the form of a String.
public kotlin.Array[] getSequence()
Returns the sequence at this node, in the form of an array of bytes.
public void setSequence(kotlin.Array[] s)
Sets the sequence at this node, in the form of an array of bytes.
public double getBranchLength()
Get the length of the branch attaching this node to its parent.
public void setBranchLength(double value)
Set the length of the branch attaching this node to its parent.
public double getBranchLengthSE()
Get the length SE of the branch attaching this node to its parent.
public void setBranchLengthSE(double value)
Set the length SE of the branch attaching this node to its parent.
public double getNodeHeight()
Get the height of this node relative to the most recent node.
public void setNodeHeight(double value)
Set the height of this node relative to the most recent node.
public void setNodeHeight(double value,
boolean adjustChildBranchLengths)
Set the height of this node relative to the most recent node.
adjustChildBranchLengths - if truepublic Taxon getIdentifier()
Returns the identifier for this node.
public void setIdentifier(Taxon id)
Set identifier for this node.
public void setNumber(int n)
public int getNumber()
public Node getChild(int n)
get child node
n - number of childpublic void setChild(int n,
Node node)
set child node
n - numberpublic boolean hasChildren()
check whether this node is an internal node
public boolean isLeaf()
check whether this node is an external node
public boolean isRoot()
check whether this node is a root node
public void addChild(Node n)
add new child node
n - new child nodepublic void insertChild(Node n, int pos)
add new child node (insertion at a specific position)
n - new child node + @param pos positionpublic Node removeChild(int n)
remove child
n - number of child to be removedpublic void lengths2HeightsContemp()
determines the height of this node and its descendants from branch lengths, assuming contemporaneous tips.
public void setAttribute(java.lang.String name,
java.lang.Object value)
Sets a named attribute to the given value.
name - the name of the attributevalue - the value to set the attributepublic java.lang.Object getAttribute(java.lang.String name)
name - the name of the attribute.public java.util.Enumeration getAttributeNames()
public int getChildCount()
Returns the number of children this node has.
public java.lang.String toString()