|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--structure.Vertex
|
+--structure.GraphMatrixVertex
A private implementation of a vertex for use in graphs that are internally represented as a Matrix. A vertex is capable of holding a label and has a flag that can be set to mark it as visited.
Typical Usage:
Vertex v = new Vertex(someLabel);
//...several graph related operations occur
if(!v.isVisited()){
Object label = v.label();
v.visit();
}
GraphListVertex,
Vertex| Field Summary | |
protected int |
index
|
protected java.lang.Object |
label
A label associated with vertex. |
protected boolean |
visited
Whether or not a vertex has been visited. |
| Constructor Summary | |
GraphMatrixVertex(java.lang.Object label,
int idx)
|
|
| Method Summary | |
boolean |
equals(java.lang.Object o)
Returns true iff the labels of two vertices are equal. |
int |
hashCode()
Return a hashcode associated with the vertex. |
int |
index()
|
boolean |
isVisited()
Determine if the vertex has been visited. |
java.lang.Object |
label()
Fetch the label associated with vertex. |
void |
reset()
Clears the visited flag. |
java.lang.String |
toString()
Construct a string representing vertex. |
boolean |
visit()
Test and set the visited flag. |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected int index
protected java.lang.Object label
protected boolean visited
| Constructor Detail |
public GraphMatrixVertex(java.lang.Object label,
int idx)
label - idx - | Method Detail |
public int index()
public java.lang.String toString()
Vertex
toString in class Vertexpublic java.lang.Object label()
public boolean visit()
public boolean isVisited()
public void reset()
public boolean equals(java.lang.Object o)
equals in class java.lang.Objecto - Another vertex.
public int hashCode()
hashCode in class java.lang.Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||