org.eclipse.emf.common.util
Class AbstractTreeIterator
java.lang.Object
|
+--java.util.AbstractCollection
|
+--java.util.AbstractList
|
+--org.eclipse.emf.common.util.BasicEList
|
+--org.eclipse.emf.common.util.AbstractTreeIterator
- All Implemented Interfaces:
- java.lang.Cloneable, java.util.Collection, EList, java.util.Iterator, java.util.List, java.io.Serializable, TreeIterator
- Direct Known Subclasses:
- AdapterFactoryEditingDomain.DomainTreeIterator, AdapterFactoryTreeIterator, EcoreUtil.ContentTreeIterator, MappingImpl.MappingTreeIterator
- public abstract class AbstractTreeIterator
- extends BasicEList
- implements TreeIterator
An extensible tree iterator implementation
that iterates over an object, it's children, their children, and so on.
Clients need only implement getChildren
in order to implement a fully functional tree iterator.
- See Also:
- Serialized Form
Field Summary |
protected boolean |
includeRoot
Whether the first call to next returns the initial root object
or begins with the first child of the root object. |
protected java.util.Iterator |
nextPruneIterator
The iterator that would be cut short by a call to prune() . |
protected java.util.Iterator |
nextRemoveIterator
The iterator to which a remove() call will delegated. |
protected java.lang.Object |
object
The root object for which the iteration is initiated. |
Fields inherited from class java.util.AbstractList |
modCount |
Constructor Summary |
AbstractTreeIterator(java.lang.Object object)
Creates an instance that iterates over an object, it's children, their children, and so on. |
AbstractTreeIterator(java.lang.Object object,
boolean includeRoot)
Creates and instance that iterates over an object (but only if includeRoot is true ),
it's children, their children, and so on. |
Method Summary |
protected abstract java.util.Iterator |
getChildren(java.lang.Object object)
Returns the iterator that yields the children of the object. |
boolean |
hasNext()
Returns whether there are more elements. |
java.lang.Object |
next()
Returns the next object and advances the iterator. |
void |
prune()
Prunes the iterator so that it skips over all the nodes below the most recent result of calling next() . |
void |
remove()
Removes the last object returned by next() from the underlying tree;
it's an optional operation. |
Methods inherited from class org.eclipse.emf.common.util.BasicEList |
add, add, addAll, addAll, addAllUnique, addAllUnique, addUnique, addUnique, assign, basicIterator, basicList, basicListIterator, basicListIterator, canContainNull, clear, clone, contains, containsAll, data, didAdd, didChange, didClear, didMove, didRemove, didSet, equalObjects, equals, get, getDuplicates, getNonDuplicates, grow, hashCode, indexOf, isEmpty, isUnique, iterator, lastIndexOf, listIterator, listIterator, move, move, newData, remove, remove, removeAll, resolve, retainAll, set, setData, setUnique, shrink, size, toArray, toArray, toString, useEquals, validate |
Methods inherited from class java.util.AbstractList |
removeRange, subList |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.List |
subList |
includeRoot
protected boolean includeRoot
- Whether the first call to next returns the initial root object
or begins with the first child of the root object.
object
protected java.lang.Object object
- The root object for which the iteration is initiated.
nextPruneIterator
protected java.util.Iterator nextPruneIterator
- The iterator that would be cut short by a call to
prune()
.
nextRemoveIterator
protected java.util.Iterator nextRemoveIterator
- The iterator to which a
remove()
call will delegated.
AbstractTreeIterator
public AbstractTreeIterator(java.lang.Object object)
- Creates an instance that iterates over an object, it's children, their children, and so on.
- Parameters:
object
- the root object of the tree.
AbstractTreeIterator
public AbstractTreeIterator(java.lang.Object object,
boolean includeRoot)
- Creates and instance that iterates over an object (but only if
includeRoot
is true
),
it's children, their children, and so on.
getChildren
protected abstract java.util.Iterator getChildren(java.lang.Object object)
- Returns the iterator that yields the children of the object.
- Parameters:
object
- the object for which children are required.- Returns:
- the iterator that yields the children.
hasNext
public boolean hasNext()
- Returns whether there are more elements.
- Specified by:
hasNext
in interface java.util.Iterator
- Returns:
- whether there are more elements.
next
public java.lang.Object next()
- Returns the next object and advances the iterator.
- Specified by:
next
in interface java.util.Iterator
- Returns:
- the next object.
remove
public void remove()
- Removes the last object returned by
next()
from the underlying tree;
it's an optional operation.
- Specified by:
remove
in interface java.util.Iterator
- Throws:
IllegalStateException
- if next
has not yet been called or has been called only the yield the root object,
or remove
has already been called after the last call to the next
method.
prune
public void prune()
- Prunes the iterator so that it skips over all the nodes below the most recent result of calling
next()
.
- Specified by:
prune
in interface TreeIterator