Class Value
java.lang.Object
org.opensourcephysics.ejs.control.value.Value
- Direct Known Subclasses:
BooleanValue
,DoubleValue
,ExpressionValue
,IntegerValue
,InterpretedValue
,ObjectValue
,StringValue
A
Value
is an object that holds an internal (but public)
variable. This abstract class provides a unified way of acessing the variable
value. The fact the variable is public permits quick access to it.
When using subclasses, it is a good idea to directly access the internal variable or use the correct 'get' method in order to increase speed.
Using Number
is not suitable for two reasons: Number
does not include Strings and Objects
Number
does not allow direct access to the internal variable
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected int
static final int
static final int
static final int
static final int
static final int
static final int
static final BooleanValue
static final ObjectValue
static final BooleanValue
-
Method Summary
Modifier and TypeMethodDescriptionClones one value into anothervoid
Copies one value into anotherabstract boolean
Returns the value of the variable as a booleanabstract double
Returns the value of the variable as a doubleabstract int
Returns the value of the variable as an intabstract Object
Returns the value of the variable as an Object.abstract String
Returns the value of the variable as a Stringint
getType()
static Value
parseConstant
(String _input, boolean _silentMode) revised for efficiency - BHstatic Value
parseConstantOrArray
(String _input, boolean _silentMode) toString()
-
Field Details
-
TYPE_OBJECT
public static final int TYPE_OBJECT- See Also:
-
TYPE_BOOLEAN
public static final int TYPE_BOOLEAN- See Also:
-
TYPE_DOUBLE
public static final int TYPE_DOUBLE- See Also:
-
TYPE_EXPRESSION
public static final int TYPE_EXPRESSION- See Also:
-
TYPE_INTEGER
public static final int TYPE_INTEGER- See Also:
-
TYPE_STRING
public static final int TYPE_STRING- See Also:
-
VALUE_NULL
-
VALUE_FALSE
-
VALUE_TRUE
-
type
protected int type
-
-
Method Details
-
getType
public int getType() -
getBoolean
public abstract boolean getBoolean()Returns the value of the variable as a boolean -
getInteger
public abstract int getInteger()Returns the value of the variable as an int -
getDouble
public abstract double getDouble()Returns the value of the variable as a double -
getString
Returns the value of the variable as a String -
getObject
Returns the value of the variable as an Object. Ideal for arrays! -
copyValue
Copies one value into another -
cloneValue
Clones one value into another -
toString
-
parseConstantOrArray
-
parseConstant
revised for efficiency - BH
-