Statestep Java Template

Version: 1.0


The earliest version of Java against which this template has been tested is Java 1.4. Though an attempt has been made to avoid version dependencies, minor changes may be needed for older Java libraries.

The code generated by this template is not optimized: readability could be traded for improvements in execution speed and memory efficiency, without changing the public API. In most contexts, this should not be an issue.

Before using this template, you should read the general instructions on how to use FMPP for code generation. More tips or information may be available on the Statestep website.

Using the Template

To generate code, first open the 'config.fmpp' file in any text editor and change the options in it to reflect your local settings. These include where to find the model from which code is to be generated — if you're just trying out code generation, a suitable model to try is 'harelsWatch.s2', one of the sample models included with Statestep.

Then, using a command prompt or shell, cd to this directory and run 'fmpp'.

Interface Provided by the Generated Code

To view the full API of the Java code produced by the template, use the Javadoc tool that comes with Java, for example,

javadoc mypackage

(assuming the Java package name chosen for the generated code is 'mypackage' and that it is in a subdirectory of the same name). Then simply browse the HTML documents generated from the comments in the code.

You might find it easier to start by looking at the code in, one of the files produced by the template. The code in this file illustrates many of the methods in the generated code. It also functions as a crude (non-graphical) simulator. To run this simulator, first compile the generated .java files and then type

java mypackage.SampleCode