vec_math
Class ExpressionFunction
java.lang.Object
vec_math.Node<String>
vec_math.StringNode
vec_math.ExpressionNode
vec_math.ExpressionFunction
- All Implemented Interfaces:
- Serializable, Function
public class ExpressionFunction
- extends ExpressionNode
- implements Function
A function from a parseable string expression. The independent variable
used for evaluating the function can have any name, but it may be the
only variable
- See Also:
- Serialized Form
|
Nested Class Summary |
static class |
ExpressionFunction.Test
Test by evaluating an arbitrary function at the provided position. |
|
Method Summary |
double |
evaluate(double t)
The expression is checked for the occurence of the single variable. |
| Methods inherited from class vec_math.Node |
equals, getLevel, getParent, getParseSource, getSub, getSubAt, getSubNodeNumber, getTie, isFinal, isParsed, isRoot, parse, parse, setParse, setParseSource, setSub, setTie, setValue, toString, traceVariable |
ExpressionFunction
public ExpressionFunction(String node)
throws ParseException
- Constructs a new function like sin(t). The expression isparsed right
after the construction and the name of the variable is checked to be
compliant with a single, unique name.
- Throws:
ParseException
ExpressionFunction
public ExpressionFunction(StringNode parent,
String root,
int level)
- Constructs a daugther node. This constructor is called repeatedly
during parsing.
evaluate
public double evaluate(double t)
- The expression is checked for the occurence of the single variable.
This is replaced with the value supplied and the evaluated number is
returned.
- Specified by:
evaluate in interface Function