JEvaluator

© 2006,2007 Fabrizio Fiorucci

Welcome to the homepage of this project!

In case of requests, bugs, issues, questions and further developments you can reach me at:

e-mail: fiorucci@oasi.asti.it
ICQ: 6578881
MSN: fiorucci@oasi.asti.it
Skype: fabriziofiorucci


Overview

JEvaluator is a Java class that implements a fast and flexible mathematical expressions parser and evaluator.
It's fully compatible with Java 1.4 and greater.
Complex mathematical expressions can be handled and combined together with virtually no limitations on length and number of used variables.

JEvaluator main features include:


Quickstart

For a quickstart download the tarball and have a look at JEvaluatorTest.java and JEvaluator.conf.
User-defined functions are supported and can be easily implemented by implementing the BaseFunctionInterface interface. For some quick hint have a look at Sum.java.

Basic steps to start using JEvaluator are:

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
}
User-defined 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" );


Download & documentation

JEvaluator can be downloaded here:

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 distribution files can be imported directly as an Eclipse project


License

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  02110-1301  USA
http://www.gnu.org/licenses/lgpl.html


Credits


To do

In case of feature requests please drop me an e-mail


ChangeLog


0.9 - Major enhancements: support for boolean operators and boolean bitwise operators (three subreleases for Java 1.4, 1.5 and 1.6) - October 6th, 2007
0.8 - Major enhancements: support for text with inline expressions expansion (three subreleases for Java 1.4, 1.5 and 1.6) - August 28th, 2007
0.7.1 - Minor enhancements: 0.7 release backported to be compatible with Java 1.4 - August 6th, 2007
0.7 - Minor enhancements: small bugfixes - July 30th, 2007
0.6 - Major enhancements: support for literal and string variables - November 8th, 2006
0.5 - Major enhancements: support for conditional and branch-case expressions - October 9th, 2006
0.4 - Minor enhancements: strict declarations according to Java 5 specifications added. Script to run the example code fixed - September 7th, 2006
0.3 - License changed from GPL to LGPL - July 27th, 2006
0.2 - Added support for dynamic registration/unregistration of user-defined functions - July 27th, 2006
0.1b - First public release - July 9th, 2006


Listed on:


Related projects:


[ Back to homepage | Guestbook | visitor's map ]