jdsl.core.ref
Class AMSGraphTree
java.lang.Object
|
+--jdsl.core.ref.AMSGraphTree
- public class AMSGraphTree
- extends java.lang.Object
- implements InspectableGraph, InspectableTree
An AMSGraphTree implements a rooted InspectableTree that is also an
InspectableGraph. No vertex may have an inDegree greater than 1,
and only the root node may have inDegree of 0,
maintaining the parent-child hierarchy of the tree.
One possible modification to this data structure might be to implement
a Forest-Graph.
- Author:
- Andrew Schwerin (schwerin)
| Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
AMSGraphTree
public AMSGraphTree()
newContainer
public Container newContainer()
- Container methods
size
public int size()
isEmpty
public boolean isEmpty()
elements
public java.util.Enumeration elements()
positions
public java.util.Enumeration positions()
- PositionalContainer methods
replace
public java.lang.Object replace(Position p,
java.lang.Object obj)
throws InvalidPositionException
swap
public void swap(Position a,
Position b)
numVertices
public int numVertices()
- InspectableGraph methods
- Specified by:
- numVertices in interface InspectableGraph
numEdges
public int numEdges()
- Specified by:
- numEdges in interface InspectableGraph
vertices
public java.util.Enumeration vertices()
- Specified by:
- vertices in interface InspectableGraph
edges
public java.util.Enumeration edges()
- Specified by:
- edges in interface InspectableGraph
directedEdges
public java.util.Enumeration directedEdges()
- Specified by:
- directedEdges in interface InspectableGraph
undirectedEdges
public java.util.Enumeration undirectedEdges()
- Specified by:
- undirectedEdges in interface InspectableGraph
degree
public int degree(Vertex v)
throws InvalidPositionException
- Specified by:
- degree in interface InspectableGraph
inDegree
public int inDegree(Vertex v)
throws InvalidPositionException
- Specified by:
- inDegree in interface InspectableGraph
outDegree
public int outDegree(Vertex v)
throws InvalidPositionException
- Specified by:
- outDegree in interface InspectableGraph
adjacentVertices
public java.util.Enumeration adjacentVertices(Vertex v)
throws InvalidPositionException
- Specified by:
- adjacentVertices in interface InspectableGraph
inAdjacentVertices
public java.util.Enumeration inAdjacentVertices(Vertex v)
throws InvalidPositionException
- Specified by:
- inAdjacentVertices in interface InspectableGraph
outAdjacentVertices
public java.util.Enumeration outAdjacentVertices(Vertex v)
throws InvalidPositionException
- Specified by:
- outAdjacentVertices in interface InspectableGraph
incidentEdges
public java.util.Enumeration incidentEdges(Vertex v)
throws InvalidPositionException
- Specified by:
- incidentEdges in interface InspectableGraph
inIncidentEdges
public java.util.Enumeration inIncidentEdges(Vertex v)
throws InvalidPositionException
- Specified by:
- inIncidentEdges in interface InspectableGraph
outIncidentEdges
public java.util.Enumeration outIncidentEdges(Vertex v)
throws InvalidPositionException
- Specified by:
- outIncidentEdges in interface InspectableGraph
endVertices
public Vertex[] endVertices(Edge e)
throws InvalidPositionException
- Specified by:
- endVertices in interface InspectableGraph
opposite
public Vertex opposite(Vertex v,
Edge e)
throws InvalidPositionException,
InvalidEdgeException
- Specified by:
- opposite in interface InspectableGraph
origin
public Vertex origin(Edge e)
throws InvalidPositionException,
InvalidEdgeException
- Specified by:
- origin in interface InspectableGraph
destination
public Vertex destination(Edge e)
throws InvalidPositionException,
InvalidEdgeException
- Specified by:
- destination in interface InspectableGraph
isDirected
public boolean isDirected(Edge e)
throws InvalidEdgeException
- Specified by:
- isDirected in interface InspectableGraph
isRoot
public boolean isRoot(Position p)
throws InvalidPositionException,
InvalidContainerException
- InspectableTree methods
- Specified by:
- isRoot in interface InspectableTree
isInternal
public boolean isInternal(Position p)
throws InvalidContainerException,
InvalidPositionException
- Specified by:
- isInternal in interface InspectableTree
isExternal
public boolean isExternal(Position p)
throws InvalidContainerException,
InvalidPositionException
- Specified by:
- isExternal in interface InspectableTree
root
public Position root()
throws InvalidContainerException
- Specified by:
- root in interface InspectableTree
parent
public Position parent(Position p)
throws InvalidContainerException,
InvalidPositionException
- Specified by:
- parent in interface InspectableTree
children
public java.util.Enumeration children(Position p)
throws InvalidPositionException,
InvalidContainerException
- Specified by:
- children in interface InspectableTree
siblings
public java.util.Enumeration siblings(Position p)
throws InvalidContainerException,
InvalidPositionException
- Specified by:
- siblings in interface InspectableTree
insertVertex
public Vertex insertVertex(java.lang.Object info)
- Insertion methods
insertDirectedEdge
public Edge insertDirectedEdge(Vertex v1,
Vertex v2,
java.lang.Object obj)
throws InvalidPositionException,
jdsl.core.ref.InvalidInsertionException
insertRoot
public Position insertRoot(java.lang.Object info)
throws jdsl.core.ref.InvalidInsertionException
insertChild
public Position insertChild(Position parent,
java.lang.Object info)
throws InvalidPositionException
castMutable
public MutablePosition castMutable(Position p)
throws InvalidPositionException
- Casting methods
castVertex
public AMSGTVertex castVertex(Position p)
throws InvalidPositionException
castEdge
public AMSGTEdge castEdge(Position p)
throws InvalidPositionException