All Packages Class Hierarchy This Package Previous Next Index
java.lang.Object | +----gnu.jel.Evaluator
It is intended for compilation of algebraic expressions, involving functions.
Syntax supports variables, which are, in fact, functions with no arguments. If You define such function in the static library -- it is a constant (and will be substituted into expression at compile time). If you define the method , such as "double x() {};" in the dynamic library class the expression "sin(x)" will call the method "x()" ( and function Math.sin() ) each time it is evaluated.
It is possible to have any type of intermediate object throughout the calculation as long as types of the function return values and parameters stay compatible.
The variant of the "compile" function with three arguments allows to fix the type of the expression result. For example :
CompiledExpression expression=compile("2*6+6",lib,Double.TYPE);will produce compiled expression, whose return type is always double. For additional information on how to use this feature to eliminate object allocation overhead see gnu.jel.CompiledExpression documentation.
Care should be taken during the assembly of static and dynamic libraries to avoid conflicts and unsupported return types.
(c) 1998, by Konstantin Metlov
Prague, CZ
public Evaluator()
public static CompiledExpression compile(String expression, Library lib, Class resultType) throws CompilationException
public static CompiledExpression compile(String expression, Library lib) throws CompilationException
All Packages Class Hierarchy This Package Previous Next Index