com.bigdata.striterator
Class ChunkedStriterator<I extends IChunkedIterator<E>,E>

java.lang.Object
  extended by com.bigdata.striterator.Striterator<I,E>
      extended by com.bigdata.striterator.ChunkedStriterator<I,E>
All Implemented Interfaces:
IChunkedIterator<E>, IChunkedStriterator<I,E>, ICloseableIterator<E>, IStriterator<I,E>, Enumeration<E>, Iterator<E>
Direct Known Subclasses:
ChunkedOrderedStriterator, GenericChunkedStriterator

public class ChunkedStriterator<I extends IChunkedIterator<E>,E>
extends Striterator<I,E>
implements IChunkedStriterator<I,E>

Chunked streaming iterator.

Version:
$Id: ChunkedStriterator.java 3672 2010-09-28 23:39:42Z thompsonbry $
Author:
Bryan Thompson
TODO:
Like the ITupleIterator, the IChunkedIterators can be executed on the server and them stream results back to the client. We really need to introduce custom compression for chunk-at-a-time results streamed back from the server. If the filters are to be specified on the client and applied on the server, then an IFilter will be needed to construct the filter stack on the server.

Field Summary
 
Fields inherited from class com.bigdata.striterator.Striterator
realSource, src
 
Fields inherited from interface com.bigdata.striterator.IChunkedIterator
DEFAULT_CHUNK_SIZE
 
Constructor Summary
ChunkedStriterator(I src)
           
ChunkedStriterator(int chunkSize, Iterator<E> src)
          Wraps the source iterator as a chunked iterator.
ChunkedStriterator(Iterator<E> src)
          Wraps the source iterator as a chunked iterator using a default chunk size.
 
Method Summary
 IChunkedStriterator<I,E> addFilter(IFilter<I,?,E> filter)
          Strengthened return type.
 void close()
          Closes the iterator, releasing any associated resources.
 E[] nextChunk()
          Return the next "chunk" from the iterator.
 
Methods inherited from class com.bigdata.striterator.Striterator
addInstanceOfFilter, append, exclude, hasMoreElements, hasNext, makeUnique, map, next, nextElement, remove
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.bigdata.striterator.IChunkedIterator
next, remove
 
Methods inherited from interface java.util.Iterator
hasNext
 
Methods inherited from interface com.bigdata.striterator.IStriterator
addInstanceOfFilter, append
 
Methods inherited from interface java.util.Enumeration
hasMoreElements, nextElement
 

Constructor Detail

ChunkedStriterator

public ChunkedStriterator(I src)

ChunkedStriterator

public ChunkedStriterator(Iterator<E> src)
Wraps the source iterator as a chunked iterator using a default chunk size.

Parameters:
src - The source iterator.

ChunkedStriterator

public ChunkedStriterator(int chunkSize,
                          Iterator<E> src)
Wraps the source iterator as a chunked iterator.

Parameters:
chunkSize - The chunk size.
src - The source iterator.
Method Detail

nextChunk

public final E[] nextChunk()
Description copied from interface: IChunkedIterator
Return the next "chunk" from the iterator.

Specified by:
nextChunk in interface IChunkedIterator<E>
Returns:
The next chunk.

close

public final void close()
Description copied from interface: ICloseableIterator
Closes the iterator, releasing any associated resources. This method MAY be invoked safely if the iterator is already closed. Implementations of this interface MUST invoke ICloseableIterator.close() if Iterator.hasNext() method returns false to ensure that the iterator is closed (and its resources release) as soon as it is exhausted.

Note: Implementations that support Iterator.remove() MUST NOT eagerly close the iterator when it is exhausted since that would make it impossible to remove the last visited statement. Instead they MUST wait for an explicit ICloseableIterator.close() by the application.

Specified by:
close in interface ICloseableIterator<E>

addFilter

public IChunkedStriterator<I,E> addFilter(IFilter<I,?,E> filter)
Strengthened return type.

Specified by:
addFilter in interface IChunkedStriterator<I extends IChunkedIterator<E>,E>
Specified by:
addFilter in interface IStriterator<I extends IChunkedIterator<E>,E>
Overrides:
addFilter in class Striterator<I extends IChunkedIterator<E>,E>
Parameters:
filter - The filter.
Returns:
The filtered iterator.


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