tribble.archive
Class AbstractDocumentIterator

java.lang.Object
  extended by tribble.archive.AbstractDocumentIterator
All Implemented Interfaces:
java.util.Iterator<AbstractDocument>

public class AbstractDocumentIterator
extends java.lang.Object
implements java.util.Iterator<AbstractDocument>

Abstract generic document set iterator.

An archive document set iterator is an iterator over a collection of archive documents. Such a set is typically the result of a query performed on an archive.

Note: This requires Java 1.5 or later.

Source code:
http://david.tribble.com/src/java/tribble/archive/AbstractDocumentIterator.java
Documentation:
http://david.tribble.com/docs/tribble/archive/AbstractDocumentIterator.html

Since:
2008-04-03
Version:
API 2.0, $Revision: 1.1 $ $Date: 2008/04/03 21:52:56 $
Author:
David R. Tribble (david@tribble.com) Copyright ©2009 by David R. Tribble, all rights reserved.
See Also:
AbstractDocumentSet

Field Summary
protected  int m_modCount
          Modification serial number.
protected  int m_pos
          Current document index within the set.
protected  AbstractDocumentSet m_set
          Parent document set.
 
Constructor Summary
protected AbstractDocumentIterator(AbstractDocumentSet set)
          Constructor.
 
Method Summary
 boolean hasNext()
          Determine if there are any more documents within the document set.
 AbstractDocument next()
          Retrieve the next document within the document set.
 void remove()
          Remove the current document from the document set.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_set

protected AbstractDocumentSet m_set
Parent document set.


m_pos

protected int m_pos
Current document index within the set.


m_modCount

protected int m_modCount
Modification serial number.

Constructor Detail

AbstractDocumentIterator

protected AbstractDocumentIterator(AbstractDocumentSet set)
Constructor.

Parameters:
set - Parent document set for which this iterator was created.
Since:
API 2.0, 2008-04-03
Method Detail

hasNext

public boolean hasNext()
Determine if there are any more documents within the document set.

Specified by:
hasNext in interface java.util.Iterator<AbstractDocument>
Returns:
True if one or more documents remain within the document set, false otherwise.
Throws:
java.io.IOException - Thrown if an error occurred while accessing the document iterator.
Since:
API 2.0, 2008-04-03

next

public AbstractDocument next()
Retrieve the next document within the document set. Also advances the iterator to the next document in the set.

Note that this method also removes the previous document from the document set, so calling remove() is not necessary. Note also that removed documents do not have their close() methods called, which could leave them in an unstable state.

Specified by:
next in interface java.util.Iterator<AbstractDocument>
Returns:
The next archive document in the set.
Since:
API 2.0, 2008-04-03

remove

public void remove()
            throws java.lang.UnsupportedOperationException,
                   java.lang.IllegalStateException
Remove the current document from the document set.

Note that calling this method is not necessary, since next() automatically removes each document it previously returned. Note also that removed documents do not have their close() methods called, which could leave them in an unstable state.

Specified by:
remove in interface java.util.Iterator<AbstractDocument>
Throws:
java.lang.UnsupportedOperationException - (unchecked) Thrown if this operation is not supported by this iterator.
java.lang.IllegalStateException - (unchecked) Thrown if next() has not been called, or if remove() has already been called on the same item in the set.
Since:
API 2.0, 2008-04-03