Formula 1.0.0

hirondelle.formula.demo
Class MainGui

Object
  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.
Example:
  :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.
Example:
  :set a = 321.2

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

:stats
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)

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

:cls
Clear the output area by removing all of its text.

:help
Show this help information.


Constructor Summary
MainGui()
           
 
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

MainGui

public MainGui()
Method Detail

main

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


Formula 1.0.0

Copyright Hirondelle Systems. Published January 31, 2013