- JavaDoc

# JEP

- Introduction
- Basic Usage
- Variables
- Data types
- Operators
- Functions
- Custom Functions
- BigDecimal
- FAQ
- Migration
- Version History

# Advanced Features

- Manipulating Expressions
- Components
- Configurable Parser
- Serialization
- Grammar

# Version History

Jep 3 Releases | Jep 2 Releases | Jep 1 Releases

## Version 3.3 (released 2008/11/30)

### Core Jep changes

- New default evaluator FastEvaluator which achieves a 2x-3x speed improvement using the new interfaces. StandardEvaluator is still available for compatibility purposes.
- New constructor `Jep(JepComponent... comp)` which makes it easier to construct Jep with a specific set of components. For example `new Jep(new StandardConfigurableParser())`.
- New version of the operator table OperatorTable2 which uses enums to specify keys. Methods that are common to all operator tables are declared in a new interface OperatorTableI. Note that `Jep.getOperatorTable()` now returns `OperatorTableI` which may break some code.
- Node now defines default implementations for `getName()`, `getValue()` making it easier to extract values without a cast.
- Node now defines methods `setHook()`, `getHook()` allowing annotation of nodes with key-value pairs.
- Unit tests converted to use JUnit 4.

### Functions

- New functions Switch, Case, Left, Right, Mid, Substring, LowerCase, UpperCase, Length, Trim.
- New base classes UnaryFunction, BinaryFunction, NaryFunction, and NaryBinaryFunction simplifying interface for defining user functions. For example, a `BinaryFunction` just needs to define an `Object eval(Object l, Object r)` method.
- New exception class IllegalParameterException sub-classing `EvaluationException` provides standardised error messages, for the common case of wrong arguments being passed to user functions.
- PostfixMathCommand defines convenience methods such as `int asInt()` to convert arguments to a specified type.
- New optional functions IsNull, IsNaN, IsInfinite, IsType for testing the value and type of arguments. These are not included by default.

### Examples

- Enhanced FunctionPlotter applet allowing zooming and translation.
- New ParametrisedPlotter and PolarPlotter.
- New SpeedTest application for comparing different configurations.

## Version 3.2 (released 2008/02/12)

General Changes:

- Added support for expression tree analysis using TreeAnalyser
- Fixed errors in the documentation of the default configuration
- Improved the operator table

Changes to the configurable parser:

- New StandardConfigurableParser class
- Parse error reporting with line and column numbers
- Added support for hexadecimal numbers (e.g. `0x1F`)
- Added support for bitwise operators (bitwise or: `a | b`, bit shifting `a << 2`) in BitwiseOperatorTable
- Added support for `a?b:c`, `x+=1`, `++x` syntax
- Added support for case-insensitive operators
- Added support for multiple expressions separated by semicolons
- Added support for multiple dimensional array access (`a[1][1]` accesses the first element of a two-dimensional array)
- Fixed issues with escape characters
- Fixed power and unary minus precedence to be consistent with the standard parser ("-3^2" should equal -9)

Known issues:

- `Jep.addVariable` does not notify the user when the specified value can not be set. This happens when a constant is already defined with the same name.

## Version 3.1 (released 2007/09/22)

- Added serialization support
- Fixes bug prohibiting adding alphabetic operators to the configurable parser (such as AND)
- Added short circuit logical operator evaluation for && and || to speed up evaluation
- Added `avg`, `min`, and `max` functions
- Makes use of new Java 1.5 Math functions `log10`, `sinh`, `cosh`, `tanh`, and `hypot`
- Added StrictNaturalLogarithm which returns `NaN` for negative reals rather than complex.
- Fixed mistake in the Basic Usage section of the documentation

Known issues:

- The default settings for allowUndeclared, implicitMultiplication, and allowAssignment are true. The documentation falsely claims that the defaults are false.

## Version 3.0 (released 2007/07/01)

- Added RealEvaluator for fast evaluation of expressions not containing strings, arrays or complex numbers
- Added BigDecComponents for high precision calculations using BigDecimal numbers
- New component architecture (pluggable parser, evaluator, and more)
- Added new configurable parser (allows alternate syntax)
- Added expression printing capabilities to the Jep class
- Added new functions: round, floor, ceil, lg (log base 2)
- Major package restructuring
- No longer available under the GPL license
- Changed error handling from hasError() function to exception throwing
- Switched from JavaCC 3.2 to JavaCC 4.0
- Switched compatibility from Java 1.2 to Java 1.5
- Switched from JUnit 3 to JUnit 4.1
- See Migration on how to smoothly upgrade from a previous version

Known issues:

- The default settings for allowUndeclared, implicitMultiplication, and allowAssignment are true. The documentation falsely claims that the defaults are false.