|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eigenbase.runtime.AbstractTupleIter net.sf.farrago.runtime.FennelAbstractTupleIter
public abstract class FennelAbstractTupleIter
FennelAbstractTupleIter implements the TupleIter
interface by
unmarshalling Fennel tuples from a buffer.
FennelAbstractTupleIter only deals with raw byte buffers; it is the
responsibility of the contained FennelTupleReader
object to unmarshal
individual fields.
Neither does it actually populate the source buffer. This is the
responsibility of the populateBuffer()
method, which must be
implemented by the subclass. The subclass may optionally override the requestData()
method to tell the producer that it is safe to start
producing more data.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.eigenbase.runtime.TupleIter |
---|
TupleIter.NoDataReason, TupleIter.TimeoutException |
Field Summary | |
---|---|
protected byte[] |
bufferAsArray
|
protected ByteBuffer |
byteBuffer
|
private boolean |
endOfData
|
private static FennelTupleAccessor |
tupleAligner
Singleton helper for aligning tuple buffers correctly. |
protected FennelTupleReader |
tupleReader
|
Fields inherited from interface org.eigenbase.runtime.TupleIter |
---|
EMPTY_ITERATOR |
Constructor Summary | |
---|---|
FennelAbstractTupleIter(FennelTupleReader tupleReader)
Creates a new FennelAbstractTupleIter object. |
Method Summary | |
---|---|
Object |
fetchNext()
Returns the next element in the iteration. |
protected String |
getStatus(String prefix)
For subclasses that trace, returns a terse description of the status. |
protected abstract int |
populateBuffer()
Populates the buffer with a new batch of data, and returns the size in bytes. |
protected void |
requestData()
This method is called when the contents of the buffer have been consumed. |
void |
restart()
Restarts this iterator, so that a subsequent call to TupleIter.fetchNext() returns the first element in the collection being
iterated. |
protected void |
traceNext(Object val)
|
private Object |
unmarshal()
|
Methods inherited from class org.eigenbase.runtime.AbstractTupleIter |
---|
setTimeout |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.eigenbase.util.ClosableAllocation |
---|
closeAllocation |
Field Detail |
---|
private static FennelTupleAccessor tupleAligner
protected final FennelTupleReader tupleReader
protected ByteBuffer byteBuffer
protected byte[] bufferAsArray
private boolean endOfData
Constructor Detail |
---|
public FennelAbstractTupleIter(FennelTupleReader tupleReader)
tupleReader
- FennelTupleReader to use to interpret Fennel dataMethod Detail |
---|
protected String getStatus(String prefix)
prefix
- prepended to the resultspublic void restart()
TupleIter
TupleIter.fetchNext()
returns the first element in the collection being
iterated.
restart
in interface TupleIter
restart
in class AbstractTupleIter
public Object fetchNext()
TupleIter
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 TupleIter.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()
.
TupleIter.NoDataReason
.private Object unmarshal()
protected void traceNext(Object val)
protected abstract int populateBuffer()
protected void requestData()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |