|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpal.tree.SimpleNode
public class SimpleNode
data structure for a node (includes branch) in a binary/non-binary rooted/unrooted tree
Field Summary |
---|
Fields inherited from interface pal.tree.AttributeNode |
---|
CLADE_PROBABILITY, MEAN_CLADE_HEIGHT, NODE_HEIGHT_SE, SUBTREE_PROBABILITY |
Constructor Summary | |
---|---|
|
SimpleNode()
constructor default node |
|
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)
|
|
SimpleNode(java.lang.String name,
double branchLength)
|
Method Summary | |
---|---|
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()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
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)
Method Detail |
---|
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()
getParent
in interface Node
public void setParent(Node node)
setParent
in interface 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
setNumber
in interface Node
public int getNumber()
Node
getNumber
in interface Node
public Node getChild(int n)
getChild
in interface Node
n
- number of child
public void setChild(int n, Node node)
setChild
in interface Node
n
- numberpublic boolean hasChildren()
public boolean isLeaf()
isLeaf
in interface Node
public boolean isRoot()
isRoot
in interface Node
public void addChild(Node n)
addChild
in interface Node
n
- new child nodepublic 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
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |