public class DataBufferProcessor extends BaseDataProcessor implements DataListener
Data-elements.
Datas are inserted to the buffer using the processDataFrame-method.
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
DATA_LISTENERS |
static java.lang.String |
PROP_BUFFER_SIZE
The maximal size of the buffer in frames.
|
static java.lang.String |
PROP_WAIT_IF_EMPTY
If this property is set
true the buffer will wait for new data until it returns from a
getData-call. |
static java.lang.String |
PROP_WAIT_TIME_MS
The time in milliseconds which will be waited between two attempts to read a data element from the buffer when
being in
waitIfEmpty-mode |
logger| Constructor and Description |
|---|
DataBufferProcessor() |
DataBufferProcessor(int maxBufferSize,
boolean waitIfEmpty,
int waitTime,
java.util.List<? extends Configurable> listeners) |
| Modifier and Type | Method and Description |
|---|---|
void |
addDataListener(DataListener l)
Adds a new listener.
|
void |
clearBuffer() |
java.util.List<Data> |
getBuffer() |
int |
getBufferSize() |
Data |
getData()
Returns the processed Data output.
|
void |
newProperties(PropertySheet ps)
This method is called when this configurable component needs to be reconfigured.
|
void |
processDataFrame(Data data)
This method is invoked when a new
Data object becomes available. |
void |
removeDataListener(DataListener l)
Removes a listener.
|
getPredecessor, initialize, setPredecessorgetName, initLogger, toString@S4Boolean(defaultValue=false) public static final java.lang.String PROP_WAIT_IF_EMPTY
true the buffer will wait for new data until it returns from a
getData-call. Enable this flag if the buffer should serve as starting point for a new
feature-pull-chain..@S4Integer(defaultValue=10) public static final java.lang.String PROP_WAIT_TIME_MS
waitIfEmpty-mode@S4Integer(defaultValue=50000) public static final java.lang.String PROP_BUFFER_SIZE
@S4ComponentList(type=Configurable.class, beTolerant=true) public static final java.lang.String DATA_LISTENERS
public DataBufferProcessor(int maxBufferSize,
boolean waitIfEmpty,
int waitTime,
java.util.List<? extends Configurable> listeners)
maxBufferSize - The maximal size of the buffer in frames. The oldest frames will be removed if the buffer grows out of bounds.waitIfEmpty - If this property is set true the buffer will wait for new data until it returns from a
getData-call. Enable this flag if the buffer should serve as starting point for a new
feature-pull-chain.waitTime - The time in milliseconds which will be waited between two attempts to read a data element from the buffer when
being in waitIfEmpty-modelisteners - listeners to get notifiedpublic DataBufferProcessor()
public void newProperties(PropertySheet ps) throws PropertyException
ConfigurablenewProperties in interface ConfigurablenewProperties in class ConfigurableAdapterps - a property sheet holding the new dataPropertyException - if there is a problem with the properties.public void processDataFrame(Data data)
DataListenerData object becomes available.processDataFrame in interface DataListenerdata - feature framepublic Data getData() throws DataProcessingException
getData in interface DataProcessorgetData in class BaseDataProcessorDataProcessingException - if a data processor error occurspublic int getBufferSize()
public void clearBuffer()
public java.util.List<Data> getBuffer()
public void addDataListener(DataListener l)
l - listener to addpublic void removeDataListener(DataListener l)
l - listener to remove