public final class PhylogenyNode extends java.lang.Object implements java.lang.Comparable<PhylogenyNode>
Modifier and Type | Class and Description |
---|---|
static class |
PhylogenyNode.NH_CONVERSION_SUPPORT_VALUE_STYLE |
Constructor and Description |
---|
PhylogenyNode()
Default constructor for PhylogenyNode.
|
PhylogenyNode(java.lang.String node_name) |
Modifier and Type | Method and Description |
---|---|
void |
addAsChild(PhylogenyNode node)
Adds PhylogenyNode n to the list of child nodes and sets the _parent of n
to this.
|
int |
calculateDepth() |
double |
calculateDistanceToRoot() |
int |
compareTo(PhylogenyNode o) |
PhylogenyNode |
copyNodeData()
Returns a new PhylogenyNode which has its data copied from this
PhylogenyNode.
|
PhylogenyNode |
copyNodeDataShallow()
Returns a new PhylogenyNode which has the same data as this
PhylogenyNode.
|
static PhylogenyNode |
createInstanceFromNhxString(java.lang.String nhx) |
static PhylogenyNode |
createInstanceFromNhxString(java.lang.String nhx,
NHXParser.TAXONOMY_EXTRACTION taxonomy_extraction) |
static PhylogenyNode |
createInstanceFromNhxString(java.lang.String nhx,
NHXParser.TAXONOMY_EXTRACTION taxonomy_extraction,
boolean replace_underscores) |
boolean |
equals(java.lang.Object o) |
java.util.List<PhylogenyNode> |
getAllDescendants() |
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.
|
long |
getId()
Returns the ID (int) of this PhylogenyNode.
|
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.
|
java.lang.String |
getName() |
PhylogenyNode |
getNextExternalNode()
Returns a refernce to the next external PhylogenyNode of this
PhylogenyNode.
|
PhylogenyNode |
getNextExternalNodeWhileTakingIntoAccountCollapsedNodes() |
static long |
getNodeCount()
Returns the total number of all Nodes created so far.
|
NodeData |
getNodeData() |
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.
|
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() |
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 |
isEmpty() |
boolean |
isExternal()
Checks whether this PhylogenyNode is external (tip).
|
boolean |
isFirstChildNode() |
boolean |
isFirstExternalNode() |
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() |
boolean |
isRoot()
Checks whether this PhylogenyNode is a root.
|
boolean |
isSpeciation() |
void |
preorderPrint()
Prints to the console the subtree originating from this PhylogenyNode in
preorder.
|
void |
removeChildNode(int i) |
void |
removeChildNode(PhylogenyNode remove_me) |
void |
removeConnections() |
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.
|
protected void |
setId(long i)
Sets the Id of this PhylogenyNode to i.
|
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.
|
void |
setParent(PhylogenyNode n)
Sets the _parent PhylogenyNode of this PhylogenyNode to n.
|
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) |
void |
swapChildren()
Swaps the the two childern of a PhylogenyNode node of this Phylogeny.
|
java.lang.String |
toNewHampshire(boolean write_distance_to_parent,
PhylogenyNode.NH_CONVERSION_SUPPORT_VALUE_STYLE svs) |
java.lang.String |
toNewHampshireX()
Converts this PhylogenyNode to a New Hampshire X (NHX) String
representation.
|
java.lang.String |
toString() |
public PhylogenyNode()
public PhylogenyNode(java.lang.String node_name)
public final void addAsChild(PhylogenyNode node)
n
- the PhylogenyNode to addpublic final int calculateDepth()
public final double calculateDistanceToRoot()
public final int compareTo(PhylogenyNode o)
compareTo
in interface java.lang.Comparable<PhylogenyNode>
public final PhylogenyNode copyNodeData()
getLink()
public final PhylogenyNode copyNodeDataShallow()
getLink()
public final boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public final java.util.List<PhylogenyNode> getAllDescendants()
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)
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()
public final PhylogenyNode getFirstChildNode()
[last modified May 18, 2005 by CMZ]
public final long getId()
public final byte getIndicator()
public final PhylogenyNode getLastChildNode()
[last modified May 18, 2005 by CMZ]
public final PhylogenyNode getLink()
public final java.lang.String getName()
public final PhylogenyNode getNextExternalNode()
public final PhylogenyNode getNextExternalNodeWhileTakingIntoAccountCollapsedNodes()
public final NodeData getNodeData()
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 boolean isCollapse()
public final boolean isDuplication()
public boolean isEmpty()
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 void preorderPrint()
public final void removeChildNode(int i)
public final void removeChildNode(PhylogenyNode remove_me)
public void removeConnections()
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)
public final void setIndicator(byte i)
public final void setLink(PhylogenyNode n)
public final void setName(java.lang.String node_name)
public final void setParent(PhylogenyNode n)
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 void swapChildren() throws java.lang.RuntimeException
java.lang.RuntimeException
public final java.lang.String toNewHampshire(boolean write_distance_to_parent, PhylogenyNode.NH_CONVERSION_SUPPORT_VALUE_STYLE svs)
public final java.lang.String toNewHampshireX()
public final java.lang.String toString()
toString
in class java.lang.Object
protected final void setId(long i)
public static PhylogenyNode createInstanceFromNhxString(java.lang.String nhx) throws NHXFormatException, PhyloXmlDataFormatException
public static PhylogenyNode createInstanceFromNhxString(java.lang.String nhx, NHXParser.TAXONOMY_EXTRACTION taxonomy_extraction) throws NHXFormatException, PhyloXmlDataFormatException
public static PhylogenyNode createInstanceFromNhxString(java.lang.String nhx, NHXParser.TAXONOMY_EXTRACTION taxonomy_extraction, boolean replace_underscores) throws NHXFormatException, PhyloXmlDataFormatException
public static final long getNodeCount()