|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjebl.evolution.trees.SimpleTree
public final class SimpleTree
A basic implementation on an unrooted tree.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface jebl.evolution.graphs.Graph |
|---|
Graph.NoEdgeException, Graph.Utils |
| Constructor Summary | |
|---|---|
SimpleTree()
Tree (to be constructed by subsequent calls). |
|
SimpleTree(Tree tree)
Duplicate a tree. |
|
| Method Summary | |
|---|---|
void |
addEdge(Node node1,
Node node2,
double length)
Add a new edge between two existing (non adjacent yet) nodes. |
Node |
createExternalNode(Taxon taxon)
Creates a new external node with the given taxon. |
Node |
createInternalNode(java.util.List<Node> adjacencies)
Once a SimpleTree has been created, the node stucture can be created by calling createExternalNode and createInternalNode. |
java.util.List<Node> |
getAdjacencies(Node node)
Returns a list of nodes connected to this node by an edge |
java.lang.Object |
getAttribute(java.lang.String name)
|
java.util.Map<java.lang.String,java.lang.Object> |
getAttributeMap()
Gets the entire attribute map. |
java.util.Set<java.lang.String> |
getAttributeNames()
|
Edge |
getEdge(Node node1,
Node node2)
Returns the Edge that connects these two nodes |
double |
getEdgeLength(Node node1,
Node node2)
Returns the length of the edge that connects these two nodes |
java.util.Set<Edge> |
getEdges()
|
java.util.List<Edge> |
getEdges(Node node)
Returns a list of edges connected to this node |
java.util.Set<Edge> |
getExternalEdges()
The set of external edges. |
java.util.Set<Node> |
getExternalNodes()
|
java.util.Set<Edge> |
getInternalEdges()
The set of internal edges. |
java.util.Set<Node> |
getInternalNodes()
|
Node |
getNode(Taxon taxon)
|
java.util.Set<Node> |
getNodes()
|
Node[] |
getNodes(Edge edge)
Returns an array of 2 nodes which are the nodes at either end of the edge. |
java.util.Set<Node> |
getNodes(int degree)
|
java.util.Set<Taxon> |
getTaxa()
|
Taxon |
getTaxon(Node node)
|
boolean |
isExternal(Edge edge)
|
boolean |
isExternal(Node node)
|
void |
removeAttribute(java.lang.String name)
|
void |
renameTaxa(Taxon from,
Taxon to)
|
void |
setAttribute(java.lang.String name,
java.lang.Object value)
Sets an named attribute for this object. |
void |
setEdgeLength(Edge edge,
double length)
Change length of an existing edge. |
void |
setEdgeLength(Node node1,
Node node2,
double length)
Set edge distance between two adjacent nodes. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SimpleTree()
public SimpleTree(Tree tree)
tree - | Method Detail |
|---|
public Node createExternalNode(Taxon taxon)
taxon - the taxon associated with this node
public Node createInternalNode(java.util.List<Node> adjacencies)
adjacencies - the child nodes of this node
public void setEdgeLength(Node node1,
Node node2,
double length)
node1 - node2 - length -
public void setEdgeLength(Edge edge,
double length)
edge - length -
public void addEdge(Node node1,
Node node2,
double length)
node1 - node2 - length - public java.util.List<Edge> getEdges(Node node)
getEdges in interface Graphnode -
public java.util.List<Node> getAdjacencies(Node node)
Graph
getAdjacencies in interface Graphnode -
public Edge getEdge(Node node1,
Node node2)
throws Graph.NoEdgeException
getEdge in interface Graphnode1 - node2 -
Graph.NoEdgeException - if the nodes are not directly connected by an edge.public java.util.Set<Node> getExternalNodes()
getExternalNodes in interface Treepublic java.util.Set<Node> getInternalNodes()
getInternalNodes in interface Treepublic java.util.Set<Taxon> getTaxa()
getTaxa in interface Treepublic Taxon getTaxon(Node node)
getTaxon in interface Treenode - the node whose associated taxon is being requested.
public boolean isExternal(Node node)
isExternal in interface Treenode - the node
public boolean isExternal(Edge edge)
edge - the edge
public Node getNode(Taxon taxon)
getNode in interface Treetaxon - the taxon
public void renameTaxa(Taxon from,
Taxon to)
renameTaxa in interface Tree
public double getEdgeLength(Node node1,
Node node2)
throws Graph.NoEdgeException
Graph
getEdgeLength in interface Graphnode1 - node2 -
NoEdgeException - if the nodes are not directly connected by an edge.
Graph.NoEdgeExceptionpublic Node[] getNodes(Edge edge)
getNodes in interface Graphedge -
public java.util.Set<Node> getNodes()
getNodes in interface Graphpublic java.util.Set<Edge> getEdges()
getEdges in interface Graphpublic java.util.Set<Node> getNodes(int degree)
getNodes in interface Graphdegree - the number of edges connected to a node
public java.util.Set<Edge> getExternalEdges()
getExternalEdges in interface Treepublic java.util.Set<Edge> getInternalEdges()
getInternalEdges in interface Tree
public void setAttribute(java.lang.String name,
java.lang.Object value)
Attributable
setAttribute in interface Attributablename - the name of the attribute.value - the new value of the attribute.public java.lang.Object getAttribute(java.lang.String name)
getAttribute in interface Attributablename - the name of the attribute of interest, or null if the attribute doesn't exist.
public void removeAttribute(java.lang.String name)
removeAttribute in interface Attributablename - name of attribute to removepublic java.util.Set<java.lang.String> getAttributeNames()
getAttributeNames in interface Attributablepublic java.util.Map<java.lang.String,java.lang.Object> getAttributeMap()
Attributable
getAttributeMap in interface Attributable
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||