com.yobotics.simulationconstructionset
Class DataBuffer

java.lang.Object
  extended by com.yobotics.simulationconstructionset.YoVariableHolderImplementation
      extended by com.yobotics.simulationconstructionset.DataBuffer
All Implemented Interfaces:
YoVariableHolder, java.io.Serializable

public class DataBuffer
extends YoVariableHolderImplementation
implements java.io.Serializable

See Also:
Serialized Form

Nested Class Summary
 class DataBuffer.RepeatDataBufferEntryException
           
 
Constructor Summary
DataBuffer()
           
DataBuffer(int bufferSize)
           
 
Method Summary
 void addDataBufferListener(DataBufferListener dataBufferListener)
           
 void addEntry(DataBufferEntry entry)
           
 void addNewEntry(YoVariable newVariable, int nPoints)
           
 void addVariable(YoVariable newVariable)
           
 void addVariables(java.util.ArrayList variables)
           
 void applyDataProcessingFunction(DataProcessingFunction dataProcessingFunction)
           
 boolean atInPoint()
           
 boolean atOutPoint()
           
 void attachIndexChangedListener(IndexChangedListener indexChangedListener)
           
 void changeBufferSize(int newBufferSize)
           
 void clearAll(int nPoints)
           
 void copyValuesThrough()
           
 void cropData()
           
 void cropData(int start, int end)
           
 int getBufferInOutLength()
           
 int getBufferSize()
           
 java.util.ArrayList getEntries()
           
 DataBufferEntry getEntry(java.lang.String name)
           
 DataBufferEntry getEntry(YoVariable v)
           
 int getIndex()
           
 int getInPoint()
           
 java.util.ArrayList<java.lang.Integer> getKeyPoints()
           
 int getMaxBufferSize()
           
 int getNextTime()
           
 int getOutPoint()
           
 int getPreviousTime()
           
 java.util.ArrayList getVariables()
           
 java.util.ArrayList<YoVariable> getVariablesThatContain(java.lang.String searchString, boolean caseSensitive)
           
 java.util.ArrayList<YoVariable> getVariablesThatStartWith(java.lang.String searchString)
           
 java.util.ArrayList getVars(java.lang.String[] varNames, java.lang.String[] regularExpressions)
           
 java.util.ArrayList getVarsFromGroup(java.lang.String varGroupName, VarGroupList varGroupList)
           
 boolean getWrapBuffer()
           
 void goToInPoint()
           
 void goToOutPoint()
           
 boolean isKeyPointToggled()
           
 void packData()
           
 void packData(int start)
           
 void setIndex(int idx)
           
 void setInPoint()
           
 void setInPoint(int in)
           
 void setKeyPoint()
           
 void setMaxBufferSize(int newMaxBufferSize)
          Sets the maximum size, in ticks, to which the buffer will expand.
 void setOutPoint()
           
 void setOutPoint(int out)
           
 void setWrapBuffer(boolean newWrapBuffer)
          Enables or disables buffer wrapping in place of buffer expansion.
 boolean tick(int n)
          This method attempts to step the index n points.
 void tickAndUpdate()
           
 void toggleKeyPoint()
           
 boolean updateAndTick(int n)
           
 
Methods inherited from class com.yobotics.simulationconstructionset.YoVariableHolderImplementation
addVariablesToHolder, addVariableToHolder, getAllVariables, getAllVariablesArray, getVariable, getVariable, getVariables, getVariables, getVariables, hasUniqueVariable, hasUniqueVariable
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataBuffer

public DataBuffer()

DataBuffer

public DataBuffer(int bufferSize)
Method Detail

getBufferSize

public int getBufferSize()

getMaxBufferSize

public int getMaxBufferSize()

getWrapBuffer

public boolean getWrapBuffer()

addEntry

public void addEntry(DataBufferEntry entry)

addNewEntry

public void addNewEntry(YoVariable newVariable,
                        int nPoints)
                 throws DataBuffer.RepeatDataBufferEntryException
Throws:
DataBuffer.RepeatDataBufferEntryException

addVariable

public void addVariable(YoVariable newVariable)
                 throws DataBuffer.RepeatDataBufferEntryException
Throws:
DataBuffer.RepeatDataBufferEntryException

addVariables

public void addVariables(java.util.ArrayList variables)
                  throws DataBuffer.RepeatDataBufferEntryException
Throws:
DataBuffer.RepeatDataBufferEntryException

addDataBufferListener

public void addDataBufferListener(DataBufferListener dataBufferListener)

getVariablesThatContain

public java.util.ArrayList<YoVariable> getVariablesThatContain(java.lang.String searchString,
                                                               boolean caseSensitive)

getVariablesThatStartWith

public java.util.ArrayList<YoVariable> getVariablesThatStartWith(java.lang.String searchString)

getEntry

public DataBufferEntry getEntry(java.lang.String name)

getEntry

public DataBufferEntry getEntry(YoVariable v)

getEntries

public java.util.ArrayList getEntries()

getVariables

public java.util.ArrayList getVariables()

getVars

public java.util.ArrayList getVars(java.lang.String[] varNames,
                                   java.lang.String[] regularExpressions)

getVarsFromGroup

public java.util.ArrayList getVarsFromGroup(java.lang.String varGroupName,
                                            VarGroupList varGroupList)

setMaxBufferSize

public void setMaxBufferSize(int newMaxBufferSize)
Sets the maximum size, in ticks, to which the buffer will expand. While nonsense values are not explicitly checked for, they will not cause the buffer to shrink.

Parameters:
newMaxBufferSize - New max buffer size.

setWrapBuffer

public void setWrapBuffer(boolean newWrapBuffer)
Enables or disables buffer wrapping in place of buffer expansion. By default the buffer will expand until it reaches maxBufferSize at which point it will wrap to the beginning. When wrapBuffer is enabled the buffer wraps to the beginning without attempting to expand.

Parameters:
newWrapBuffer - Enable or disable wrap buffer mode.

clearAll

public void clearAll(int nPoints)

changeBufferSize

public void changeBufferSize(int newBufferSize)

copyValuesThrough

public void copyValuesThrough()

getBufferInOutLength

public int getBufferInOutLength()

packData

public void packData()

packData

public void packData(int start)

cropData

public void cropData()

cropData

public void cropData(int start,
                     int end)

getInPoint

public int getInPoint()

getOutPoint

public int getOutPoint()

setInPoint

public void setInPoint()

setOutPoint

public void setOutPoint()

setInPoint

public void setInPoint(int in)

setOutPoint

public void setOutPoint(int out)

goToInPoint

public void goToInPoint()

goToOutPoint

public void goToOutPoint()

atInPoint

public boolean atInPoint()

atOutPoint

public boolean atOutPoint()

setKeyPoint

public void setKeyPoint()

getKeyPoints

public java.util.ArrayList<java.lang.Integer> getKeyPoints()

setIndex

public void setIndex(int idx)

attachIndexChangedListener

public void attachIndexChangedListener(IndexChangedListener indexChangedListener)

getIndex

public int getIndex()

tick

public boolean tick(int n)
This method attempts to step the index n points. If the offset is within the valid data set the function returns false and the index is set to index+n. Otherwise the index is forced to the inPoint or the outPoint depending on which is more appropriate.

Parameters:
n - Number of steps to shift the index, this value can be negative.
Returns:
Indicates whether or not the index was forced to one of the ends.

updateAndTick

public boolean updateAndTick(int n)

tickAndUpdate

public void tickAndUpdate()

applyDataProcessingFunction

public void applyDataProcessingFunction(DataProcessingFunction dataProcessingFunction)

isKeyPointToggled

public boolean isKeyPointToggled()
Returns:

toggleKeyPoint

public void toggleKeyPoint()

getNextTime

public int getNextTime()

getPreviousTime

public int getPreviousTime()