vec_math
Class ExpressionFunction

java.lang.Object
  extended by vec_math.Node<String>
      extended by vec_math.StringNode
          extended by vec_math.ExpressionNode
              extended by 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.
 
Constructor Summary
ExpressionFunction(String node)
          Constructs a new function like sin(t).
ExpressionFunction(StringNode parent, String root, int level)
          Constructs a daugther node.
 
Method Summary
 double evaluate(double t)
          The expression is checked for the occurence of the single variable.
 
Methods inherited from class vec_math.ExpressionNode
getValue, isVariable
 
Methods inherited from class vec_math.StringNode
getVariables, parseOperator, parseSub, replaceVariable, replaceVariable, setValidOperator
 
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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

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.

Method Detail

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