|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmessif.objects.util.AbstractObjectIterator<E>
messif.objects.util.ObjectProvidersIterator<E>
E
- the class of the iterated objectspublic class ObjectProvidersIterator<E extends AbstractObject>
This class allows iterating over multiple ObjectProviders. Providers are accessed in the same order as they were passed in the collection. If actualy iterated provider has no next object, next provider (that has object) is selected until whole list of providers is scanned.
Field Summary | |
---|---|
protected AbstractObjectIterator<? extends E> |
currentIterator
Iterator from current provider |
protected E |
currentObject
Stored instance of object returned by the last call to next() |
protected java.util.Queue<ObjectProvider<? extends E>> |
providers
Queue of providers that are waiting to be scanned |
Constructor Summary | |
---|---|
ObjectProvidersIterator(java.util.Collection<ObjectProvider<? extends E>> objectProviders)
Creates a new instance of ObjectProvidersIterator |
Method Summary | |
---|---|
E |
getCurrentObject()
Returns an instance of object returned by the last call to next(). |
boolean |
hasNext()
Returns true if the iteration has more elements. |
E |
next()
Returns the next element in the iteration. |
void |
remove()
Removes from the underlying collection the last element returned by the iterator (optional operation). |
Methods inherited from class messif.objects.util.AbstractObjectIterator |
---|
getCurrentObjectID, getMatchingObjects, getMatchingObjects, getMatchingObjects, getMatchingObjects, getObjectByAnyLocator, getObjectByData, getObjectByID, getObjectByLocator, getObjectByPosition, getRandomObject, getRandomObjects, nextObjectID, provideObjects |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final java.util.Queue<ObjectProvider<? extends E extends AbstractObject>> providers
protected AbstractObjectIterator<? extends E extends AbstractObject> currentIterator
protected E extends AbstractObject currentObject
Constructor Detail |
---|
public ObjectProvidersIterator(java.util.Collection<ObjectProvider<? extends E>> objectProviders)
objectProviders
- The source ObjectProviders that will provide objectsMethod Detail |
---|
public E getCurrentObject() throws java.util.NoSuchElementException
getCurrentObject
in class AbstractObjectIterator<E extends AbstractObject>
java.util.NoSuchElementException
- Exception NoSuchElementException is thrown if next() has not been called yet.public boolean hasNext()
public E next() throws java.util.NoSuchElementException
java.util.NoSuchElementException
- iteration has no more elements.public void remove() throws java.lang.UnsupportedOperationException, java.lang.IllegalStateException
java.lang.UnsupportedOperationException
- if the remove
operation is not supported by this Iterator.
java.lang.IllegalStateException
- if the next method has not
yet been called, or the remove method has already
been called after the last call to the next
method.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |