Interface TupleIter

All Superinterfaces:
All Known Implementing Classes:
AbstractTupleIter, CalcTupleIter, CompoundParallelTupleIter, CompoundTupleIter, CompoundTupleIter.Test.BoxTupleIter, FarragoJavaUdxIterator, FennelAbstractTupleIter, FennelPipeIterator, FennelPipeTupleIter, FennelTransformTupleIter, FennelTupleIter, MedMockTupleIter, NestedLoopCalcTupleIter, RestartableCollectionTupleIter, RestartableIteratorTupleIter, ResultSetTupleIter, TimeoutQueueTupleIterTest.TickIterator

public interface TupleIter
extends ClosableAllocation

TupleIter provides an Iterator-like interface for reading tuple data.

TupleIter replaces the combination of Iterator and RestartableIterator.

Note that calling closeAllocation() closes this iterator, allowing it to release its resources. No further calls to fetchNext() or restart() may be made once the iterator is closed.

$Id: //open/dev/farrago/src/org/eigenbase/runtime/ $
Stephan Zuercher

Nested Class Summary
static class TupleIter.NoDataReason
          NoDataReason provides a reason why no data was returned by a call to fetchNext().
static class TupleIter.TimeoutException
          One way to indicate that fetchNext() timed-out.
Field Summary
static TupleIter EMPTY_ITERATOR
Method Summary
 Object fetchNext()
          Returns the next element in the iteration.
 void restart()
          Restarts this iterator, so that a subsequent call to fetchNext() returns the first element in the collection being iterated.
 boolean setTimeout(long timeout, boolean asUnderflow)
          Sets a timeout for fetchNext(); (optional operation).
Methods inherited from interface org.eigenbase.util.ClosableAllocation

Field Detail


static final TupleIter EMPTY_ITERATOR
Method Detail


Object fetchNext()
Returns the next element in the iteration. If there is no next value, it returns a value from the TupleIter.NoDataReason enumeration indicating why no data was returned.

If this method returns TupleIter.NoDataReason.END_OF_DATA, no further data will be returned by this iterator unless restart() is called.

If this method returns TupleIter.NoDataReason.UNDERFLOW, no data is currently available, but may be come available in the future. It is possible for consecutive calls to return UNDERFLOW and then END_OF_DATA.

The object returned by this method may be re-used for each subsequent call to fetchNext(). In other words, callers must either make certain that the returned value is no longer needed or is copied before any subsequent calls to fetchNext().

the next element in the iteration, or an instance of TupleIter.NoDataReason.


boolean setTimeout(long timeout,
                   boolean asUnderflow)
Sets a timeout for fetchNext(); (optional operation). Not all implementing classes support a timeout. For those that do, this method provides a common interface, For those that do not, the adapter TimeoutQueueTupleIter puts a timeout queue on top.

timeout - in milliseconds. 0 means poll, infinity means block.
asUnderflow - true means indicate timeout by returning TupleIter.NoDataReason.UNDERFLOW; false means throw TupleIter.TimeoutException on a timeout.
true if the timeout was set, false if the implementing class does not support a timeout.


void restart()
Restarts this iterator, so that a subsequent call to fetchNext() returns the first element in the collection being iterated.