|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jebl.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 Graph
node
-
public List<Node> getAdjacencies(Node node)
Graph
getAdjacencies
in interface Graph
node
-
public Edge getEdge(Node node1, Node node2) throws Graph.NoEdgeException
getEdge
in interface Graph
node1
- node2
-
Graph.NoEdgeException
- if the nodes are not directly connected by an edge.public Set<Node> getExternalNodes()
getExternalNodes
in interface Tree
public Set<Node> getInternalNodes()
getInternalNodes
in interface Tree
public Set<Taxon> getTaxa()
getTaxa
in interface Tree
public Taxon getTaxon(Node node)
getTaxon
in interface Tree
node
- the node whose associated taxon is being requested.
public boolean isExternal(Node node)
isExternal
in interface Tree
node
- the node
public boolean isExternal(Edge edge)
edge
- the edge
public Node getNode(Taxon taxon)
getNode
in interface Tree
taxon
- the taxon
public double getEdgeLength(Node node1, Node node2) throws Graph.NoEdgeException
Graph
getEdgeLength
in interface Graph
node1
- node2
-
NoEdgeException
- if the nodes are not directly connected by an edge.
Graph.NoEdgeException
public Node[] getNodes(Edge edge)
getNodes
in interface Graph
edge
-
public Set<Node> getNodes()
getNodes
in interface Graph
public Set<Edge> getEdges()
getEdges
in interface Graph
public Set<Node> getNodes(int degree)
getNodes
in interface Graph
degree
- the number of edges connected to a node
public Set<Edge> getExternalEdges()
getExternalEdges
in interface Tree
public Set<Edge> getInternalEdges()
getInternalEdges
in interface Tree
public void setAttribute(String name, Object value)
Attributable
setAttribute
in interface Attributable
name
- the name of the attribute.value
- the new value of the attribute.public Object getAttribute(String name)
getAttribute
in interface Attributable
name
- the name of the attribute of interest.
public void removeAttribute(String name)
removeAttribute
in interface Attributable
name
- name of attribute to removepublic Set<String> getAttributeNames()
getAttributeNames
in interface Attributable
public 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 |