org.forester.phylogeny
public class PhylogenyNode extends java.lang.Object implements PhylogenyNodeI, java.lang.Comparable<PhylogenyNode>
Modifier and Type | Field and Description |
---|---|
static double |
DISTANCE_DEFAULT
Value of -99.0 is used as default value.
|
Constructor and Description |
---|
PhylogenyNode()
Default constructor for PhylogenyNode.
|
PhylogenyNode(java.lang.String nhx) |
PhylogenyNode(java.lang.String nhx,
NHXParser.TAXONOMY_EXTRACTION taxonomy_extraction) |
PhylogenyNode(java.lang.String nhx,
NHXParser.TAXONOMY_EXTRACTION taxonomy_extraction,
boolean replace_underscores)
Constructor for PhylogenyNode.
|
Modifier and Type | Method and Description |
---|---|
void |
addAsChild(PhylogenyNodeI node)
Adds PhylogenyNode n to the list of child nodes and sets the _parent of n
to this.
|
int |
compareTo(PhylogenyNode o) |
PhylogenyNode |
copyNodeData()
Returns a new PhylogenyNode which has its data copied from this
PhylogenyNode.
|
boolean |
equals(java.lang.Object o) |
java.util.List<PhylogenyNode> |
getAllExternalDescendants()
Returns a List containing references to all external children of this
PhylogenyNode.
|
java.util.List<java.lang.String> |
getAllExternalDescendantsNames()
Returns a List containing references to all names of the external
children of this PhylogenyNode.
|
BranchData |
getBranchData() |
PhylogenyNode |
getChildNode(int i)
This return child node n of this node.
|
PhylogenyNode |
getChildNode1()
Convenience method.
|
PhylogenyNode |
getChildNode2()
Convenience method.
|
int |
getChildNodeIndex()
This gets the child node index of this node.
|
int |
getChildNodeIndex(PhylogenyNode parent)
This gets the child node index of this node, given that parent is its
parent
|
java.util.List<PhylogenyNode> |
getDescendants() |
double |
getDistanceToParent()
Returns the length of the branch leading to the _parent of this
PhylogenyNode (double).
|
PhylogenyNode |
getFirstChildNode()
Convenience method.
|
byte |
getIndicator()
Returns the _indicator value of this PhylogenyNode.
|
PhylogenyNode |
getLastChildNode()
Convenience method.
|
PhylogenyNode |
getLink()
Returns a refernce to the linked PhylogenyNode of this PhylogenyNode.
|
PhylogenyNode |
getNextExternalNode()
Returns a refernce to the next external PhylogenyNode of this
PhylogenyNode.
|
static int |
getNodeCount()
Returns the total number of all Nodes created so far.
|
NodeData |
getNodeData() |
int |
getNodeId()
Returns the ID (int) of this PhylogenyNode.
|
java.lang.String |
getNodeName()
Returns the name of this node.
|
int |
getNumberOfDescendants() |
int |
getNumberOfExternalNodes()
Returns the total number of external Nodes originating from this
PhylogenyNode (int).
|
int |
getNumberOfParents() |
PhylogenyNode |
getParent()
Returns a refernce to the parent PhylogenyNode of this PhylogenyNode.
|
boolean |
getPathToParent() |
PhylogenyNode |
getPreviousExternalNode()
Returns a refernce to the next external PhylogenyNode of this
PhylogenyNode.
|
float |
getXcoord()
Used for drawing of Trees.
|
float |
getXSecondary() |
float |
getYcoord()
Used for drawing of Trees.
|
float |
getYSecondary() |
int |
hashCode() |
void |
initializeData()
Deletes data of this PhylogenyNode.
|
boolean |
isCollapse()
Returns whether this PhylogenyNode should be drawn as collapsed.
|
boolean |
isDuplication()
Returns true if this PhylogenyNode represents a _duplication event, false
otherwise.
|
boolean |
isExternal()
Checks whether this PhylogenyNode is external (tip).
|
boolean |
isFirstChildNode()
DOCUMENT ME!
|
boolean |
isFirstExternalNode()
DOCUMENT ME!
|
boolean |
isHasAssignedEvent()
Returns whether a _duplication or speciation event has been assigned for
this PhylogenyNode.
|
boolean |
isInternal()
Checks whether this PhylogenyNode is internal (tip).
|
boolean |
isLastChildNode()
Returns true if this node is the last child node of its _parent.
|
boolean |
isLastExternalNode()
DOCUMENT ME!
|
boolean |
isRoot()
Checks whether this PhylogenyNode is a root.
|
boolean |
isSpeciation() |
PhylogenyNodeIterator |
iterateChildNodesForward() |
void |
preorderPrint()
Prints to the console the subtree originating from this PhylogenyNode in
preorder.
|
void |
removeChildNode(int i) |
void |
removeChildNode(PhylogenyNode remove_me) |
void |
setBranchData(BranchData branch_data) |
void |
setChild1(PhylogenyNode n)
Sets the first child PhylogenyNode of this PhylogenyNode to n.
|
void |
setChild2(PhylogenyNode n)
Sets the second child PhylogenyNode of this PhylogenyNode to n.
|
void |
setChildNode(int i,
PhylogenyNode node)
Inserts PhylogenyNode n at the specified position i into the list of
child nodes.
|
void |
setCollapse(boolean b)
Sets whether this PhylogenyNode should be drawn as collapsed.
|
void |
setDistanceToParent(double d)
Sets the length of the branch leading to the _parent of this
PhylogenyNode to double d.
|
void |
setIndicator(byte i)
Sets the _indicator value of this PhylogenyNode to i.
|
void |
setLink(PhylogenyNode n)
Sets the linked PhylogenyNode of this PhylogenyNode to n.
|
void |
setName(java.lang.String node_name)
Sets the name of this node.
|
static void |
setNodeCount(int i)
Sets the total number of all Nodes created so far to i (int).
|
protected void |
setNodeId(int i)
Sets the ID of this PhylogenyNode to i (int).
|
void |
setParent(PhylogenyNode n)
Sets the _parent PhylogenyNode of this PhylogenyNode to n.
|
void |
setPathToParent(boolean value) |
void |
setSumExtNodes(int i)
Sets the total number of external Nodes originating from this
PhylogenyNode to i (int).
|
void |
setXcoord(float x)
Used for drawing of Trees.
|
void |
setXSecondary(float x_secondary) |
void |
setYcoord(float y)
Used for drawing of Trees.
|
void |
setYSecondary(float y_secondary) |
java.lang.String |
toNewHampshire(boolean simple_nh,
boolean write_distance_to_parent) |
java.lang.String |
toNewHampshireX()
Converts this PhylogenyNode to a New Hampshire X (NHX) String
representation.
|
java.lang.String |
toString() |
public static final double DISTANCE_DEFAULT
public PhylogenyNode()
public PhylogenyNode(java.lang.String nhx) throws NHXFormatException
NHXFormatException
public PhylogenyNode(java.lang.String nhx, NHXParser.TAXONOMY_EXTRACTION taxonomy_extraction) throws NHXFormatException
NHXFormatException
public PhylogenyNode(java.lang.String nhx, NHXParser.TAXONOMY_EXTRACTION taxonomy_extraction, boolean replace_underscores) throws NHXFormatException
s
- String representing one PhylogenyNode in New Hampshire (NH) or
New Hampshire X (NHX) format.NHXFormatException
PhylogenyParserException
public void setPathToParent(boolean value)
public boolean getPathToParent()
public final void addAsChild(PhylogenyNodeI node)
addAsChild
in interface PhylogenyNodeI
n
- the PhylogenyNode to addpublic final int compareTo(PhylogenyNode o)
compareTo
in interface java.lang.Comparable<PhylogenyNode>
public final PhylogenyNode copyNodeData()
getLink()
public final boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public final java.util.List<PhylogenyNode> getAllExternalDescendants()
public final java.util.List<java.lang.String> getAllExternalDescendantsNames()
public final BranchData getBranchData()
public final PhylogenyNode getChildNode(int i)
getChildNode
in interface PhylogenyNodeI
n
- the index of the child to getjava.lang.IllegalArgumentException
- if n is out of boundspublic final PhylogenyNode getChildNode1()
public final PhylogenyNode getChildNode2()
[last modified May 18, 2005 by CMZ]
public final int getChildNodeIndex()
java.lang.UnsupportedOperationException
- if this node is a root nodepublic final int getChildNodeIndex(PhylogenyNode parent)
[last modified Aug 14, 2006 by CMZ]
java.lang.UnsupportedOperationException
- if this node is a root nodepublic final java.util.List<PhylogenyNode> getDescendants()
public final double getDistanceToParent()
getDistanceToParent
in interface PhylogenyNodeI
public final PhylogenyNode getFirstChildNode()
[last modified May 18, 2005 by CMZ]
public final byte getIndicator()
public final PhylogenyNode getLastChildNode()
[last modified May 18, 2005 by CMZ]
public final PhylogenyNode getLink()
public final PhylogenyNode getNextExternalNode()
public final NodeData getNodeData()
public final int getNodeId()
getNodeId
in interface PhylogenyNodeI
public final java.lang.String getNodeName()
getNodeName
in interface PhylogenyNodeI
public final int getNumberOfDescendants()
public final int getNumberOfExternalNodes()
public final int getNumberOfParents()
public final PhylogenyNode getParent()
public final PhylogenyNode getPreviousExternalNode()
public final float getXcoord()
public final float getXSecondary()
public final float getYcoord()
public final float getYSecondary()
public final int hashCode()
hashCode
in class java.lang.Object
public final void initializeData()
(Last modified: 12/20/03)
public final boolean isCollapse()
public final boolean isDuplication()
public final boolean isExternal()
public final boolean isFirstChildNode()
public final boolean isFirstExternalNode()
public final boolean isHasAssignedEvent()
public final boolean isInternal()
public final boolean isLastChildNode()
[last modified June 01, 2005 by CMZ]
public final boolean isLastExternalNode()
public final boolean isRoot()
public final boolean isSpeciation()
public final PhylogenyNodeIterator iterateChildNodesForward()
public void preorderPrint()
public final void removeChildNode(int i)
public final void removeChildNode(PhylogenyNode remove_me)
public final void setBranchData(BranchData branch_data)
public final void setChild1(PhylogenyNode n)
public final void setChild2(PhylogenyNode n)
public final void setChildNode(int i, PhylogenyNode node)
i
- the index of position where to add the childn
- the PhylogenyNode to addpublic final void setCollapse(boolean b)
public final void setDistanceToParent(double d)
setDistanceToParent
in interface PhylogenyNodeI
public final void setIndicator(byte i)
public final void setLink(PhylogenyNode n)
public final void setName(java.lang.String node_name)
setName
in interface PhylogenyNodeI
protected final void setNodeId(int i)
public final void setParent(PhylogenyNode n)
setParent
in interface PhylogenyNodeI
public final void setSumExtNodes(int i)
public final void setXcoord(float x)
public final void setXSecondary(float x_secondary)
public final void setYcoord(float y)
public final void setYSecondary(float y_secondary)
public final java.lang.String toNewHampshire(boolean simple_nh, boolean write_distance_to_parent)
public final java.lang.String toNewHampshireX()
public final java.lang.String toString()
toString
in class java.lang.Object
public static final int getNodeCount()
public static final void setNodeCount(int i)