org.eclipse.emf.ecore.util
Class EcoreUtil.ContentTreeIterator.ResourcesIterator

java.lang.Object
  extended by org.eclipse.emf.ecore.util.EcoreUtil.ContentTreeIterator.ResourcesIterator
All Implemented Interfaces:
java.util.Iterator<Resource>
Enclosing class:
EcoreUtil.ContentTreeIterator<E>

protected static class EcoreUtil.ContentTreeIterator.ResourcesIterator
extends java.lang.Object
implements java.util.Iterator<Resource>

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.


Field Summary
protected  int index
          The current index of the iterator.
protected  java.util.List<? extends Resource> resources
          The resources to iterator over.
 
Constructor Summary
EcoreUtil.ContentTreeIterator.ResourcesIterator(java.util.List<? extends Resource> resources)
          Constructs an instance.
 
Method Summary
 boolean hasNext()
          Returns whether there might be resources left by the time we next check.
 Resource next()
          Returns the next item, or null if there isn't one.
 boolean reallyHasNext()
          Returns whether there really are any resources left.
 void remove()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

resources

protected java.util.List<? extends Resource> resources
The resources to iterator over.


index

protected int index
The current index of the iterator.

Constructor Detail

EcoreUtil.ContentTreeIterator.ResourcesIterator

public EcoreUtil.ContentTreeIterator.ResourcesIterator(java.util.List<? extends Resource> resources)
Constructs an instance.

Parameters:
resources - the list of resources.
Method Detail

reallyHasNext

public boolean reallyHasNext()
Returns whether there really are any resources left.

Returns:
whether there really are any resources left.

hasNext

public boolean hasNext()
Returns whether there might be resources left by the time we next check. This returns true when the index is equal to the size, because the tree iterator will still be set to yield the last of the contents of the resource, and accessing that may cause another resource to be loaded.

Specified by:
hasNext in interface java.util.Iterator<Resource>
Returns:
whether there might be resources left by the time we next check.

next

public Resource next()
Returns the next item, or null if there isn't one.

Specified by:
next in interface java.util.Iterator<Resource>
Returns:
the next item, or null if there isn't one.

remove

public void remove()
Specified by:
remove in interface java.util.Iterator<Resource>
Throws:
java.lang.UnsupportedOperationException - always.

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