edu.cmu.sphinx.frontend.databranch
Class DataBufferProcessor

java.lang.Object
  extended by edu.cmu.sphinx.frontend.BaseDataProcessor
      extended by edu.cmu.sphinx.frontend.databranch.DataBufferProcessor
All Implemented Interfaces:
DataListener, DataProcessor, Configurable

public class DataBufferProcessor
extends BaseDataProcessor
implements DataListener

A FIFO-buffer for Data-elements.

Datas are inserted to the buffer using the processDataFrame-method.


Field Summary
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 attemtps to read a data-lement from the buffer when being in waitIfEmpty-mode
 
Constructor Summary
DataBufferProcessor()
           
 
Method Summary
 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.
 
Methods inherited from class edu.cmu.sphinx.frontend.BaseDataProcessor
getPredecessor, getTimer, initialize, setPredecessor, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PROP_WAIT_IF_EMPTY

@S4Boolean(defaultValue=false)
public static final 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. Enable this flag if the buffer should serve as starting point for a new feature-pull-chain..

See Also:
Constant Field Values

PROP_WAIT_TIME_MS

@S4Integer(defaultValue=10)
public static final java.lang.String PROP_WAIT_TIME_MS
The time in milliseconds which will be waited between two attemtps to read a data-lement from the buffer when being in waitIfEmpty-mode

See Also:
Constant Field Values

PROP_BUFFER_SIZE

@S4Integer(defaultValue=50000)
public static final java.lang.String PROP_BUFFER_SIZE
The maximal size of the buffer in frames. The oldest frames will be removed if the buffer grows out of bounds.

See Also:
Constant Field Values

DATA_LISTENERS

@S4ComponentList(type=Configurable.class,
                 beTolerant=true)
public static final java.lang.String DATA_LISTENERS
See Also:
Constant Field Values
Constructor Detail

DataBufferProcessor

public DataBufferProcessor()
Method Detail

newProperties

public void newProperties(PropertySheet ps)
                   throws PropertyException
Description copied from interface: Configurable
This method is called when this configurable component needs to be reconfigured.

Specified by:
newProperties in interface Configurable
Overrides:
newProperties in class BaseDataProcessor
Parameters:
ps - a property sheet holding the new data
Throws:
PropertyException - if there is a problem with the properties.

processDataFrame

public void processDataFrame(Data data)
Description copied from interface: DataListener
This method is invoked when a new Data object becomes available.

Specified by:
processDataFrame in interface DataListener

getData

public Data getData()
             throws DataProcessingException
Returns the processed Data output.

Specified by:
getData in interface DataProcessor
Specified by:
getData in class BaseDataProcessor
Returns:
an Data object that has been processed by this DataProcessor
Throws:
DataProcessingException - if a data processor error occurs

getBufferSize

public int getBufferSize()

clearBuffer

public void clearBuffer()

getBuffer

public java.util.List<Data> getBuffer()

addDataListener

public void addDataListener(DataListener l)
Adds a new listener.


removeDataListener

public void removeDataListener(DataListener l)
Removes a listener.