|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectgnu.jel.DVMap
jsky.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(java.lang.String exprStr)
Initialize and compile a new expression. |
|
JavaExpr(java.lang.String exprStr,
gnu.jel.DVMap 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. |
java.lang.Object |
evalObject()
Evaluate the expression and return the result as an Object. |
double |
getDoubleProperty(java.lang.String name)
Called by reflection for the DVMap interface to get the value of the named variable |
java.lang.String |
getTypeName(java.lang.String name)
Implements the DVMap interface |
static void |
main(java.lang.String[] args)
test main |
void |
setVar(java.lang.String name,
double value)
Set the value of the given variable to the given value. |
| Methods inherited from class gnu.jel.DVMap |
|---|
translate |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public JavaExpr(java.lang.String exprStr)
throws java.lang.Throwable
exprStr - contains the expression string
java.lang.Throwable
public JavaExpr(java.lang.String exprStr,
gnu.jel.DVMap resolver)
throws java.lang.Throwable
exprStr - contains the expression stringresolver - used to resolve variable names in expressions
java.lang.Throwable| Method Detail |
|---|
public java.lang.String getTypeName(java.lang.String name)
public double getDoubleProperty(java.lang.String name)
public void setVar(java.lang.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 java.lang.Throwable
java.lang.Throwable
public boolean evalBoolean()
throws java.lang.Throwable
java.lang.Throwable
public java.lang.Object evalObject()
throws java.lang.Throwable
java.lang.Throwablepublic static void main(java.lang.String[] args)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||