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

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

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

Provides a bridge between Search and AbstractObjectIterator. This iterator will go always one object forward then one object backward from the initial object of the search.


Field Summary
 
Fields inherited from class messif.buckets.index.SearchAbstractObjectIterator
hasNext, search
 
Constructor Summary
SearchAbstractObjectDualIterator(Search<T> search)
          Creates a new instance of SearchAbstractObjectIterator for the specified Search instance.
SearchAbstractObjectDualIterator(Search<T> search, int limit)
          Creates a new instance of SearchAbstractObjectIterator for the specified Search instance.
 
Method Summary
 T getCurrentObject()
          Returns an object returned by the last call to Iterator.next().
 boolean hasNext()
           
 
Methods inherited from class messif.buckets.index.SearchAbstractObjectIterator
getCount, getLimit, isLimitReached, next, 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
 

Constructor Detail

SearchAbstractObjectDualIterator

public SearchAbstractObjectDualIterator(Search<T> search,
                                        int limit)
                                 throws java.lang.CloneNotSupportedException
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)
Throws:
java.lang.CloneNotSupportedException - if there was an error clonning the search

SearchAbstractObjectDualIterator

public SearchAbstractObjectDualIterator(Search<T> search)
                                 throws java.lang.CloneNotSupportedException
Creates a new instance of SearchAbstractObjectIterator for the specified Search instance. Number of iterations is not limited.

Parameters:
search - the Search instance to wrap by this iterator
Throws:
java.lang.CloneNotSupportedException - if there was an error clonning the search
Method Detail

getCurrentObject

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

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

hasNext

public boolean hasNext()
Specified by:
hasNext in interface java.util.Iterator<T extends LocalAbstractObject>
Overrides:
hasNext in class SearchAbstractObjectIterator<T extends LocalAbstractObject>