messif.objects.extraction
Class ExtractorIterator<T extends LocalAbstractObject>

java.lang.Object
  extended by messif.objects.util.AbstractObjectIterator<T>
      extended by messif.objects.extraction.ExtractorIterator<T>
Type Parameters:
T - the class of objects returned by this iterator
All Implemented Interfaces:
java.util.Iterator<T>, ObjectProvider<T>

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

Iterator that provides objects by Extractor. The iterator is initialized by given extractor and ExtractorDataSource and returns objects until the extraction fails or an end of the data source is reached.


Constructor Summary
ExtractorIterator(Extractor<? extends T> extractor, ExtractorDataSource dataSource)
          Creates a new instance of ExtractorIterator.
 
Method Summary
 T getCurrentObject()
          Returns an object returned by the last call to Iterator.next().
 boolean hasNext()
           
 T next()
           
 void remove()
           
 void reset()
          Reset the associated data source and restarts the iteration from beginning.
 
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

ExtractorIterator

public ExtractorIterator(Extractor<? extends T> extractor,
                         ExtractorDataSource dataSource)
Creates a new instance of ExtractorIterator.

Parameters:
extractor - the extractor to use for creating objects
dataSource - the data source for the extractor
Method Detail

getCurrentObject

public T getCurrentObject()
                                               throws java.util.NoSuchElementException
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()
Throws:
java.util.NoSuchElementException - if Iterator.next() has not been called yet

hasNext

public boolean hasNext()

next

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

remove

public void remove()

reset

public void reset()
           throws java.io.IOException
Reset the associated data source and restarts the iteration from beginning.

Throws:
java.io.IOException - if there was an I/O error reseting the data source