com.yobotics.simulationconstructionset
Class DataBuffer

java.lang.Object
  extended by com.yobotics.simulationconstructionset.YoVariableHolderImplementation
      extended by com.yobotics.simulationconstructionset.DataBuffer
All Implemented Interfaces:
DataBufferCommandsExecutor, GotoInPointCommandExecutor, GotoOutPointCommandExecutor, ToggleKeyPointModeCommandExecutor, DataEntryHolder, TimeDataHolder, YoVariableHolder, java.io.Serializable

public class DataBuffer
extends YoVariableHolderImplementation
implements java.io.Serializable, DataBufferCommandsExecutor, ToggleKeyPointModeCommandExecutor, TimeDataHolder, DataEntryHolder

See Also:
Serialized Form

Nested Class Summary
 class DataBuffer.RepeatDataBufferEntryException
           
 
Field Summary
 KeyPoints keyPoints
           
static int MAX_LENGTH_SHORT_NAME
           
 java.util.ArrayList<ToggleKeyPointModeCommandListener> toggleKeyPointModeCommandListeners
           
 
Constructor Summary
DataBuffer()
           
DataBuffer(int bufferSize)
           
 
Method Summary
 void addDataBufferListener(DataBufferListener dataBufferListener)
           
 void addEntry(DataBufferEntry entry)
           
 void addVariable(YoVariable newVariable)
           
 void addVariable(YoVariable newVariable, int nPoints)
           
 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()
           
 double[] getTimeData()
           
 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 isIndexBetweenInAndOutPoint(int indexToCheck)
           
 boolean isKeyPointModeToggled()
           
 void nextCameraKeyPoint(TrackingDollyCameraController j3dCameraController)
           
 void packData()
           
 void packData(int start)
           
 void previousCameraKeyPoint(TrackingDollyCameraController j3dCameraController)
           
 void registerToggleKeyPointModeCommandListener(ToggleKeyPointModeCommandListener commandListener)
           
 void removeCameraKeyPoint(TrackingDollyCameraController j3dCameraController)
           
 void resetDataBuffer()
           
 java.util.ArrayList<YoVariable> search(java.lang.String searchText)
           
 void setCameraKeyPoint(TrackingDollyCameraController j3dCameraController)
           
 void setIndex(int index)
           
 void setIndexButDoNotNotifySimulationRewoundListeners(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 ticks)
           
 void tickAndUpdate()
           
 boolean tickButDoNotNotifySimulationRewoundListeners(int ticks)
           
 void toggleCameraKeyPoint(TrackingDollyCameraController camera)
           
 void toggleKeyPointMode()
           
 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

toggleKeyPointModeCommandListeners

public java.util.ArrayList<ToggleKeyPointModeCommandListener> toggleKeyPointModeCommandListeners
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)

addVariable

public void addVariable(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)
Specified by:
getEntry in interface DataEntryHolder

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()
Specified by:
getInPoint in interface DataBufferCommandsExecutor

getOutPoint

public int getOutPoint()
Specified by:
getOutPoint in interface DataBufferCommandsExecutor

setInPoint

public void setInPoint()

setOutPoint

public void setOutPoint()

setInPoint

public void setInPoint(int in)

setOutPoint

public void setOutPoint(int out)

gotoInPoint

public void gotoInPoint()
Specified by:
gotoInPoint in interface GotoInPointCommandExecutor

gotoOutPoint

public void gotoOutPoint()
Specified by:
gotoOutPoint in interface GotoOutPointCommandExecutor

atInPoint

public boolean atInPoint()

atOutPoint

public boolean atOutPoint()

setKeyPoint

public void setKeyPoint()

setCameraKeyPoint

public void setCameraKeyPoint(TrackingDollyCameraController j3dCameraController)

removeCameraKeyPoint

public void removeCameraKeyPoint(TrackingDollyCameraController j3dCameraController)

nextCameraKeyPoint

public void nextCameraKeyPoint(TrackingDollyCameraController j3dCameraController)

previousCameraKeyPoint

public void previousCameraKeyPoint(TrackingDollyCameraController j3dCameraController)

getKeyPoints

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

setIndex

public void setIndex(int index)
Specified by:
setIndex in interface DataBufferCommandsExecutor

setIndexButDoNotNotifySimulationRewoundListeners

public void setIndexButDoNotNotifySimulationRewoundListeners(int index)
Specified by:
setIndexButDoNotNotifySimulationRewoundListeners in interface DataBufferCommandsExecutor

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()
Specified by:
getIndex in interface DataBufferCommandsExecutor

tick

public boolean tick(int ticks)
Specified by:
tick in interface DataBufferCommandsExecutor

tickButDoNotNotifySimulationRewoundListeners

public boolean tickButDoNotNotifySimulationRewoundListeners(int ticks)
Specified by:
tickButDoNotNotifySimulationRewoundListeners in interface DataBufferCommandsExecutor

updateAndTick

public boolean updateAndTick(int n)

tickAndUpdate

public void tickAndUpdate()

applyDataProcessingFunction

public void applyDataProcessingFunction(DataProcessingFunction dataProcessingFunction)

isKeyPointModeToggled

public boolean isKeyPointModeToggled()
Specified by:
isKeyPointModeToggled in interface ToggleKeyPointModeCommandExecutor

toggleKeyPointMode

public void toggleKeyPointMode()
Specified by:
toggleKeyPointMode in interface ToggleKeyPointModeCommandExecutor

registerToggleKeyPointModeCommandListener

public void registerToggleKeyPointModeCommandListener(ToggleKeyPointModeCommandListener commandListener)
Specified by:
registerToggleKeyPointModeCommandListener in interface ToggleKeyPointModeCommandExecutor

toggleCameraKeyPoint

public void toggleCameraKeyPoint(TrackingDollyCameraController 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)

getTimeData

public double[] getTimeData()
Specified by:
getTimeData in interface TimeDataHolder

isIndexBetweenInAndOutPoint

public boolean isIndexBetweenInAndOutPoint(int indexToCheck)
Specified by:
isIndexBetweenInAndOutPoint in interface DataBufferCommandsExecutor