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
           
 
Field Summary
 KeyPoints keyPoints
           
static int MAX_LENGTH_SHORT_NAME
           
 
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<YoVariable> variables)
           
 void applyDataProcessingFunction(DataProcessingFunction dataProcessingFunction)
           
 boolean atInPoint()
           
 boolean atOutPoint()
           
 void attachIndexChangedListener(IndexChangedListener indexChangedListener)
           
 void attachSimulationRewoundListener(SimulationRewoundListener simulationRewoundListener)
           
 void attachSimulationRewoundListeners(java.util.ArrayList<SimulationRewoundListener> simulationRewoundListeners)
           
 void changeBufferSize(int newBufferSize)
           
 boolean checkIfDataIsEqual(DataBuffer dataBuffer, double epsilon)
           
 void clearAll(int nPoints)
           
 void closeAndDispose()
           
 void copyValuesThrough()
           
 void cropData()
           
 void cropData(int start, int end)
           
 int getBufferInOutLength()
           
 int getBufferSize()
           
 java.util.ArrayList<DataBufferEntry> 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<YoVariable> getVariables()
           
 java.util.ArrayList<YoVariable> getVariablesThatContain(java.lang.String searchString, boolean caseSensitive, java.util.ArrayList<YoVariable> currentlyMatched)
           
 java.util.ArrayList<YoVariable> getVariablesThatStartWith(java.lang.String searchString)
           
 java.util.ArrayList<YoVariable> getVariablesThatStartWith(java.lang.String searchString, boolean caseSensitive)
           
 java.util.ArrayList<YoVariable> getVars(java.lang.String[] varNames, java.lang.String[] regularExpressions)
           
 java.util.ArrayList<YoVariable> getVarsFromGroup(java.lang.String varGroupName, VarGroupList varGroupList)
           
 boolean getWrapBuffer()
           
 void goToInPoint()
           
 void goToOutPoint()
           
 boolean isKeyPointToggled()
           
 void nextCameraKeyPoint(Camera camera)
           
 void packData()
           
 void packData(int start)
           
 void previousCameraKeyPoint(Camera camera)
           
 void removeCameraKeyPoint(Camera camera)
           
 void resetDataBuffer()
           
 java.util.ArrayList<YoVariable> search(java.lang.String searchText)
           
 void setCameraKeyPoint(Camera camera)
           
 void setIndex(int index)
           
 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 toggleCameraKeyPoint(Camera camera)
           
 void toggleKeyPoint()
           
 boolean updateAndTick(int n)
           
 
Methods inherited from class com.yobotics.simulationconstructionset.YoVariableHolderImplementation
addVariablesToHolder, addVariableToHolder, getAllVariables, getAllVariablesArray, getVariable, getVariable, getVariables, getVariables, getVariables, getVariableUsingFullNamespace, hasUniqueVariable, hasUniqueVariable
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_LENGTH_SHORT_NAME

public static final int MAX_LENGTH_SHORT_NAME
See Also:
Constant Field Values

keyPoints

public KeyPoints keyPoints
Constructor Detail

DataBuffer

public DataBuffer()

DataBuffer

public DataBuffer(int bufferSize)
Method Detail

closeAndDispose

public void closeAndDispose()

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<YoVariable> 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,
                                                               java.util.ArrayList<YoVariable> currentlyMatched)

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<DataBufferEntry> getEntries()

getVariables

public java.util.ArrayList<YoVariable> getVariables()

getVars

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

getVarsFromGroup

public java.util.ArrayList<YoVariable> 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.

resetDataBuffer

public void resetDataBuffer()

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()

setCameraKeyPoint

public void setCameraKeyPoint(Camera camera)

removeCameraKeyPoint

public void removeCameraKeyPoint(Camera camera)

nextCameraKeyPoint

public void nextCameraKeyPoint(Camera camera)

previousCameraKeyPoint

public void previousCameraKeyPoint(Camera camera)

getKeyPoints

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

setIndex

public void setIndex(int index)

attachSimulationRewoundListeners

public void attachSimulationRewoundListeners(java.util.ArrayList<SimulationRewoundListener> simulationRewoundListeners)

attachSimulationRewoundListener

public void attachSimulationRewoundListener(SimulationRewoundListener simulationRewoundListener)

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()

toggleCameraKeyPoint

public void toggleCameraKeyPoint(Camera camera)

getNextTime

public int getNextTime()

getPreviousTime

public int getPreviousTime()

getVariablesThatStartWith

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

search

public java.util.ArrayList<YoVariable> search(java.lang.String searchText)

checkIfDataIsEqual

public boolean checkIfDataIsEqual(DataBuffer dataBuffer,
                                  double epsilon)