public class JavaExpr
extends gnu.jel.DVMap
Constructor and Description |
---|
JavaExpr(String exprStr)
Initialize and compile a new expression.
|
JavaExpr(String exprStr,
gnu.jel.DVMap resolver)
Initialize and compile a new expression.
|
Modifier and Type | Method and Description |
---|---|
double |
eval()
Evaluate the expression and return the result.
|
boolean |
evalBoolean()
Evaluate the expression and return the result as a boolean.
|
Object |
evalObject()
Evaluate the expression and return the result as an Object.
|
double |
getDoubleProperty(String name)
Called by reflection for the DVMap interface to get the value of the named variable
|
String |
getTypeName(String name)
Implements the DVMap interface
|
static void |
main(String[] args)
test main
|
void |
setVar(String name,
double value)
Set the value of the given variable to the given value.
|
public JavaExpr(String exprStr) throws Throwable
exprStr
- contains the expression stringThrowable
public JavaExpr(String exprStr, gnu.jel.DVMap resolver) throws Throwable
exprStr
- contains the expression stringresolver
- used to resolve variable names in expressionsThrowable
public String getTypeName(String name)
getTypeName
in class gnu.jel.DVMap
public double getDoubleProperty(String name)
public void setVar(String name, double value)
Note that variable names must conform to Java syntax ("$X" is allowed, but not ${X}, for example).
public double eval() throws Throwable
Throwable
public boolean evalBoolean() throws Throwable
Throwable
public Object evalObject() throws Throwable
Throwable
public static void main(String[] args)
Copyright © 2023 Central Laboratory of the Research Councils. All Rights Reserved.