A Java implementation of the kind of
hierarchical state machine
described in the book
Practical Statecharts in C/C++,
Quantum Programming for Embedded Systems, by Miro Samek, Ph.D.
|Hierarchical State Machines|
That book has box-outs detailing the tiny overhead of it's mechanisms in
terms of assembly instruction counts. My version replaces those mechanisms
with multiple hash table lookups and use of the Reflection API so does not offer
the same level of performance. It also allocates from the garbage-collected
heap as it runs, with the limit of the allocation load hard to determine,
and spits out a little garbage for every transition.
I've also re-implemented the Calculator main motivating example statechart
used in that book as a web applet:
If you can't see it or don't want to install the sun Java plugin try
this page which uses the