com.bigdata.service.proxy
Class WrappedRemoteChunkedIterator<E>

java.lang.Object
  extended by com.bigdata.service.proxy.WrappedRemoteChunkedIterator<E>
All Implemented Interfaces:
IChunkedIterator<E>, IChunkedOrderedIterator<E>, ICloseableIterator<E>, Iterator<E>

public class WrappedRemoteChunkedIterator<E>
extends Object
implements IChunkedOrderedIterator<E>

Wraps an IRemoteChunkedIterator so that it looks like an IChunkedOrderedIterator again.

Version:
$Id: WrappedRemoteChunkedIterator.java 2265 2009-10-26 12:51:06Z thompsonbry $
Author:
Bryan Thompson

Field Summary
protected static org.apache.log4j.Logger log
           
 
Fields inherited from interface com.bigdata.striterator.IChunkedIterator
DEFAULT_CHUNK_SIZE
 
Constructor Summary
WrappedRemoteChunkedIterator(IRemoteChunkedIterator<E> src)
           
 
Method Summary
 void close()
          Closes the iterator, releasing any associated resources.
 IKeyOrder<E> getKeyOrder()
          The natural order in which elements are being visited.
 boolean hasNext()
           
 E next()
          The next element available from the iterator.
 E[] nextChunk()
          Return the next "chunk" from the iterator.
 E[] nextChunk(IKeyOrder<E> keyOrder)
          Return the next "chunk" of elements.
 void remove()
          Removes the last element visited by IChunkedIterator.next() (optional operation).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static final org.apache.log4j.Logger log
Constructor Detail

WrappedRemoteChunkedIterator

public WrappedRemoteChunkedIterator(IRemoteChunkedIterator<E> src)
Parameters:
src - The source.
Method Detail

getKeyOrder

public IKeyOrder<E> getKeyOrder()
Description copied from interface: IChunkedOrderedIterator
The natural order in which elements are being visited.

Specified by:
getKeyOrder in interface IChunkedOrderedIterator<E>
Returns:
The natural order in which the elements are being visited -or- null if not known.

hasNext

public boolean hasNext()
Specified by:
hasNext in interface Iterator<E>

next

public E next()
Description copied from interface: IChunkedIterator
The next element available from the iterator.

Specified by:
next in interface IChunkedIterator<E>
Specified by:
next in interface Iterator<E>

nextChunk

public 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.

nextChunk

public E[] nextChunk(IKeyOrder<E> keyOrder)
Description copied from interface: IChunkedOrderedIterator
Return the next "chunk" of elements. The elements will be in the specified order. If IChunkedOrderedIterator.getKeyOrder() would return non-null and the request order corresponds to the value that would be returned by IChunkedOrderedIterator.getKeyOrder() then the elements in the next chunk are NOT sorted. Otherwise the elements in the next chunk are sorted before they are returned. The size of the chunk is up to the implementation.

Specified by:
nextChunk in interface IChunkedOrderedIterator<E>
Parameters:
keyOrder - The natural order for the elements in the chunk.
Returns:
The next chunk of elements in the specified order.

remove

public void remove()
Description copied from interface: IChunkedIterator
Removes the last element visited by IChunkedIterator.next() (optional operation).

Note: This method is not readily suited for use with IChunkedIterator.nextChunk() since the latter has already visited everything in the chunk and IChunkedIterator.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 IChunkedIterator<E>
Specified by:
remove in interface Iterator<E>
Throws:
UnsupportedOperationException - always.

close

public 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.

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>


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