public abstract class ProducingDoubleDataSource extends BufferedDoubleDataSource implements Runnable
Modifier and Type | Field and Description |
---|---|
protected ArrayBlockingQueue<Double> |
queue |
buf, dataProcessor, DEFAULT_BUFFERSIZE, readPos, writePos
dataLength, inputSource
NOT_SPECIFIED
Modifier | Constructor and Description |
---|---|
protected |
ProducingDoubleDataSource() |
protected |
ProducingDoubleDataSource(InlineDataProcessor dataProcessor) |
protected |
ProducingDoubleDataSource(long numDataThatWillBeProduced) |
protected |
ProducingDoubleDataSource(long numDataThatWillBeProduced,
InlineDataProcessor dataProcessor) |
Modifier and Type | Method and Description |
---|---|
int |
available()
The number of doubles that can currently be read from this double data source without blocking.
|
boolean |
hasMoreData()
Whether or not any more data can be read from this data source.
|
protected void |
putEndOfStream() |
void |
putOneDataPoint(double value)
The producing thread tries to put ont data item into the queue.
|
protected boolean |
readIntoBuffer(int minLength)
Attempt to get more data from the input source.
|
abstract void |
run()
Subclasses must implement this method such that it produces data and sends it through
putOneDataPoint(double) . |
void |
start() |
bufferSpaceLeft, compact, currentlyInBuffer, getData, increaseBufferSize
getAllData, getData, getData, getDataLength
protected ArrayBlockingQueue<Double> queue
protected ProducingDoubleDataSource()
protected ProducingDoubleDataSource(long numDataThatWillBeProduced)
protected ProducingDoubleDataSource(InlineDataProcessor dataProcessor)
protected ProducingDoubleDataSource(long numDataThatWillBeProduced, InlineDataProcessor dataProcessor)
public void start()
public abstract void run()
putOneDataPoint(double)
.
When all data is sent, the subclass must call putEndOfStream()
exactly once.public void putOneDataPoint(double value)
value
- valueRuntimeException
- runtime exceptionprotected void putEndOfStream()
public boolean hasMoreData()
BufferedDoubleDataSource
hasMoreData
in interface DoubleDataSource
hasMoreData
in class BufferedDoubleDataSource
public int available()
BufferedDoubleDataSource
available
in interface DoubleDataSource
available
in class BufferedDoubleDataSource
protected boolean readIntoBuffer(int minLength)
BufferedDoubleDataSource
readIntoBuffer
in class BufferedDoubleDataSource
minLength
- the amount of data to get from the input sourceCopyright © 2000–2016 DFKI GmbH. All rights reserved.