de.grogra.graph.impl
Class TreeIterator
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<E>
de.grogra.xl.util.ObjectList
de.grogra.graph.impl.TreeIterator
- All Implemented Interfaces:
- ObjectConsumer, VoidToObjectGenerator, java.io.Serializable, java.lang.Cloneable, java.lang.Iterable, java.util.Collection, java.util.Iterator, java.util.List, java.util.RandomAccess
public class TreeIterator
- extends ObjectList
- implements java.util.Iterator
This Iterator
class iterates over all nodes
of the subtree starting at a specified root node. The subtree is spanned
by edges of type Graph.BRANCH_EDGE
or
Graph.SUCCESSOR_EDGE
in forward direction.
- Author:
- Ole Kniemeyer
- See Also:
- Serialized Form
Fields inherited from class java.util.AbstractList |
modCount |
Constructor Summary |
TreeIterator()
Create a new iterator. |
TreeIterator(Node root)
Creates a new iterator iterating over the subtree starting
at root . |
Method Summary |
boolean |
hasNext()
|
java.lang.Object |
next()
|
Node |
nextNode()
Returns the next node of this iterator. |
void |
remove()
|
void |
setRoot(Node root)
Configures this iterator to iterate over the subtree starting
at root . |
Methods inherited from class de.grogra.xl.util.ObjectList |
add, add, addAll, addAll, addAll, addIfNotContained, addInOrder, addInOrder, arraycopy, clear, clear, clone, consume, contains, ensureCapacity, equals, evaluateObject, get, hashCode, indexOf, isEmpty, lastIndexOf, peek, pop, push, push, push, remove, remove, removeAt, set, setSize, size, toArray, toArray, trimToSize, values |
Methods inherited from class java.util.AbstractList |
addAll, iterator, listIterator, listIterator, removeRange, subList |
Methods inherited from class java.util.AbstractCollection |
containsAll, removeAll, retainAll, toString |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.List |
containsAll, removeAll, retainAll |
TreeIterator
public TreeIterator()
- Create a new iterator. It has to be configured by
setRoot(Node)
before it is used.
TreeIterator
public TreeIterator(Node root)
- Creates a new iterator iterating over the subtree starting
at
root
.
- Parameters:
root
- the root node of the subtree
hasNext
public boolean hasNext()
- Specified by:
hasNext
in interface java.util.Iterator
next
public java.lang.Object next()
- Specified by:
next
in interface java.util.Iterator
nextNode
public Node nextNode()
- Returns the next node of this iterator. This is equivalent
to
next()
.
- Returns:
- the next node of this iterator
remove
public void remove()
- Specified by:
remove
in interface java.util.Iterator
setRoot
public void setRoot(Node root)
- Configures this iterator to iterate over the subtree starting
at
root
.
- Parameters:
root
- the root node of the subtree