E
- The generic type of the source elements.F
- The generic type of the converted elements.public class ChunkedConvertingIterator<E,F> extends Object implements IChunkedOrderedIterator<F>
IIndex
s.IChunkConverter
DEFAULT_CHUNK_SIZE
Constructor and Description |
---|
ChunkedConvertingIterator(IChunkedOrderedIterator<E> src,
IChunkConverter<E,F> converter)
Ctor when the element type is NOT being changed during conversion.
|
ChunkedConvertingIterator(IChunkedOrderedIterator<E> src,
IChunkConverter<E,F> converter,
IKeyOrder<F> keyOrder)
Variant ctor when you are also converting the element type.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the iterator, releasing any associated resources.
|
protected F[] |
convert(IChunkedOrderedIterator<E> src)
Applies the chunk-at-a-time converter.
|
IKeyOrder<F> |
getKeyOrder()
The natural order in which elements are being visited.
|
boolean |
hasNext() |
F |
next()
The next element available from the iterator.
|
F[] |
nextChunk()
Return the next "chunk" from the iterator.
|
F[] |
nextChunk(IKeyOrder<F> keyOrder)
Return the next "chunk" of elements.
|
void |
remove()
Not supported.
|
public ChunkedConvertingIterator(IChunkedOrderedIterator<E> src, IChunkConverter<E,F> converter)
IKeyOrder
reported by the source
IChunkedOrderedIterator
. This will result in runtime exceptions
if the generic types of the source and converted iterators differ.src
- The source iterator.converter
- The chunk-at-a-time converter.public ChunkedConvertingIterator(IChunkedOrderedIterator<E> src, IChunkConverter<E,F> converter, IKeyOrder<F> keyOrder)
src
- The source iterator.converter
- The chunk-at-a-time converter.keyOrder
- The IKeyOrder
for the converted chunks -or-
null
iff not known.protected F[] convert(IChunkedOrderedIterator<E> src)
hasNext()
.src
- A chunk of elements from the source iterator.public void close()
ICloseableIterator
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.
close
in interface ICloseable
close
in interface ICloseableIterator<F>
public F next()
IChunkedIterator
public IKeyOrder<F> getKeyOrder()
IChunkedOrderedIterator
getKeyOrder
in interface IChunkedOrderedIterator<F>
null
if not known.public F[] nextChunk()
IChunkedIterator
nextChunk
in interface IChunkedIterator<F>
public F[] nextChunk(IKeyOrder<F> keyOrder)
IChunkedOrderedIterator
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.nextChunk
in interface IChunkedOrderedIterator<F>
keyOrder
- The natural order for the elements in the chunk.public void remove()
remove
in interface IChunkedIterator<F>
remove
in interface Iterator<F>
UnsupportedOperationException
- always.Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.