## org.eclipse.emf.ecore.util
Class EcoreUtil.ContentTreeIterator<E>

    java.lang.Object
      java.util.AbstractCollection<E>
          java.util.AbstractList<E>
              org.eclipse.emf.common.util.AbstractEList<E>
                  org.eclipse.emf.common.util.BasicEList<java.util.Iterator<? extends E>>
                      org.eclipse.emf.common.util.AbstractTreeIterator<E>
                          org.eclipse.emf.ecore.util.EcoreUtil.ContentTreeIterator<E>

All Implemented Interfaces:
  java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<java.util.Iterator<? extends E>>, java.util.Collection<java.util.Iterator<? extends E>>, java.util.Iterator<E>, java.util.List<java.util.Iterator<? extends E>>, java.util.RandomAccess, EList<java.util.Iterator<? extends E>>, TreeIterator<E>

Enclosing class:
  EcoreUtil

    public static class EcoreUtil.ContentTreeIterator<E>

extends AbstractTreeIterator<E>

An iterator over the tree contents of a collection of EObjects, Resources, and ResourceSets. It provides a special iterator for ResourceSet.getResources that is tolerant of growth in the underlying collection which result from demand loaded resources; the iterator will walk these additional resources.

See Also:
  `EcoreUtil.getAllContents(EObject, boolean)`, `EcoreUtil.getAllContents(Resource, boolean)`, `EcoreUtil.getAllContents(ResourceSet, boolean)`, Serialized Form

Nested Class Summary
`protected static class` `EcoreUtil.ContentTreeIterator.ResourcesIterator` A special iterator that's tolerant of growth in the list of resources which can result from demand loading when traversing the tree of contents.

Nested classes/interfaces inherited from class org.eclipse.emf.common.util.BasicEList
`BasicEList.BasicIndexOutOfBoundsException, BasicEList.EIterator<E1>, BasicEList.EListIterator<E1>, BasicEList.FastCompare<E>, BasicEList.NonResolvingEIterator<E1>, BasicEList.NonResolvingEListIterator<E1>, BasicEList.UnmodifiableEList<E>`

Field Summary
`protected boolean` `isResolveProxies` Whether proxies should be resolved.
`protected EcoreUtil.ContentTreeIterator.ResourcesIterator` `resourceSetIterator` The most recently created iterator over a resource set's resources.

Fields inherited from class org.eclipse.emf.common.util.AbstractTreeIterator
`includeRoot, nextPruneIterator, nextRemoveIterator, object`

Fields inherited from class org.eclipse.emf.common.util.BasicEList
`data, size`

Fields inherited from class java.util.AbstractList
`modCount`

Constructor Summary
`protected` `EcoreUtil.ContentTreeIterator(java.util.Collection<?> emfObjects)` Creates an instance for the given collection of objects.
`protected` `EcoreUtil.ContentTreeIterator(java.lang.Object object, boolean isResolveProxies)` Creates an instance for the given collection of objects.

Method Summary
`java.util.Iterator<E>` `getChildren(java.lang.Object object)` Returns an iterator over the children of the given parent object.
`protected java.util.Iterator<? extends EObject>` `getEObjectChildren(EObject eObject)` Returns an iterator over the `children` of the given parent EObject.
`protected java.util.Iterator<E>` `getObjectChildren(java.lang.Object object)` Returns an empty iterator; subclasses may override this method.
`protected java.util.Iterator<EObject>` `getResourceChildren(Resource resource)` Returns an iterator over the `children` of the given parent resource.
`protected java.util.Iterator<Resource>` `getResourceSetChildren(ResourceSet resourceSet)` Returns an iterator over the `children` of the given parent resource set.
`boolean` `hasNext()` Returns the next object and advances the iterator.
`protected boolean` `isResolveProxies()` Returns whether proxies should resolve.

Methods inherited from class org.eclipse.emf.common.util.AbstractTreeIterator
`next, prune, remove`

Methods inherited from class org.eclipse.emf.common.util.BasicEList
`addAllUnique, addAllUnique, addAllUnique, addAllUnique, addUnique, addUnique, assign, basicGet, basicList, clear, clone, contains, data, get, grow, indexOf, isEmpty, lastIndexOf, move, newData, primitiveGet, remove, setData, setUnique, shrink, size, toArray, toArray`

Methods inherited from class org.eclipse.emf.common.util.AbstractEList
`add, add, addAll, addAll, basicIterator, basicListIterator, basicListIterator, canContainNull, didAdd, didChange, didClear, didMove, didRemove, didSet, equalObjects, equals, getDuplicates, getNonDuplicates, hashCode, isUnique, iterator, listIterator, listIterator, move, remove, removeAll, resolve, retainAll, set, toString, useEquals, validate`

Methods inherited from class java.util.AbstractList
`removeRange, subList`

Methods inherited from class java.util.AbstractCollection
`containsAll`

Methods inherited from class java.lang.Object
`finalize, getClass, notify, notifyAll, wait, wait, wait`

Methods inherited from interface java.util.List
`containsAll, subList`

Field Detail

### isResolveProxies

    protected boolean isResolveProxies

  Whether proxies should be resolved.

### resourceSetIterator

    protected EcoreUtil.ContentTreeIterator.ResourcesIterator resourceSetIterator

  The most recently created iterator over a resource set's resources. This iterator needs special handling because it returns `true` for `hasNext()` even when the list is exhausted. This ensures that any growth in the resources list will not be overlooked.

Constructor Detail

### EcoreUtil.ContentTreeIterator

    protected EcoreUtil.ContentTreeIterator(java.util.Collection<?> emfObjects)

  Creates an instance for the given collection of objects.

  Parameters:
    `emfObjects` - the collection of objects to iterate over.

### EcoreUtil.ContentTreeIterator

    protected EcoreUtil.ContentTreeIterator(java.lang.Object object,
                                            boolean isResolveProxies)

  Creates an instance for the given collection of objects.

  Parameters:
    `object` - the collection of objects to iterate over.
    `isResolveProxies` - whether proxies should be resolved during the traversal.

Method Detail

### getChildren

    public java.util.Iterator<E> getChildren(java.lang.Object object)

  Returns an iterator over the children of the given parent object.

  Specified by:
    `getChildren` in class `AbstractTreeIterator<E>`
  Parameters:
    `object` - the parent object.
  Returns:
    the children iterator.

### getEObjectChildren

    protected java.util.Iterator<? extends EObject> getEObjectChildren(EObject eObject)

  Returns an iterator over the `children` of the given parent EObject.

  Parameters:
    `eObject` - the parent object.
  Returns:
    the children iterator.

### isResolveProxies

    protected boolean isResolveProxies()

  Returns whether proxies should resolve.

  Returns:
    whether proxies should resolve.

### getResourceChildren

    protected java.util.Iterator<EObject> getResourceChildren(Resource resource)

  Returns an iterator over the `children` of the given parent resource.

  Parameters:
    `resource` - the parent resource.
  Returns:
    the children iterator.

### hasNext

    public boolean hasNext()

  Returns the next object and advances the iterator. This override handles the `resourceSetIterator` in a special way, i.e., it skips the null object that iterator yields as the last fake item of the list.

  Specified by:
    `hasNext` in interface `java.util.Iterator<E>`
  Overrides:
    `hasNext` in class `AbstractTreeIterator<E>`
  Returns:
    the next object.

### getResourceSetChildren

    protected java.util.Iterator<Resource> getResourceSetChildren(ResourceSet resourceSet)

  Returns an iterator over the `children` of the given parent resource set. It also records the result in `resourceSetIterator` for special handling in `hasNext()`.

  Parameters:
    `resourceSet` - the parent resource set.
  Returns:
    the children iterator.

### getObjectChildren

    protected java.util.Iterator<E> getObjectChildren(java.lang.Object object)

  Returns an empty iterator; subclasses may override this method.

  Parameters:
    `object` - the parent object.
  Returns:
    the children iterator.

Copyright 2001-2006 IBM Corporation and others. All Rights Reserved.