tribble.repository
Interface DocumentIterator<DocType extends Document>

All Superinterfaces:
java.io.Closeable, java.util.Iterator<DocType>
All Known Implementing Classes:
AbstractDocumentIterator

public interface DocumentIterator<DocType extends Document>
extends java.util.Iterator<DocType>, java.io.Closeable

Abstract generic document set.

A repository document set is a collection of zero or more repository documents. Such a set is typically the result of a query performed on a repository.

Note: This requires Java 1.5 or later.

Source code:
http://david.tribble.com/src/java/tribble/repository/DocumentIterator.java
Documentation:
http://david.tribble.com/docs/tribble/repository/DocumentIterator.html

Since:
2008-04-09
Version:
API 2.0, $Revision: 1.1 $ $Date: 2008/04/09 15:41:01 $
Author:
David R. Tribble (david@tribble.com)
Copyright ©2008 by David R. Tribble, all rights reserved.
Permission is granted to any person or entity except those designated by the United States Department of State as a terrorist or terrorist government or agency, to use and distribute this source code provided that the original copyright notice remains present and unaltered.
See Also:
AbstractDocumentIterator, RepositoryReader

Field Summary
static java.lang.String REV
           
 
Method Summary
 void close()
          Close this document set iterator.
 boolean hasNext()
          Determine if there are any more documents within the document set.
 DocType next()
          Retrieve the next document within the document set.
 void remove()
          Remove the current document from the document set.
 

Field Detail

REV

static final java.lang.String REV
See Also:
Constant Field Values
Method Detail

close

void close()
Close this document set iterator. Deallocates all resources associated with the document set. Any further use of this object will result in exceptions.

Note that this method does not throw any exceptions.

Implementations may allow this method to be called more than once.

Specified by:
close in interface java.io.Closeable
Since:
API 2.0, 2008-04-09

hasNext

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

Specified by:
hasNext in interface java.util.Iterator<DocType extends Document>
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-09

next

DocType 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. Callers of this method should therefore call the close() method for each document returned.

Specified by:
next in interface java.util.Iterator<DocType extends Document>
Returns:
The next repository document in the set.
Since:
API 2.0, 2008-04-09

remove

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<DocType extends Document>
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-09