Package edu.hws.jcm.awt
Class ExpressionInput.EI
- java.lang.Object
-
- edu.hws.jcm.awt.ExpressionInput.EI
-
- All Implemented Interfaces:
Expression,Value,java.io.Serializable
- Enclosing class:
- ExpressionInput
protected class ExpressionInput.EI extends java.lang.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:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleandependsOn(Variable x)Checks whether the expression has any dependence on the variable x.Expressionderivative(Variable wrt)Return an Expression that represents the derivative of this expression with respect to the variable wrt.doublegetVal()Gets the current value of this object.doublegetValueWithCases(Cases c)Compute and return the value of this expression.java.lang.StringtoString()Get a print string representation of this expression.
-
-
-
Method Detail
-
getVal
public double getVal()
Description copied from interface:ValueGets the current value of this object.
-
getValueWithCases
public double getValueWithCases(Cases c)
Description copied from interface:ExpressionCompute 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:
getValueWithCasesin interfaceExpression
-
toString
public java.lang.String toString()
Description copied from interface:ExpressionGet 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:
toStringin interfaceExpression- Overrides:
toStringin classjava.lang.Object
-
derivative
public Expression derivative(Variable wrt)
Description copied from interface:ExpressionReturn 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:
derivativein interfaceExpression
-
dependsOn
public boolean dependsOn(Variable x)
Description copied from interface:ExpressionChecks whether the expression has any dependence on the variable x.- Specified by:
dependsOnin interfaceExpression
-
-