org.opensourcephysics.ejs.control.value
Class Value

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

public abstract class Value
extends java.lang.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:
    Number

    Constructor Summary
    Value()
               
     
    Method Summary
     Value cloneValue()
              Clones one value into another
     void copyValue(Value _source)
              Copies one value into another
    abstract  boolean getBoolean()
              Returns the value of the variable as a boolean
    abstract  double getDouble()
              Returns the value of the variable as a double
    abstract  int getInteger()
              Returns the value of the variable as an int
    abstract  java.lang.Object getObject()
              Returns the value of the variable as an Object.
    abstract  java.lang.String getString()
              Returns the value of the variable as a String
    static Value parseConstant(java.lang.String _input, boolean _silentMode)
               
    static Value parseConstantOrArray(java.lang.String _input, boolean _silentMode)
               
    static java.lang.String removeScapes(java.lang.String str)
               
     java.lang.String toString()
               
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
     

    Constructor Detail

    Value

    public Value()
    Method Detail

    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 java.lang.String getString()
    Returns the value of the variable as a String


    getObject

    public abstract java.lang.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 java.lang.String toString()
    Overrides:
    toString in class java.lang.Object

    parseConstantOrArray

    public static Value parseConstantOrArray(java.lang.String _input,
                                             boolean _silentMode)

    removeScapes

    public static java.lang.String removeScapes(java.lang.String str)

    parseConstant

    public static Value parseConstant(java.lang.String _input,
                                      boolean _silentMode)