public abstract class IlvPostorderIterator<E> extends Object implements Iterator<E>
getChildren(E)
that properly
accounts for the type of nodes being traversed.Modifier | Constructor and Description |
---|---|
protected |
IlvPostorderIterator()
Constructs a new
IlvPostorderIterator without initializing it. |
|
IlvPostorderIterator(E root)
Construct a new
IlvPostorderIterator that starts traversing the
subtree of objects that descends from the specified root . |
Modifier and Type | Method and Description |
---|---|
protected abstract Iterator<E> |
getChildren(E parent)
Return an iterator over the child nodes of the specified parent object.
|
boolean |
hasNext()
Returns whether the iteration has more elements.
|
protected void |
init(E root)
Initializes the iterator to traverse the subtree of objects that descends from the
specified
root . |
E |
next()
Returns the next element in the iteration.
|
void |
remove()
Remove from the underlying collection the last activity returned by the
iterator.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEachRemaining
public IlvPostorderIterator(E root)
IlvPostorderIterator
that starts traversing the
subtree of objects that descends from the specified root
.root
- The root of the subtree that the iterator will traverse, or
null
to denote an empty tree leading to an empty iterator.protected IlvPostorderIterator()
IlvPostorderIterator
without initializing it.
This constructor is provided as a convenience for subclasses that must perform
specialized initialization. Therefore, if your iterator implementation invokes this
constructor, you must explicitly invoke the init(E)
method.protected void init(E root)
root
. This method is invoked by the constructor and can be
overridden by subclasses to add additional initialization. Overrides of this method
must call super
.root
- The root of the subtree that the iterator will traverse, or
null
to denote an empty tree leading to an empty iterator.protected abstract Iterator<E> getChildren(E parent)
parent
- The parent object.parent
's children.public boolean hasNext()
true
if next()
would return an element
rather than throwing an exception.)public E next()
next
in interface Iterator<E>
NoSuchElementException
- if the iteration has no more elements.public void remove()
next
.
The method is optional and currently throws an unconditional
UnsupportedOperationException
.
© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.