Function 
Description 
Abs(p) 
Absolute value of p 
And(p1, p2) 
Boolean AND (p1 && p2) 
Avg(p1, p2, ..., pn) 
Average value among p1, p2, ..., pn 
Case(cond1,result1,cond2,result2,...) 
Matches multiple conditions to multiple expressions.
If cond1 is true, the result is result1, else if cond2 is true, the result is result2, ... In case no condition is matched, the result is NaN 
If(cond,ifTrue,ifFalse) 
if cond is true, result is the expression "ifTrue", "ifFalse" otherwise 
Log(p) 
Natural logarithm (base e) of p 
Min(p1, p2, ..., pn) 
Minimum value among p1, p2, ..., pn 
Max(p1, p2, ..., pn) 
Maximum value among p1, p2, ..., pn 
Or(p1, p2) 
Boolean OR (p1  p2) 
Random(p) 
Random value amon 0 and p 
Rounddown(p) 
p rounded down to the closest integer 
Roundup(p) 
p rounded up to the closest integer 
Sqrt(p) 
The square root for p 
Strlen(s) 
The length in characters of the string variable 
Sum(p1, p2, ..., pn) 
The sum of all parameters 
Val(p) 
The value of p 
Operator 
Description 
+ 
Sum 
 
Subtraction 
* 
Multiplication 
/ 
Division 
^ 
Power 
Operator 
Description 
Example 
< 
Lesser than 
2<(a*(4c))
sqrt(a^2)<7log(22) 
> 
Greater than 
avg(4c,72,sum(1,2,3))>0

? 
Equals to 
2?0
(a+b)*(c2/e)?avg(log(c4),3) 
Operator 
Description 
Example 
& 
Bitwise AND 
2&(a*(4c))
sqrt(a^2)&7log(22) 
 
Bitwise inclusive OR 
avg(4c,72,sum(1,2,3))32

! 
Bitwise exclusive OR 
3!35
(a+b)*(c2/e)!avg(log(c4),3) 
Initialization 

Instantiate JEvaluator 
JEvaluator expr = new JEvaluator(); 
Initialize instance against log4j configuration file 
if ( expr.init ( "etc/JEvaluator.conf" ) ==false )
{ // LOG4J INIT ERROR, ABORTING } 
Variables definition 

Using name and value 
expr.setVar ( "base","120" );
expr.setVar ( "doubleBase","base*2" ); 
Using name and value as an expression 
expr.setExpr ( "height=45" );
expr.setExpr ( "area=base*height/2" ); 
Variables retrieval 

Using name 
Double base = expr.getVar ( "base" );

Text parsing and expansion 

expr.evaluateText ( "this is the average: ${output=average} and this is our final sum ${output=finalSum}",
"output" );


Checking whether a variable is being used 
if ( expr.isVarDefined ( "base" ) == true )
{ // VARIABLE "base" EXISTS } 
Userdefined functions handling 

Registration 
expr.registerFunction ( new Avg() );

Unregistration by function object
Unregistration by function name 
expr.unregisterFunction ( new Avg() );
expr.unregisterFunction ( "avg" ); 
Registration check by function object
Registration check by function name 
expr.isFunctionRegistered ( new Avg() );
expr.isFunctionRegistered ( "avg" ); 
Filename 
MD5 checksum 
Documentation 
Release date 
Java compatibility 
JEvaluator 0.9.J4 
b5fb5e523eb73a8e5df179c7006df9bb 
October 6th, 2007 
1.4 

JEvaluator 0.9.J5 
d36fa4e987e14b7dfc075bab4159c784 
October 6th, 2007 
1.5 

JEvaluator 0.9.J6 
0e0ef45078d4b8be215d061ef509ee6d 
October 6th, 2007 
1.6 

JEvaluator 0.8.J4 
420776f9cc63afbfb7057c735820ee1e 
August 29th, 2007 
1.4 

JEvaluator 0.8.J5 
44949138c9f9c3c1dbfa86922a6c6f6d 
August 29th, 2007 
1.5 

JEvaluator 0.8.J6 
1dd05d83e7515e39e4aebc023ae64e25 
August 29th, 2007 
1.6 

JEvaluator 0.7.1 
28d8d59b88768d35fbd4587f943f6f57 
August 6th, 2007 
1.4 

JEvaluator 0.7 
254e7f1130f95e72717d90b132a2778c 
July 30th, 2007 
1.5 

JEvaluator 0.6 
1482b642518bd2b155a65b07017b25e0 
November 8th, 2006 
1.5 

JEvaluator 0.5 
d34d290be29d1eb506218820074dbc70 
October 9th, 2006 
1.5 

JEvaluator 0.4 
f785db936951b9a3fa8315ae1c79fad3 
September 7th, 2006 
1.5 

JEvaluator 0.3 
b4efa40a4627f2beb38b25e43059865b 
July 27th, 2006 
1.4 & 1.5 

JEvaluator 0.2 
9dadbceb09a9f19537471085ffeff7ed 
July 27th, 2006 
1.4 & 1.5 

JEvaluator 0.1b 
deae23dfb03f54b570f65fb5668b9890 
July 9th, 2006 
1.4 & 1.5 
JEvaluator  A Java parsing and evaluation class Copyright (C) 2006, 2007 Fabrizio Fiorucci This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 021101301 USAhttp://www.gnu.org/licenses/lgpl.html
[ Back to homepage  Guestbook  visitor's map ]