Categories
Dictionnary
Download
Project Details
Changes Log

ExpressionJ is a Java library allowing to interpret simple numeric expressions, which may be used in all applications which have to combine numeric values, but do not want to use full−blown scripting languages.

Overview

ExpressionJ allows to:

Grammar

Main Article: Grammar

Example

Let's take for example the following numeric expression: a+2

To parse this expression, we will type:

      Equation equation = ExpressionJ.parse("a+2");  

Let's evaluate the expression with 1 for the value of a:

      equation.getVariable("a").setValue(1);  
      Object result = equation.eval();  

The result will be the Integer 3.


Categories: general

Copyright 2018 Herve Girod. All Rights Reserved