com.yobotics.simulationconstructionset
Class IntegerYoVariable

java.lang.Object
  extended by com.yobotics.simulationconstructionset.YoVariable
      extended by com.yobotics.simulationconstructionset.IntegerYoVariable
All Implemented Interfaces:
java.io.Serializable

public class IntegerYoVariable
extends YoVariable

See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.yobotics.simulationconstructionset.YoVariable
MAX_LENGTH_SHORT_NAME
 
Constructor Summary
IntegerYoVariable(java.lang.String name, java.lang.String description, YoVariableRegistry registry)
           
IntegerYoVariable(java.lang.String name, java.lang.String description, YoVariableRegistry registry, double minScaling, double maxScaling)
           
IntegerYoVariable(java.lang.String name, YoVariableRegistry registry)
           
 
Method Summary
 void add(int value)
           
 int convertFromDoubleToInt(double doubleValue)
           
 void decrement()
           
 int getIntegerValue()
          Retrieve the integer representation of this variable.
 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()
           
 void increment()
           
 void set(int value)
          Set the value of this YoVariable.
 void setFinal(int value)
           
 void setValueFromDouble(double doubleValue)
           
 void subtract(int value)
           
 java.lang.String toString()
           
 boolean valueEquals(int value)
          Check if the value contained by this variable is equal to the given integer.
 
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

IntegerYoVariable

public IntegerYoVariable(java.lang.String name,
                         YoVariableRegistry registry)

IntegerYoVariable

public IntegerYoVariable(java.lang.String name,
                         java.lang.String description,
                         YoVariableRegistry registry,
                         double minScaling,
                         double maxScaling)

IntegerYoVariable

public IntegerYoVariable(java.lang.String name,
                         java.lang.String description,
                         YoVariableRegistry registry)
Method Detail

set

public void set(int 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

increment

public void increment()

decrement

public void decrement()

add

public void add(int value)

subtract

public void subtract(int value)

getIntegerValue

public int getIntegerValue()
Retrieve the integer representation of this variable. If not of integer type a warning will be printed.

Returns:
int value of this

valueEquals

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

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

setFinal

public final void setFinal(int value)

setValueFromDouble

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

convertFromDoubleToInt

public int convertFromDoubleToInt(double doubleValue)

getValueAsDouble

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

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

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

getYoVariableType

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