Numeric Expression Interpreter JavaBean
Caligula is a Java Bean component which allows you
to define expressions, variables and functions and to compile and execute these functions and expressions at runtime.
With Caligula you can add expression evaluation functionality to your application. For its normal
operation Caligula does not rely on any user interface, and will therefore fit seamlessly into any client application.
Key features
|
 |
More than 50 built-in mathematical functions
|
|

|
Any number of user-defined variables and user-defined functions
|
|

|
Decimal, hexadecimal and binary number formats
|
|

|
Advanced functions like integration, root finding and extremum finding
|
|

|
A programming interface lets you add your own functions
|
|
 |
Based on the Swing library
|
Use cases
|
 |
Custom calculators
|
|

|
Smart input controls
|
How Caligula works
Caligula processes numeric
expressions. A numeric expression is a string like
- "1+2"
- "sqrt(4)"
- "a*a+b"
- "acceleration = 9.81"
- "acceleration*time*time"
- "Distance (acceleration, 1.9)"
Caligula compiles an expression and executes (evaluates) it, producing a numeric result (a number) which
can be displayed or used for further computations in the client application. As opposed to expressions
which are hard coded into an application, Caligula can evaluate expressions which are only known at runtime, e.g. like in a calculator.
Caligula can work with variables
. Expressions 3 thru 6 in the list above are examples of expressions which make use of variables. You can define any number of variables in Caligula.
Caligula has a rich set of
internal functions. Internal functions are those functions which are already built into Caligula like sin(), sqrt(), beta() etc. Expression 2 in the list above is an example of an
expressions with an internal function.
Caligula also lets you define
functions. Expression 6 in the list above is an example of an expressions which make use of a function. You can define any number of functions in Caligula.
With Caligula you can add your own function implementations and define them as
external functions. When Caligula evaluates an expression and finds a call to an external function it will call into the client
application using the standard event mechanism, passing the function name and function arguments in the event parameter. This allows for a very flexible extension of Caligula's set of functions.
Caligula performs compilation
and evaluation in two distinct steps. This tremendously improves performance when expressions need to be evaluated repeatedly.
Related Products
Caligula is the Java version of NumX.
NumX Programmable ActiveX calculator control
|