public class AsyncMultiDataSetIterator extends Object implements MultiDataSetIterator
Modifier and Type | Class and Description |
---|---|
protected class |
AsyncMultiDataSetIterator.AsyncPrefetchThread |
Modifier and Type | Field and Description |
---|---|
protected MultiDataSetIterator |
backedIterator |
protected BlockingQueue<MultiDataSet> |
buffer |
protected DataSetCallback |
callback |
protected Integer |
deviceId |
protected AtomicBoolean |
hasDepleted |
protected MultiDataSet |
nextElement |
protected int |
prefetchSize |
protected AtomicBoolean |
shouldWork |
protected MultiDataSet |
terminator |
protected AsyncMultiDataSetIterator.AsyncPrefetchThread |
thread |
protected RuntimeException |
throwable |
protected boolean |
useWorkspaces |
protected String |
workspaceId |
Modifier and Type | Method and Description |
---|---|
boolean |
asyncSupported()
Does this DataSetIterator support asynchronous prefetching of multiple DataSet objects?
Most DataSetIterators do, but in some cases it may not make sense to wrap this iterator in an
iterator that does asynchronous prefetching.
|
protected void |
externalCall() |
MultiDataSetPreProcessor |
getPreProcessor()
Get the
MultiDataSetPreProcessor , if one has previously been set. |
boolean |
hasNext()
Returns
true if the iteration has more elements. |
MultiDataSet |
next()
Returns the next element in the iteration.
|
MultiDataSet |
next(int num)
Like the standard next method but allows a
customizable number of examples returned
|
void |
remove()
Removes from the underlying collection the last element returned
by this iterator (optional operation).
|
void |
reset()
Resets the iterator back to the beginning
|
boolean |
resetSupported()
Is resetting supported by this DataSetIterator? Many DataSetIterators do support resetting,
but some don't
|
void |
setPreProcessor(MultiDataSetPreProcessor preProcessor)
Set the preprocessor to be applied to each MultiDataSet, before each MultiDataSet is returned.
|
void |
shutdown()
This method will terminate background thread AND will destroy attached workspace (if any)
PLEASE NOTE: After shutdown() call, this instance can't be used anymore
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEachRemaining
protected MultiDataSetIterator backedIterator
protected MultiDataSet terminator
protected MultiDataSet nextElement
protected BlockingQueue<MultiDataSet> buffer
protected AsyncMultiDataSetIterator.AsyncPrefetchThread thread
protected AtomicBoolean shouldWork
protected volatile RuntimeException throwable
protected boolean useWorkspaces
protected int prefetchSize
protected String workspaceId
protected DataSetCallback callback
protected Integer deviceId
protected AtomicBoolean hasDepleted
protected AsyncMultiDataSetIterator()
public AsyncMultiDataSetIterator(MultiDataSetIterator baseIterator)
public AsyncMultiDataSetIterator(MultiDataSetIterator iterator, int queueSize, BlockingQueue<MultiDataSet> queue)
public AsyncMultiDataSetIterator(MultiDataSetIterator baseIterator, int queueSize)
public AsyncMultiDataSetIterator(MultiDataSetIterator baseIterator, int queueSize, boolean useWorkspace)
public AsyncMultiDataSetIterator(MultiDataSetIterator baseIterator, int queueSize, boolean useWorkspace, Integer deviceId)
public AsyncMultiDataSetIterator(MultiDataSetIterator iterator, int queueSize, BlockingQueue<MultiDataSet> queue, boolean useWorkspace)
public AsyncMultiDataSetIterator(MultiDataSetIterator iterator, int queueSize, BlockingQueue<MultiDataSet> queue, boolean useWorkspace, DataSetCallback callback)
public AsyncMultiDataSetIterator(MultiDataSetIterator iterator, int queueSize, BlockingQueue<MultiDataSet> queue, boolean useWorkspace, DataSetCallback callback, Integer deviceId)
public MultiDataSet next(int num)
next
in interface MultiDataSetIterator
num
- the number of examplespublic void setPreProcessor(MultiDataSetPreProcessor preProcessor)
setPreProcessor
in interface MultiDataSetIterator
preProcessor
- MultiDataSetPreProcessor. May be null.public MultiDataSetPreProcessor getPreProcessor()
MultiDataSetIterator
MultiDataSetPreProcessor
, if one has previously been set.
Returns null if no preprocessor has been setgetPreProcessor
in interface MultiDataSetIterator
public boolean resetSupported()
resetSupported
in interface MultiDataSetIterator
public boolean asyncSupported()
asyncSupported
in interface MultiDataSetIterator
public void reset()
reset
in interface MultiDataSetIterator
public void shutdown()
public boolean hasNext()
true
if the iteration has more elements.
(In other words, returns true
if next(int)
would
return an element rather than throwing an exception.)hasNext
in interface Iterator<MultiDataSet>
true
if the iteration has more elementspublic MultiDataSet next()
next
in interface Iterator<MultiDataSet>
public void remove()
next(int)
. The behavior of an iterator
is unspecified if the underlying collection is modified while the
iteration is in progress in any way other than by calling this
method.remove
in interface Iterator<MultiDataSet>
UnsupportedOperationException
- if the remove
operation is not supported by this iteratorIllegalStateException
- if the next
method has not
yet been called, or the remove
method has already
been called after the last call to the next
methodprotected void externalCall()
Copyright © 2019. All rights reserved.