messif.buckets.index
Class SearchAbstractObjectIterator<T extends LocalAbstractObject>

java.lang.Object
  extended by messif.objects.util.AbstractObjectIterator<T>
      extended by messif.buckets.index.SearchAbstractObjectIterator<T>
Type Parameters:
T - the class of the iterated objects
All Implemented Interfaces:
java.util.Iterator<T>, ObjectProvider<T>
Direct Known Subclasses:
SearchAbstractObjectDualIterator

public class SearchAbstractObjectIterator<T extends LocalAbstractObject>
extends AbstractObjectIterator<T>

Provides a bridge between Search and AbstractObjectIterator.


Field Summary
protected  int hasNext
          Flag for remembering if next() has been called on search and its result
protected  Search<T> search
          Wrapped search instance
 
Constructor Summary
SearchAbstractObjectIterator(Search<T> search)
          Creates a new instance of SearchAbstractObjectIterator for the specified Search instance.
SearchAbstractObjectIterator(Search<T> search, int limit)
          Creates a new instance of SearchAbstractObjectIterator for the specified Search instance.
 
Method Summary
 int getCount()
          Returns the current number of iterations.
 T getCurrentObject()
          Returns an object returned by the last call to Iterator.next().
 int getLimit()
          Returns the maximal number of iterations.
 boolean hasNext()
           
 boolean isLimitReached()
          Returns true if the current number of iterations has reached its maximum.
 T next()
           
 void remove()
           
 
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

search

protected final Search<T extends LocalAbstractObject> search
Wrapped search instance


hasNext

protected int hasNext
Flag for remembering if next() has been called on search and its result

Constructor Detail

SearchAbstractObjectIterator

public SearchAbstractObjectIterator(Search<T> search,
                                    int limit)
Creates a new instance of SearchAbstractObjectIterator for the specified Search instance.

Parameters:
search - the Search instance to wrap by this iterator
limit - limit the number of iterations (zero means unlimited)

SearchAbstractObjectIterator

public SearchAbstractObjectIterator(Search<T> search)
Creates a new instance of SearchAbstractObjectIterator for the specified Search instance.

Parameters:
search - the Search instance to wrap by this iterator
Method Detail

getCount

public int getCount()
Returns the current number of iterations.

Returns:
the current number of iterations

getLimit

public int getLimit()
Returns the maximal number of iterations. Zero means unlimited.

Returns:
the maximal number of iterations

isLimitReached

public final boolean isLimitReached()
Returns true if the current number of iterations has reached its maximum.

Returns:
true if the current number of iterations has reached its maximum

getCurrentObject

public T getCurrentObject()
Description copied from class: AbstractObjectIterator
Returns an object returned by the last call to Iterator.next().

Specified by:
getCurrentObject in class AbstractObjectIterator<T extends LocalAbstractObject>
Returns:
an object returned by the last call to Iterator.next()

hasNext

public boolean hasNext()

next

public T next()
                                   throws java.util.NoSuchElementException
Throws:
java.util.NoSuchElementException

remove

public void remove()
            throws java.lang.UnsupportedOperationException
Throws:
java.lang.UnsupportedOperationException