opale.mathtools.parser
Class SUnaryFunction
java.lang.Object
|
+--opale.mathtools.parser.TypeOp
|
+--opale.mathtools.parser.UnaryFunction
|
+--opale.mathtools.parser.SUnaryFunction
- public class SUnaryFunction
- extends UnaryFunction
This class makes it possible to add an user function that will be recognised by the parser. It uses a string definition of the function and so an user can can create dynamicaly an function from a string definition : unlike the class UnaryFunction
, this class will be used rather in the conception of a graphical user interface.
Constructor Summary |
SUnaryFunction(java.lang.String keyword,
java.lang.String var,
java.lang.String s)
This constructor instanciate an user function : it must specify the keyword for the recognisation, the string definition of the variable and the string definition of the function. |
Method Summary |
double |
eval(double x)
Evaluate the function at the point x. |
java.lang.String |
keyword()
Returns the keyword of this function |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SUnaryFunction
public SUnaryFunction(java.lang.String keyword,
java.lang.String var,
java.lang.String s)
- This constructor instanciate an user function : it must specify the keyword for the recognisation, the string definition of the variable and the string definition of the function.
For instance, to define the function f(x) = 2*cos(x) : SUnaryFunction myFunc = new SUnaryFunction("f","x","2*cos(x)")
eval
public double eval(double x)
- Evaluate the function at the point x.
- Overrides:
eval
in class UnaryFunction
keyword
public java.lang.String keyword()
- Returns the keyword of this function
- Overrides:
keyword
in class opale.mathtools.parser.TypeOp