|
© 1998-2002 McGraw-Hill | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--structure.Vertex
A private implementation of a vertex for use in graphs. 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 = newVertex(someLabel)
; //...several graph related operations occur if(!v.isVisited()
){ Object label = v.label(); v.visit()
; }
GraphListVertex
,
GraphMatrixVertex
Field Summary | |
protected Object |
label
A label associated with vertex. |
protected boolean |
visited
Whether or not a vertex has been visited. |
Constructor Summary | |
Vertex(Object label)
Construct a vertex with an associated label. |
Method Summary | |
boolean |
equals(Object o)
Returns true iff the labels of two vertices are equal. |
int |
hashCode()
Return a hashcode associated with the vertex. |
boolean |
isVisited()
Determine if the vertex has been visited. |
Object |
label()
Fetch the label associated with vertex. |
void |
reset()
Clears the visited flag. |
String |
toString()
Construct a string representing vertex. |
boolean |
visit()
Test and set the visited flag. |
Methods inherited from class java.lang.Object |
|
Field Detail |
protected Object label
protected boolean visited
Constructor Detail |
public Vertex(Object label)
label
- A label to be associated with vertex.Method Detail |
public Object label()
public boolean visit()
public boolean isVisited()
public void reset()
public boolean equals(Object o)
equals
in class Object
o
- Another vertex.public int hashCode()
hashCode
in class Object
public String toString()
toString
in class Object
|
© 1998-2002 McGraw-Hill | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |