|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsalvo.jesus.graph.GraphImpl
salvo.jesus.graph.PathImpl
public class PathImpl
An implementation of the Path interface that is a non-simple path. A non-simple path is a Path whereby vertices maybe repeated.
Field Summary | |
---|---|
(package private) java.util.Stack |
vertexStack
Stack of all the vertices in this Path. |
Fields inherited from class salvo.jesus.graph.GraphImpl |
---|
addedgelistener, addvertexlistener, connectedSetS, edges, removeedgelistener, removevertexlistener, traversal, vertices |
Constructor Summary | |
---|---|
PathImpl()
Createas an instance of PathImpl. |
Method Summary | |
---|---|
void |
add(Vertex newVertex)
Adds a Vertex into the Path. |
void |
addEdge(Edge edge)
Adds an Edge into Path if and only if the vertexA property of the Edge being added is the last Vertex added to the path. |
Vertex |
getFirstVertex()
Returns the first Vertex in the Path. |
Vertex |
getLastVertex()
Returns the last Vertex in the Path. |
void |
remove()
Removes the last Vertex that was added in the Path. |
void |
remove(Vertex v)
Throws a NoSuchMethodException as this method is not directly supported by the Path. |
void |
removeEdge(Edge e)
Throws a NoSuchMethodException as this method is not directly supported by the Path. |
void |
removeEdges(Vertex v)
Throws a NoSuchMethodException as this method is not directly supported by the Path. |
java.lang.String |
toString()
Returns a String representation of the Path. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
java.util.Stack vertexStack
Constructor Detail |
---|
public PathImpl()
Method Detail |
---|
public Vertex getFirstVertex()
getFirstVertex
in interface Path
public Vertex getLastVertex()
getLastVertex
in interface Path
public void add(Vertex newVertex) throws java.lang.Exception
This will call Graph.add( Vertex ) only if the Vertex is not yet part of the Graph. Note that this will also automatically add an Edge from the last Vertex that was added to the this Vertex being added.
If adding this new Edge instance is not desired and you want to add an existing Edge instance instead ( i.e.: from an Edge in a Graph ), then you should call addEdge( Edge ) instead.
add
in interface Graph
add
in class GraphImpl
newvertex
- Vertex to be added to the Path
IllegalPathException
java.lang.Exception
public void remove() throws java.lang.Exception
remove
in interface Path
java.lang.Exception
public void addEdge(Edge edge) throws java.lang.Exception
addEdge
in interface Graph
addEdge
in class GraphImpl
edge
- The edge to be added to the Graph.
IllegalPathException
- Thrown when the vertexA
property of the Edge being added is not the last Vertex
in the path.
java.lang.Exception
public void remove(Vertex v) throws java.lang.Exception
remove
in interface Graph
remove
in class GraphImpl
java.lang.NoSuchMethodException
java.lang.Exception
public void removeEdge(Edge e) throws java.lang.Exception
removeEdge
in interface Graph
removeEdge
in class GraphImpl
e
- The Edge object to be removed.
java.lang.NoSuchMethodException
java.lang.Exception
public void removeEdges(Vertex v) throws java.lang.Exception
removeEdges
in interface Graph
removeEdges
in class GraphImpl
v
- Vertex whose Edges are to be removed
java.lang.NoSuchMethodException
java.lang.Exception
public java.lang.String toString()
toString
in class GraphImpl
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |