Formula 1.0.0

Class MainGui

  extended by hirondelle.formula.demo.MainGui

public final class MainGui
extends Object

Simple harness for testing formulas.

To launch this demo, navigate to a directory containing formula4j.jar, and enter:

 >java -cp formula4j.jar hirondelle.formula.demo.MainGui

This demo app acts much like a simple console, with input and output. The basic commands are:

Usually, the input is simply an expression to be evaluated.

This tool also defines the following special commands, all of which start with a leading ':' character :

:define <function-definition>
Define a custom function on the fly.
  :define bmi(m,h) = m/h^2

:set <variable-value>
Defines a variable as a name-value pair.
Defined variables can be referenced in formulas.
Setting a variable a second time simply overwrites the value.
  :set a = 321.2

:unset [<variable-name>]
Remove a variable value. 
If the variable name is omitted, then all variables are removed.

Show timing statistics.

:load <file-name>
Load a file defining custom functions.
The file name should be absolute, not relative.
The file should be encoded in UTF-8.
The file must contain content that looks like this:

bmi(m,h) = m/h^2
area(r) = 2 * π * r^2
circum   my.package.Circumference

There are two kinds of entries in these files:
  - explicit functions (bmi and area)
  - mapping of function names to implementation classes (circum)

Revert to the default set of functions, with 
no customizations. Undoes both the :load and 
the :define command.

Clear the output area by removing all of its text.

Show this help information.

Constructor Summary
Method Summary
static void main(String... aArgs)
          Run this tool (no parameters are required).
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public MainGui()
Method Detail


public static void main(String... aArgs)
Run this tool (no parameters are required).

Formula 1.0.0

Copyright Hirondelle Systems. Published January 31, 2013