public abstract class ForwardingRowIterator extends Object implements TransformableRowIterator
TransformableRowIterator
that just delegates all methods to some baseIterator (adapter
pattern). Subclass should override some methods.Modifier and Type | Field and Description |
---|---|
protected TransformableRowIterator |
baseIterator |
Modifier | Constructor and Description |
---|---|
protected |
ForwardingRowIterator(TransformableRowIterator baseIterator) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes any resources, associated with this iterator.
|
TimeAndDimsPointer |
getMarkedPointer()
Returns a pointer to the row, that was the current row when
RowIterator.mark() was called for the last time. |
RowPointer |
getPointer()
Returns a pointer to the current row.
|
boolean |
hasTimeAndDimsChangedSinceMark()
Compares the "memoized" data point from the last
RowIterator.mark() call with the data point, to which RowIterator.getPointer() currently points. |
void |
mark()
"Memoizes" the data point, to which
RowIterator.getPointer() currently points. |
boolean |
moveToNext()
Moves iterator to the next data point.
|
protected final TransformableRowIterator baseIterator
protected ForwardingRowIterator(TransformableRowIterator baseIterator)
public void mark()
RowIterator
RowIterator.getPointer()
currently points. If the last call to TimeAndDimsIterator.moveToNext()
returned false
, the behaviour of this method is undefined, e. g. it may throw a runtime
exception.mark
in interface RowIterator
public TimeAndDimsPointer getMarkedPointer()
TransformableRowIterator
RowIterator.mark()
was called for the last time. This
method always returns the same object, but pointing to different rows after each RowIterator.mark()
call.
This method must not be called before ever calling to TimeAndDimsIterator.moveToNext()
. If the very first call to TimeAndDimsIterator.moveToNext()
returned false
, the behaviour of this method is undefined (it may return a "wrong" pointer,
null, throw an exception, etc.).
This method could be called before the first call to RowIterator.mark()
(it should return the same object as it is
required to return after all subsequent RowIterator.mark()
calls), but the data of the returned pointer should not
be accessed before the first call to RowIterator.mark()
.
This method is used in RowCombiningTimeAndDimsIterator
implementation. getMarkedPointer() returns TimeAndDimsPointer
instead of RowPointer
(like TransformableRowIterator.getPointer()
) merely because RowCombiningTimeAndDimsIterator
doesn't need this method to return anything more specific than TimeAndDimsPointer
.getMarkedPointer
in interface TransformableRowIterator
public boolean hasTimeAndDimsChangedSinceMark()
RowIterator
RowIterator.mark()
call with the data point, to which RowIterator.getPointer()
currently points. Comparison is made in terms of TimeAndDimsPointer.compareTo(org.apache.druid.segment.TimeAndDimsPointer)
contract.
If RowIterator.mark()
has never been called, or the last call to TimeAndDimsIterator.moveToNext()
returned false
, the
behaviour of this method is undefined: it may arbitrarily return true, or false, or throw a runtime exception.hasTimeAndDimsChangedSinceMark
in interface RowIterator
public RowPointer getPointer()
TransformableRowIterator
TimeAndDimsIterator.moveToNext()
call that returns true
.
Other aspects of the behaviour of this method are the same as in the generic RowIterator.getPointer()
contract.getPointer
in interface RowIterator
getPointer
in interface TimeAndDimsIterator
getPointer
in interface TransformableRowIterator
public boolean moveToNext()
TimeAndDimsIterator
TimeAndDimsIterator.getPointer()
.
As long as this method returns true
, TimeAndDimsIterator.getPointer()
could be safely called; after this method
returned false
, this iterator is done, TimeAndDimsIterator.getPointer()
must _not_ be called, and TimeAndDimsIterator.close()
should be called.moveToNext
in interface TimeAndDimsIterator
public void close()
TimeAndDimsIterator
close
in interface Closeable
close
in interface AutoCloseable
close
in interface TimeAndDimsIterator
Copyright © 2011–2021 The Apache Software Foundation. All rights reserved.