|
||||||||||
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
salvo.jesus.graph.CyclePathImpl
public class CyclePathImpl
Implementation of CyclePath that ensures that the first and last vertices in the Path forms a cycle.
Field Summary | |
---|---|
private static java.lang.String |
CYCLE_PATH_ALREADY_CLOSED
|
(package private) boolean |
isPathClosed
Reference to whether we have |
(package private) boolean |
lastVertexFormedCycle
Reference if the last Vertex added to the Path formed a cycle. |
(package private) boolean |
lastVertexFormedNonSimplePath
Reference if the last Vertex added to the Path made the path non-simple. |
Fields inherited from class salvo.jesus.graph.PathImpl |
---|
vertexStack |
Fields inherited from class salvo.jesus.graph.GraphImpl |
---|
addedgelistener, addvertexlistener, connectedSetS, edges, removeedgelistener, removevertexlistener, traversal, vertices |
Constructor Summary | |
---|---|
CyclePathImpl()
Creates an instance of CyclePathImpl. |
Method Summary | |
---|---|
void |
add(Vertex newVertex)
Adds a Vertex into the Path. |
void |
addEdge(Edge edge)
Adds an Edge into Path. |
void |
closeCycle()
Method to be called indicating that the Path has been fully specified. |
void |
remove()
Removes the last Vertex that was added in the Path. |
private void |
setFlags(Vertex newVertex)
Sets the stastus of the flags depending on what will be the effect should a specified Vertex is added to the CyclePath. |
private void |
validatePath()
Checks the status of the flags and raise an error if required. |
Methods inherited from class salvo.jesus.graph.PathImpl |
---|
getFirstVertex, getLastVertex, remove, removeEdge, removeEdges, toString |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface salvo.jesus.graph.Path |
---|
getFirstVertex, getLastVertex |
Field Detail |
---|
boolean isPathClosed
boolean lastVertexFormedNonSimplePath
boolean lastVertexFormedCycle
private static final java.lang.String CYCLE_PATH_ALREADY_CLOSED
Constructor Detail |
---|
public CyclePathImpl()
Method Detail |
---|
public void add(Vertex newVertex) throws java.lang.Exception
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 PathImpl
newvertex
- Vertex to be added to the Path
IllegalPathException
- See the error message that
comes with the Exception generated.
java.lang.Exception
public void addEdge(Edge edge) throws java.lang.Exception
addEdge
in interface Graph
addEdge
in class PathImpl
edge
- The edge to be added to the Graph.
IllegalPathException
- See the error message that
comes with the Exception generated.
java.lang.Exception
public void remove() throws java.lang.Exception
remove
in interface Path
remove
in class PathImpl
java.lang.Exception
public void closeCycle() throws IllegalPathException
closeCycle
in interface CyclePath
IllegalPathException
- Thrown when the CyclePath is already
closed or is being closed but is not a cycle.private void validatePath() throws IllegalPathException
IllegalPathException
private void setFlags(Vertex newVertex)
newVertex
- The Vertex that is intended to be added to
the CyclePath.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |