com.yobotics.simulationconstructionset
Class DoubleYoVariable

java.lang.Object
  extended by com.yobotics.simulationconstructionset.YoVariable
      extended by com.yobotics.simulationconstructionset.DoubleYoVariable
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
AlphaBetaFilteredYoVariable, AlphaFilteredYoVariable, AlphaFusedYoVariable, BetaFilteredYoVariable, ButterworthFilteredYoVariable, ButterworthFusedYoVariable, DelayedDoubleYoVariable, FilteredDiscreteVelocityYoVariable, FilteredVelocityYoVariable, HysteresisFilteredYoVariable, InfiniteImpulseResponseFilteredYoVariable, NoisyDoubleYoVariable, RateLimitedYoVariable, SimpleMovingAverageFilteredYoVariable, TimestampedVelocityYoVariable, TwoVariableTransitionFilter

public class DoubleYoVariable
extends YoVariable

Title: Yobotics! Simulation Construction Set

Description: Package for Simulating Dynamic Robots and Mechanisms

YoVariables provide a simple, convenient mechanism for storing and manipulating robot data. While each essentially contains a double value YoVariables are designed for integration into the SCS GUI. Once registered, a variable will automatically become available to the GUI for graphing, modification and other data manipulation. Historical values of all registered YoVariables are stored in the DataBuffer which may be exported for later use.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.yobotics.simulationconstructionset.YoVariable
MAX_LENGTH_SHORT_NAME
 
Constructor Summary
DoubleYoVariable(java.lang.String name, java.lang.String description, YoVariableRegistry registry)
          Creates a new YoVariable with the given name and adds it to the specified registry.
DoubleYoVariable(java.lang.String name, java.lang.String description, YoVariableRegistry registry, double minScaling, double maxScaling)
          Creates a new YoVariable with the given name and adds it to the specified registry.
DoubleYoVariable(java.lang.String name, YoVariableRegistry registry)
          Creates a new YoVariable with the given name and adds it to the specified registry.
 
Method Summary
 void add(double value)
           
 void add(DoubleYoVariable variable)
           
 double getDoubleValue()
          Retrieve the double value of this variable, if not of double type a warning will be printed.
 double getValueAsDouble()
           
 void getValueString(java.lang.StringBuffer stringBuffer)
          Appends the value of this variable to the end of the given StringBuffer.
 void getValueStringFromDouble(java.lang.StringBuffer stringBuffer, double doubleValue)
           
 YoVariableType getYoVariableType()
           
 boolean isNaN()
           
 void mul(double value)
           
 void mul(DoubleYoVariable value)
           
 void set(double value)
          Set the value of this YoVariable.
 void setValueFromDouble(double value)
           
 void sub(double value)
           
 void sub(DoubleYoVariable variable)
           
 java.lang.String toString()
          Retrieves a string representation of this variable.
 boolean valueEquals(double value)
          Check if the value contained by this variable is equal to the given double.
 
Methods inherited from class com.yobotics.simulationconstructionset.YoVariable
addVariableChangedListener, fullNameEndsWithCaseInsensitive, getDescription, getFullNameWithNameSpace, getManualScalingMax, getManualScalingMin, getName, getName, getNameAndValueString, getNameAndValueStringFromDouble, getNameSpace, getNumericValueAsAString, getShortName, getVariableChangedListeners, getYoVariableRegistry, hasSameFullName, notifyVariableChangedListeners, removeAllVariableChangedListeners, removeVariableChangedListener, setManualScalingMinMax
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DoubleYoVariable

public DoubleYoVariable(java.lang.String name,
                        YoVariableRegistry registry)
Creates a new YoVariable with the given name and adds it to the specified registry.

Parameters:
name - name to be used for all references of this variable by SCS
registry - YoVariableRegistry with which this variable is to be registerd
See Also:
YoVariableRegistry

DoubleYoVariable

public DoubleYoVariable(java.lang.String name,
                        java.lang.String description,
                        YoVariableRegistry registry)
Creates a new YoVariable with the given name and adds it to the specified registry. This constructor allows the user to provide a simple description of the variable, which can come in handy when faced with thousands. The description is displayed in the VarPanel component of the GUI.

Parameters:
name - name to be used for all references of this variable by SCS
description - A short description of this variable
registry - YoVariableRegistry with which this variable is to be registered
See Also:
YoVariableRegistry

DoubleYoVariable

public DoubleYoVariable(java.lang.String name,
                        java.lang.String description,
                        YoVariableRegistry registry,
                        double minScaling,
                        double maxScaling)
Creates a new YoVariable with the given name and adds it to the specified registry. This constructor allows the user to provide a simple description of the variable, which can come in handy when faced with thousands. The description is displayed in the VarPanel component of the GUI. This variant also allows the user to specify min and max values for manual scaling of graphs.

Parameters:
name - name to be used for all references of this variable by SCS
description - A short description of this variable
registry - YoVariableRegistry with which this variable is to be registered
minScaling - minimum value for scaling purposes
maxScaling - maximum value for scaling purpouses
See Also:
YoVariableRegistry
Method Detail

toString

public java.lang.String toString()
Retrieves a string representation of this variable. Currently this is only the variable name.

Overrides:
toString in class java.lang.Object
Returns:
String representation

isNaN

public boolean isNaN()

add

public void add(DoubleYoVariable variable)

sub

public void sub(DoubleYoVariable variable)

sub

public void sub(double value)

add

public void add(double value)

mul

public void mul(double value)

mul

public void mul(DoubleYoVariable value)

valueEquals

public boolean valueEquals(double value)
Check if the value contained by this variable is equal to the given double. If not of double type a warning will be printed to the console.

Parameters:
value - double to be compared
Returns:
boolean are they equal?

getDoubleValue

public double getDoubleValue()
Retrieve the double value of this variable, if not of double type a warning will be printed.

Returns:
double value of this

set

public void set(double value)
Set the value of this YoVariable. All four types are represented via the same interal double. If of integer type this value is cast as an int whenever accessed. It represents the ordinal if of enum type. Boolean values are triggered around the 0.5 threshold with < 0.5 being false and greater or equal being true.

Parameters:
value - double value to store

getValueString

public void getValueString(java.lang.StringBuffer stringBuffer)
Appends the value of this variable to the end of the given StringBuffer. This representation is based on variable type.

Specified by:
getValueString in class YoVariable
Parameters:
stringBuffer - StringBuffer to which the value will be appended

getValueStringFromDouble

public void getValueStringFromDouble(java.lang.StringBuffer stringBuffer,
                                     double doubleValue)
Specified by:
getValueStringFromDouble in class YoVariable

getValueAsDouble

public double getValueAsDouble()
Specified by:
getValueAsDouble in class YoVariable

setValueFromDouble

public void setValueFromDouble(double value)
Specified by:
setValueFromDouble in class YoVariable

getYoVariableType

public YoVariableType getYoVariableType()
Specified by:
getYoVariableType in class YoVariable