java.io.Serializable
, AttributeNode
, Node
PositionedNode
public class SimpleNode extends java.lang.Object implements AttributeNode
CLADE_PROBABILITY, MEAN_CLADE_HEIGHT, NODE_HEIGHT_SE, SUBTREE_PROBABILITY
Modifier | Constructor | Description |
---|---|---|
|
SimpleNode() |
constructor default node
|
|
SimpleNode(java.lang.String name,
double branchLength) |
|
|
SimpleNode(Node n) |
constructor used to clone a node and all children
|
protected |
SimpleNode(Node[] children) |
|
protected |
SimpleNode(Node[] children,
double branchLength) |
Constructor
|
|
SimpleNode(Node n,
boolean keepIds) |
|
|
SimpleNode(Node n,
LabelMapping lm) |
Modifier and Type | Method | Description |
---|---|---|
void |
addChild(Node n) |
add new child node
|
java.lang.Object |
getAttribute(java.lang.String name) |
|
java.util.Enumeration |
getAttributeNames() |
|
double |
getBranchLength() |
Get the length of the branch attaching this node to its parent.
|
double |
getBranchLengthSE() |
Get the length SE of the branch attaching this node to its parent.
|
Node |
getChild(int n) |
get child node
|
int |
getChildCount() |
Returns the number of children this node has.
|
Identifier |
getIdentifier() |
Returns the identifier for this node.
|
double |
getNodeHeight() |
Get the height of this node relative to the most recent node.
|
int |
getNumber() |
return the index of this node
|
Node |
getParent() |
Returns the parent node of this node.
|
byte[] |
getSequence() |
Returns the sequence at this node, in the form of an array of bytes.
|
java.lang.String |
getSequenceString() |
Returns the sequence at this node, in the form of a String.
|
boolean |
hasChildren() |
check whether this node is an internal node
|
protected void |
init(Node n) |
|
protected void |
init(Node n,
boolean keepId) |
Initialized node instance variables based on given Node.
|
protected void |
init(Node n,
boolean keepId,
LabelMapping lm) |
Initialized node instance variables based on given Node.
|
void |
insertChild(Node n,
int pos) |
add new child node (insertion at a specific position)
|
boolean |
isLeaf() |
check whether this node is an external node
|
boolean |
isRoot() |
check whether this node is a root node
|
void |
lengths2HeightsContemp() |
determines the height of this node and its descendants
from branch lengths, assuming contemporaneous tips.
|
Node |
removeChild(int n) |
remove child
|
void |
removeParent() |
removes parent.
|
void |
reset() |
|
void |
setAttribute(java.lang.String name,
java.lang.Object value) |
Sets a named attribute to the given value.
|
void |
setBranchLength(double value) |
Set the length of the branch attaching this node to its parent.
|
void |
setBranchLengthSE(double value) |
Set the length SE of the branch attaching this node to its parent.
|
void |
setChild(int n,
Node node) |
set child node
|
void |
setIdentifier(Identifier id) |
Set identifier for this node.
|
void |
setNodeHeight(double value) |
Set the height of this node relative to the most recent node.
|
void |
setNodeHeight(double value,
boolean adjustChildBranchLengths) |
Set the height of this node relative to the most recent node.
|
void |
setNumber(int n) |
set the index of this node
|
void |
setParent(Node node) |
Set the parent node of this node.
|
void |
setSequence(byte[] s) |
Sets the sequence at this node, in the form of an array of bytes.
|
java.lang.String |
toString() |
public SimpleNode()
public SimpleNode(java.lang.String name, double branchLength)
protected SimpleNode(Node[] children, double branchLength)
children
- branchLength
- java.lang.IllegalArgumentException
- if only one child!protected SimpleNode(Node[] children)
public SimpleNode(Node n)
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)
protected void init(Node n, boolean keepId, LabelMapping lm)
lm
- - may be nullpublic final Node getParent()
public void setParent(Node node)
public final void removeParent()
public java.lang.String getSequenceString()
public byte[] getSequence()
getSequence
in interface Node
public void setSequence(byte[] s)
setSequence
in interface Node
public final double getBranchLength()
getBranchLength
in interface Node
public final void setBranchLength(double value)
setBranchLength
in interface Node
public final double getBranchLengthSE()
getBranchLengthSE
in interface Node
public final void setBranchLengthSE(double value)
setBranchLengthSE
in interface Node
public final double getNodeHeight()
getNodeHeight
in interface Node
public final void setNodeHeight(double value)
setNodeHeight
in interface Node
public final void setNodeHeight(double value, boolean adjustChildBranchLengths)
setNodeHeight
in interface Node
adjustChildBranchLengths
- if truepublic final Identifier getIdentifier()
getIdentifier
in interface Node
public final void setIdentifier(Identifier id)
setIdentifier
in interface Node
public void setNumber(int n)
Node
public int getNumber()
Node
public Node getChild(int n)
public void setChild(int n, Node node)
public boolean hasChildren()
public boolean isLeaf()
public boolean isRoot()
public void addChild(Node n)
public void insertChild(Node n, int pos)
insertChild
in interface Node
n
- new child node
+ @param pos positionpublic Node removeChild(int n)
removeChild
in interface Node
n
- number of child to be removedpublic void lengths2HeightsContemp()
public final void setAttribute(java.lang.String name, java.lang.Object value)
setAttribute
in interface AttributeNode
name
- the name of the attributevalue
- the value to set the attributepublic final java.lang.Object getAttribute(java.lang.String name)
getAttribute
in interface AttributeNode
name
- the name of the attribute.public final java.util.Enumeration getAttributeNames()
getAttributeNames
in interface AttributeNode
public final int getChildCount()
getChildCount
in interface Node
public java.lang.String toString()
toString
in class java.lang.Object