|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--container.HashDecorable
|
+--graph.StoredVertex
A straightforward implementation of the Vertex interface. Other implementations are possible. This class may be extended. For example, in an adjacency-list implementation of a graph, each vertex must also store its incident edges.
| Field Summary | |
(package private) java.lang.Object |
element
Element stored at this vertex. |
| Fields inherited from class container.HashDecorable |
m |
| Constructor Summary | |
StoredVertex(java.lang.Object o)
Construct a new vertex storing object o. |
|
| Method Summary | |
java.lang.Object |
element()
Get the element at this position. |
void |
replaceElement(java.lang.Object o)
Replace the element at this position. |
java.lang.String |
toString()
A printable representation of this vertex, such as [vertex @12345 - xyz]. |
| Methods inherited from class container.HashDecorable |
get, has, put, remove |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface container.Decorable |
get, has, put, remove |
| Field Detail |
java.lang.Object element
| Constructor Detail |
public StoredVertex(java.lang.Object o)
| Method Detail |
public java.lang.Object element()
element in interface Positionpublic void replaceElement(java.lang.Object o)
public java.lang.String toString()
The @12345 part is computed from the vertex's hash code, just as in Object.toString(). It serves to distinguish multiple distinct vertices that might happen to store the same element (e.g., "xyz"). Also, it won't change if we call replaceElement().
toString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||