|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--structure.AbstractIterator | +--structure.GraphListAIterator
An adjacent vertex iterator. Adjacent vertices (those on destination of edge, if directed) are considered, but not in any guaranteed order. Typical use:
Graph g = new GraphList(); // ...list gets built up... Iterator ai = g.neighbors(someVertex); while (ai.hasNext()
) { System.out.println(ai.next()
); }
Field Summary | |
protected java.util.Iterator |
edges
|
protected java.lang.Object |
vertex
|
Constructor Summary | |
GraphListAIterator(java.util.Iterator i,
java.lang.Object v)
|
Method Summary | |
java.lang.Object |
get()
Returns the value currently being considered by the AbstractIterator. |
boolean |
hasNext()
Returns true if the iterator has more elements to visit. |
java.lang.Object |
next()
Moves, bumps, or "increments" the iterator along the traversal; returns the next value considered. |
void |
reset()
Reset iterator to the beginning of the structure. |
Methods inherited from class structure.AbstractIterator |
hasMoreElements, nextElement, remove, value |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected java.util.Iterator edges
protected java.lang.Object vertex
Constructor Detail |
public GraphListAIterator(java.util.Iterator i, java.lang.Object v)
i
- v
- Method Detail |
public void reset()
AbstractIterator
Iterator
or
Enumeration
implementation, but some traversals
may allow efficient multi-pass implementations with little
overhead. The user is encouraged to implement this method.
reset
in class AbstractIterator
public boolean hasNext()
AbstractIterator
hasMoreElements
is an
Enumeration
-required call to this method. The user
should override only this method.
hasNext
in interface java.util.Iterator
hasNext
in class AbstractIterator
AbstractIterator.hasMoreElements()
public java.lang.Object next()
AbstractIterator
value
method.
This method is preferred over the nextElement
method.
next
in interface java.util.Iterator
next
in class AbstractIterator
AbstractIterator.hasMoreElements()
,
AbstractIterator.value()
public java.lang.Object get()
AbstractIterator
Iterator
nor
Enumeration
. This method should be implemented,
however, to provide better support for for
-loops.
get
in class AbstractIterator
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |