public class JELFunction extends Object implements java.util.function.DoubleUnaryOperator
Instances of this class are not threadsafe, but could be made so
by putting a lock on the evaluate(double) method.
| Constructor and Description |
|---|
JELFunction(String xvarname,
String fexpr)
Constructs a function with no external constants.
|
JELFunction(String xvarname,
String fexpr,
Map<String,? extends Constant<?>> constMap)
Constructs a function that can reference provided constants.
|
| Modifier and Type | Method and Description |
|---|---|
double |
applyAsDouble(double x)
Does exactly the same as
evaluate(double). |
double |
evaluate(double x)
Evaluates this function at a given value of the independent variable.
|
String |
getExpression()
Returns the text of the function expression.
|
Constant<?>[] |
getReferencedConstants()
Returns an array of any constants that were referenced in this
function's expression.
|
String |
getXVarName()
Returns the name of the independent variable.
|
static void |
main(String[] args)
Main method tests this class.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitandThen, compose, identitypublic JELFunction(String xvarname, String fexpr) throws gnu.jel.CompilationException
xvarname - name of the independent variable (for instance "x")fexpr - text of expression giving the function value,
in terms of xvarname (for instance "x+1")gnu.jel.CompilationExceptionpublic JELFunction(String xvarname, String fexpr, Map<String,? extends Constant<?>> constMap) throws gnu.jel.CompilationException
xvarname - name of the independent variable (for instance "x")fexpr - text of expression giving the function value,
in terms of xvarname (for instance "x+1")constMap - map by name of constant values that can be
referenced in the expression, may be nullgnu.jel.CompilationExceptionpublic Constant<?>[] getReferencedConstants()
public double evaluate(double x)
x - variable valuepublic double applyAsDouble(double x)
evaluate(double).applyAsDouble in interface java.util.function.DoubleUnaryOperatorpublic String getXVarName()
public String getExpression()
public static void main(String[] args)
Copyright © 2026 Central Laboratory of the Research Councils. All Rights Reserved.