Class ExpressionInput.EI

java.lang.Object
edu.hws.jcm.awt.ExpressionInput.EI
All Implemented Interfaces:
Expression, Value, Serializable
Enclosing class:
ExpressionInput

protected class ExpressionInput.EI extends Object implements Expression
The expression associated with an ExpressionInput belongs to this class. So is any derivative of such a function. Note that derivatives must be recomputed when the expression changes. This is done via "lazy evaluation", that is, only when necessary. When a derivative is used, it tests whether it is out of date by comparing its serialNumber to the serial number of the expression that it is the derivative of. If they don't match, then the expression is recomputed and the serial number is updated. The serial number and defintion of the main expresssion is changed by checkInput() whenever the user's input has changed.
See Also:
  • Method Details

    • getVal

      public double getVal()
      Description copied from interface: Value
      Gets the current value of this object.
      Specified by:
      getVal in interface Value
    • getValueWithCases

      public double getValueWithCases(Cases c)
      Description copied from interface: Expression
      Compute and return the value of this expression. If cases is non-null, then data is stored in cases that can be used to check for possible discontinuities between one evaluation and the next. See the class Cases for more information.
      Specified by:
      getValueWithCases in interface Expression
    • toString

      public String toString()
      Description copied from interface: Expression
      Get a print string representation of this expression. (Of course, every object defines toString(). It is included here to remind you that classes that implement the Expression interface should have a print string representation that looks like a mathematical expression.)
      Specified by:
      toString in interface Expression
      Overrides:
      toString in class Object
    • derivative

      public Expression derivative(Variable wrt)
      Description copied from interface: Expression
      Return an Expression that represents the derivative of this expression with respect to the variable wrt. (Note that if the expression contains other variables besides wrt, this is actually a partial derivative.)
      Specified by:
      derivative in interface Expression
    • dependsOn

      public boolean dependsOn(Variable x)
      Description copied from interface: Expression
      Checks whether the expression has any dependence on the variable x.
      Specified by:
      dependsOn in interface Expression