java.lang.Object
org.opensourcephysics.ejs.control.value.Value
Direct Known Subclasses:
BooleanValue, DoubleValue, ExpressionValue, IntegerValue, InterpretedValue, ObjectValue, StringValue

public abstract class Value extends Object
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 Details

    • 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

        public abstract String getString()
        Returns the value of the variable as a String
      • getObject

        public abstract Object getObject()
        Returns the value of the variable as an Object. Ideal for arrays!
      • copyValue

        public void copyValue(Value _source)
        Copies one value into another
      • cloneValue

        public Value cloneValue()
        Clones one value into another
      • toString

        public String toString()
        Overrides:
        toString in class Object
      • parseConstantOrArray

        public static Value parseConstantOrArray(String _input, boolean _silentMode)
      • parseConstant

        public static Value parseConstant(String _input, boolean _silentMode)
        revised for efficiency - BH