|
||||||||||
| 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()
|
|
SimpleTree(RootedTree tree)
Make a copy of the given rooted tree. |
|
| Method Summary | |
|---|---|
void |
addEdge(Node node1,
Node node2,
double length)
Add a new edge between two existing nodes. |
Node |
createExternalNode(Taxon taxon)
Creates a new external node with the given taxon. |
Node |
createInternalNode(List<Node> adjacencies)
Once a SimpleTree has been created, the node stucture can be created by calling createExternalNode and createInternalNode. |
List<Node> |
getAdjacencies(Node node)
Returns a list of nodes connected to this node by an edge |
Object |
getAttribute(String name)
|
Map<String,Object> |
getAttributeMap()
Gets the entire attribute map. |
Set<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 |
Set<Edge> |
getEdges()
|
List<Edge> |
getEdges(Node node)
Returns a list of edges connected to this node |
Set<Edge> |
getExternalEdges()
The set of external edges. |
Set<Node> |
getExternalNodes()
|
Set<Edge> |
getInternalEdges()
The set of internal edges. |
Set<Node> |
getInternalNodes()
|
Node |
getNode(Taxon taxon)
|
Set<Node> |
getNodes()
|
Node[] |
getNodes(Edge edge)
Returns an array of 2 nodes which are the nodes at either end of the edge. |
Set<Node> |
getNodes(int degree)
|
Set<Taxon> |
getTaxa()
|
Taxon |
getTaxon(Node node)
|
boolean |
isExternal(Edge edge)
|
boolean |
isExternal(Node node)
|
void |
removeAttribute(String name)
|
void |
setAttribute(String name,
Object value)
Sets an named attribute for this object. |
void |
setEdgeLength(Node node1,
Node node2,
double length)
Set edge distance between two nodes. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SimpleTree()
public SimpleTree(RootedTree tree)
throws Graph.NoEdgeException
tree - a rooted tree
Graph.NoEdgeException| Method Detail |
|---|
public Node createExternalNode(Taxon taxon)
taxon - the taxon associated with this node
public Node createInternalNode(List<Node> adjacencies)
adjacencies - the child nodes of this node
public void setEdgeLength(Node node1,
Node node2,
double length)
node1 - node2 - length -
public void addEdge(Node node1,
Node node2,
double length)
node1 - node2 - length - public List<Edge> getEdges(Node node)
getEdges in interface Graphnode -
public 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 Set<Node> getExternalNodes()
getExternalNodes in interface Treepublic Set<Node> getInternalNodes()
getInternalNodes in interface Treepublic 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 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 Set<Node> getNodes()
getNodes in interface Graphpublic Set<Edge> getEdges()
getEdges in interface Graphpublic Set<Node> getNodes(int degree)
getNodes in interface Graphdegree - the number of edges connected to a node
public Set<Edge> getExternalEdges()
getExternalEdges in interface Treepublic Set<Edge> getInternalEdges()
getInternalEdges in interface Tree
public void setAttribute(String name,
Object value)
Attributable
setAttribute in interface Attributablename - the name of the attribute.value - the new value of the attribute.public Object getAttribute(String name)
getAttribute in interface Attributablename - the name of the attribute of interest.
public void removeAttribute(String name)
removeAttribute in interface Attributablename - name of attribute to removepublic Set<String> getAttributeNames()
getAttributeNames in interface Attributablepublic Map<String,Object> getAttributeMap()
Attributable
getAttributeMap in interface Attributable
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||