public abstract class DFSFinishTimeIterator<T> extends Stack<T> implements Iterator<T>
Graph
, return an enumeration of the nodes of the graph in order of increasing
finishing time. This class follows the outNodes of the graph nodes to define the graph, but this behavior can be changed by
overriding the getConnected method.capacityIncrement, elementCount, elementData
modCount
Constructor and Description |
---|
DFSFinishTimeIterator() |
Modifier and Type | Method and Description |
---|---|
protected Iterator<T> |
getConnected(T n)
get the out edges of a given node
|
boolean |
hasNext()
Return whether there are any more nodes left to enumerate.
|
protected void |
init(Graph<T> G,
Iterator<? extends T> nodes)
Subclasses must call this in the constructor!
|
T |
next()
Find the next graph node in finishing time order.
|
void |
remove() |
add, add, addAll, addAll, addElement, capacity, clear, clone, contains, containsAll, copyInto, elementAt, elements, ensureCapacity, equals, firstElement, forEach, get, hashCode, indexOf, indexOf, insertElementAt, isEmpty, iterator, lastElement, lastIndexOf, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeAllElements, removeElement, removeElementAt, removeIf, removeRange, replaceAll, retainAll, set, setElementAt, setSize, size, sort, spliterator, subList, toArray, toArray, toString, trimToSize
finalize, getClass, notify, notifyAll, wait, wait, wait
forEachRemaining
parallelStream, stream
protected void init(Graph<T> G, Iterator<? extends T> nodes)
G
- nodes
- public boolean hasNext()
public T next() throws NoSuchElementException
next
in interface Iterator<T>
NoSuchElementException
protected Iterator<T> getConnected(T n)
n
- the node of which to get the out edgespublic void remove() throws UnimplementedError
remove
in interface Iterator<T>
UnimplementedError
Iterator.remove()