com.bigdata.striterator
Interface IChunkedIterator<E>

Type Parameters:
E - The generic type for the [E]lements visited by the Iterator.
All Superinterfaces:
ICloseableIterator<E>, Iterator<E>
All Known Subinterfaces:
IChunkedOrderedIterator<R>, IChunkedOrderedStriterator<I,E>, IChunkedStriterator<I,E>, IJustificationIterator
All Known Implementing Classes:
BackchainOwlSameAsIterator, BackchainOwlSameAsPropertiesIterator, BackchainOwlSameAsPropertiesPIterator, BackchainOwlSameAsPropertiesPOIterator, BackchainOwlSameAsPropertiesSPIterator, BackchainOwlSameAsPropertiesSPOIterator, BackchainTypeResourceIterator, ChunkConsumerIterator, ChunkedArrayIterator, ChunkedArraysIterator, ChunkedConvertingIterator, ChunkedOrderedStriterator, ChunkedResolvingIterator, ChunkedStriterator, ChunkedWrappedIterator, DelegateChunkedIterator, EmptyChunkedIterator, FullyBufferedJustificationIterator, GenericChunkedOrderedStriterator, GenericChunkedStriterator, JustificationIterator, OwlSameAsPropertiesExpandingIterator, SingleValueChunkedIterator, SPOArrayIterator, WrappedRemoteChunkedIterator

public interface IChunkedIterator<E>
extends ICloseableIterator<E>

An iterator that is able visit items in chunks. The elements in the chunk will be in the same order that they would be visited by Iterator.next(). The size of the chunk is up to the implementation.

Note: Chunked iterators are designed to make it easier to write methods that use the batch APIs but do not require the data that will be visited by the iterator to be fully materialized. You can use nextChunk() instead of Iterator.next() to break down the operation into N chunks, where N is determined dynamically based on how much data the iterator returns in each chunk and how much data there is to be read.

Version:
$Id: IChunkedIterator.java 4468 2011-05-09 13:35:15Z thompsonbry $
Author:
Bryan Thompson
TODO:
verify that all IChunkedIterators are being closed within a finally clause.

Field Summary
static int DEFAULT_CHUNK_SIZE
          The default chunk size.
 
Method Summary
 E next()
          The next element available from the iterator.
 E[] nextChunk()
          Return the next "chunk" from the iterator.
 void remove()
          Removes the last element visited by next() (optional operation).
 
Methods inherited from interface com.bigdata.striterator.ICloseableIterator
close
 
Methods inherited from interface java.util.Iterator
hasNext
 

Field Detail

DEFAULT_CHUNK_SIZE

static final int DEFAULT_CHUNK_SIZE
The default chunk size.

See Also:
Constant Field Values
Method Detail

next

E next()
The next element available from the iterator.

Specified by:
next in interface Iterator<E>
Throws:
NoSuchElementException - if the iterator is exhausted.

nextChunk

E[] nextChunk()
Return the next "chunk" from the iterator.

Returns:
The next chunk.
Throws:
NoSuchElementException - if the iterator is exhausted.

remove

void remove()
Removes the last element visited by next() (optional operation).

Note: This method is not readily suited for use with nextChunk() since the latter has already visited everything in the chunk and remove() would only remove the last item in the chunk. Normally you will want to accumulate items to be removed in a buffer and then submit the buffer to some batch api operation when it overflows. Alternatively, the IRangeQuery.REMOVEALL flag may be used with the source iterator to remove elements from the index as they are visited.

Specified by:
remove in interface Iterator<E>


Copyright © 2006-2012 SYSTAP, LLC. All Rights Reserved.