QP actor frameworks and QM modeling tool Icon

QP actor frameworks and QM modeling tool

1 of 5 2 of 5 3 of 5 4 of 5 5 of 5 (15) Read Reviews | Last Updated
Looking for the latest version? Download qpn_5.5.1.zip (3.7 MB)
Home / QEP_Java
Name Modified Size Downloads / Week Status
Parent folder
Totals: 2 Items   6.9 kB 3
3.4.01 2008-04-03 55 weekly downloads
README 2012-10-26 6.9 kB 33 weekly downloads
Release Notes Quantum Event Processor in Java (QEP/Java) v3.4 SNAPSHOT RELEASE FOR PREVIEWING AND TESTING NEW FEATURES ONLY Quantum Leaps, LLC www.quantum-leaps.com This application note describes a port of the Quantum Event Processor (QEP [www.quantum-leaps.com] to Java. This port was completed with Sun's Java(TM) 2 SDK, Standard Edition Version 1.4.2 (See the Release Notes on the Java Software web site for additional information pertaining to this release at http://java.sun.com/j2se/1.4.2/relnotes.html). Licensing --------- Quantum Leaps, LLC owns QEP/Java source code and licenses it under the DUAL-LICENSING model (see www.quantum-leaps.com/licensing). Duality means that Quantum Leaps licensing policy combines the software quality and distribution benefits of an open source model with the software licensing revenue model of a traditional commercial software vendor. As specified in the copyright notices in the source code, you can use this software under the terms of the GNU General Public License (see GPL.TXT file accompanying this distribution). Alternatively, this software may be distributed and modified under the terms of Quantum Leaps commercial licenses, which are designed for users who want to retain *proprietary* status of their code. The users who license this software under one of Quantum Leaps commercial licenses do not use this software under the GPL and therefore are not subject to any of its terms. Contact information: Quantum Leaps Web site: http://www.quantum-leaps.com e-mail: info@quantum-leaps.com Installing QEP/Java -------------------- The distribution consists of the following files and directories: <qpj_3> - root directory where you chose to install QEP/Java | +-qep - batch file to build the QCalc example +-gpl.txt - GNU General Public License | +-qcalc/ | +-QCalc.java - Quantum Calculator HSM example | +-QCalcApplet.java - applet to run Quantum Calculator HSM | +-qcalc2/ | +-QCalc2.java - Quantum Calculator2 HSM example (extends QCalc) | +-QCalc2Applet.java - applet to run Quantum Calculator2 HSM | +-qep/ - QEP/Java package definitions | +-QEvent.java - qep.QEvent public class source | +-QHsm.java - qep.QHsm public class source | +-qhsmtst/ | +-QHsmTst.java - exhaustive test for the QHsm class | +-build_qcalc.bat - batch file to build the QCalc example | (produces qcalc.jar) +-build_qcalc2.bat - batch file to build the QCalc2 example | (produces qcalc2.jar) +-build_qf.bat - batch file to build the qf package | (produces qf.jar) +-build_qhsmtst.bat - batch file to build the QHsmTst example | (produces qhsmtst.jar) +-log_pass.txt - Example of a successfull QHsmTst run | +-qcalc.htm - HTML file to run the QCalc applet +-qcalc2.htm - HTML file to run the QCalc2 applet +-run_qhsmtst.bat - batch file to run the QHsmTst Java application About the Port -------------- This implementation is functionally very similar to the QEP/C++ 3.4 implemenation described in "Practical Statecharts in C/C++". The core of the HSM implementation in Java is the class QHsm (defined in QHsm.java). This is the base class for derivation of concrete state machines (such as the calculator). Since Java lacks pointers, and pointer-to-member-functions in particular, the main challenge of the implementation is to provide an equivalent to pointer-to-member-function. This is achieved through the interface QState defined inside the QHsm base class: public abstract class QHsm { // . . . protected static interface QState { public abstract QState handler(QEvent e); } // . . . } The interface QState contains only one method: the state handler, which takes an event and returns QState. More precisely, the state handler method should return the superstate when it dosn't handle the event and null when it does. Concrete state machines derived from QHsm define their state handlers by implementing the QState interface "on the fly" through anonymous inner classes. For example, the following snippet of code demonstrates how QCalc class defines the initial transition and the handler for state "calc" (see Chapter 1 of "Practical Statecharts in C/C++" for the definition of the QCalc statechart): import qep.*; public class QCalc extends QHsm { // . . . public void init(QEvent e) { operand1_ = 0.0; operand2_ = 0.0; operator_ = '?'; super.init_tran(calc); // initial transition } protected QState calc = new QState() { public QState handler(QEvent e) { switch (e.sig) { case Q_ENTRY_SIG: { display_.showState("calc"); return null; } case Q_INIT_SIG: { display_.clear(); Q_TRAN(ready); return null; } case CLEAR_SIG: { display_.clear(); Q_TRAN(calc); return null; } case TERMINATE_SIG: { Q_TRAN(end); return null; } } return top; } }; // . . . } Using the Port -------------- The root directory of the port contains several batch files (for Windows) that demonstarte how to build the qep package and the examples. Also, included are HTML files to execute the Java applets. Integrating HSMs with Java Event Model -------------------------------------- The "Quantum Calculator" (directories qcalc and qcalc2) demonstrate how to use event adapters to integrate the HSM with the Java 1.1 event model. Inheritance of Entire State Models ---------------------------------- To demonstrate more advanced capabilities of this HSM implementation, the port contains an example of deriving and specializing a non-trivial state machine. This is the same example of the "Quantum Calculator" extended with percentage calculations, which is described in Chapter 6 of "Practical Statecharts in C/C++". Quantum Leaps www.quantum-leaps.com November 03, 2007
Source: README, updated 2012-10-26