Package edu.hws.jcm.awt
Class ExpressionInput.EI
java.lang.Object
edu.hws.jcm.awt.ExpressionInput.EI
- All Implemented Interfaces:
Expression
,Value
,Serializable
- Enclosing class:
- ExpressionInput
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 Summary
Modifier and TypeMethodDescriptionboolean
Checks whether the expression has any dependence on the variable x.derivative
(Variable wrt) Return an Expression that represents the derivative of this expression with respect to the variable wrt.double
getVal()
Gets the current value of this object.double
Compute and return the value of this expression.toString()
Get a print string representation of this expression.
-
Method Details
-
getVal
public double getVal()Description copied from interface:Value
Gets the current value of this object. -
getValueWithCases
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 interfaceExpression
-
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 interfaceExpression
- Overrides:
toString
in classObject
-
derivative
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 interfaceExpression
-
dependsOn
Description copied from interface:Expression
Checks whether the expression has any dependence on the variable x.- Specified by:
dependsOn
in interfaceExpression
-