|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjsky.util.JavaExpr
public class JavaExpr
This class is a simple wrapper for the JEL package and provides support for evaluating dynamic, numerical expressions in Java.
Constructor Summary | |
---|---|
JavaExpr(String exprStr)
Initialize and compile a new expression. |
|
JavaExpr(String exprStr,
gnu.jel.DVResolver resolver)
Initialize and compile a new expression. |
Method Summary | |
---|---|
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 DVResolver interface to get the value of the named variable |
String |
getTypeName(String name)
Implements the DVResolver 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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JavaExpr(String exprStr) throws Throwable
exprStr
- contains the expression string
Throwable
public JavaExpr(String exprStr, gnu.jel.DVResolver resolver) throws Throwable
exprStr
- contains the expression stringresolver
- used to resolve variable names in expressions
Throwable
Method Detail |
---|
public String getTypeName(String name)
getTypeName
in interface gnu.jel.DVResolver
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)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |