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)
           
 void decrement()
           
 int getIntegerValue()
          Retrieve the integer representation of this variable.
 void getValue(java.lang.StringBuffer stringBuffer)
          Appends the value of this variable to the end of the given StringBuffer.
 double getValueAsDouble()
           
 YoVariableType getYoVariableType()
           
 void increment()
           
 void set(int value)
          Set the value of this YoVariable.
 void setFinal(int value)
           
 void setValueFromDouble(double value)
           
 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, fullNameEndsWith, getDescription, getFullNameWithNameSpace, getManualScalingMax, getManualScalingMin, getName, getName, getNameAndValue, 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 value)
Specified by:
setValueFromDouble in class YoVariable

getValueAsDouble

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

toString

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

getValue

public void getValue(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:
getValue in class YoVariable
Parameters:
stringBuffer - StringBuffer to which the value will be appended

getYoVariableType

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