public class ChunkedWrappedIterator<E> extends Object implements IChunkedOrderedIterator<E>
Iterator
into chunked iterator.DEFAULT_CHUNK_SIZE
Constructor and Description |
---|
ChunkedWrappedIterator(Iterator<E> src)
Create an iterator that reads from the source.
|
ChunkedWrappedIterator(Iterator<E> src,
int chunkSize) |
ChunkedWrappedIterator(Iterator<E> src,
int chunkSize,
Class<? extends E> elementClass) |
ChunkedWrappedIterator(Iterator<E> src,
int chunkSize,
Class<? extends E> elementClass,
IKeyOrder<E> keyOrder,
IElementFilter<E> filter)
Create an iterator that reads from the source.
|
ChunkedWrappedIterator(Iterator<E> src,
int chunkSize,
IKeyOrder<E> keyOrder,
IElementFilter<E> filter) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the iterator, releasing any associated resources.
|
IKeyOrder<E> |
getKeyOrder()
The natural order in which elements are being visited.
|
boolean |
hasNext()
Return
true if there are elements in the source iterator. |
E |
next()
The next element from the source iterator.
|
E[] |
nextChunk()
The next chunk of elements in whatever order the were visited by
next() . |
E[] |
nextChunk(IKeyOrder<E> keyOrder)
Return the next "chunk" of elements.
|
void |
remove()
Delegated to the source iterator.
|
public ChunkedWrappedIterator(Iterator<E> src)
src
- The source iterator.public ChunkedWrappedIterator(Iterator<E> src, int chunkSize, Class<? extends E> elementClass)
public ChunkedWrappedIterator(Iterator<E> src, int chunkSize, IKeyOrder<E> keyOrder, IElementFilter<E> filter)
public ChunkedWrappedIterator(Iterator<E> src, int chunkSize, Class<? extends E> elementClass, IKeyOrder<E> keyOrder, IElementFilter<E> filter)
src
- The source iterator.chunkSize
- The desired chunk size.elementClass
- The class for the array component type (optional, but the
default will use the runtime type of the first element of the
array which can be too restrictive).keyOrder
- The order in which the elements will be visited by the source
iterator if known and null
otherwise.filter
- Optional filter. When non-null
only elements
accepted by the filter will be visited by this 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<E>
public boolean hasNext()
true
if there are elements in the source iterator.public E next()
public E[] nextChunk()
next()
.nextChunk
in interface IChunkedIterator<E>
public void remove()
public IKeyOrder<E> getKeyOrder()
IChunkedOrderedIterator
getKeyOrder
in interface IChunkedOrderedIterator<E>
null
if not known.public E[] nextChunk(IKeyOrder<E> 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<E>
keyOrder
- The natural order for the elements in the chunk.Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.