Download Conformiq User Manual - Verifysoft Technology GmbH

Transcript
Creating Models in QML
211
provides the means to construct a "state machine". A state machine has its own execution
thread and it supports communication with it using ports.
There are two ways to create state machines. One is to declare a class that extends the
StateMachine class and implement the run method in this class using the QML textual
notation. For example
class MyStateMachine extends StateMachine {
public void run() { /* State machine execution logic here. */ }
}
Once defined, instances of the state machine may be started. State machine threads are
created like any other thread in QML, i.e., a state machine is instantiated and it is started by
invoking the start method. (Alternatively, you can create a new instance of Thread by
passing the state machine as an argument and call start.)
MyStateMachine sm = new MyStateMachine();
sm.start();
The other way is to extend the predefined StateMachine super class of QML as usual
without providing an implementation of the run method in the QML textual notation.
Instead, the definition of the run method is given as a UML state diagram that has the same
name as the user-defined state machine class.
For example, assume the following
class MyStateMachine extends StateMachine {
/* No run() defined here. It will be defined in a state machine
called 'MyStateMachine'. */
}
Once the state machine in the QML graphical notation with the name MyStateMachine is
provided, the state machine is taken as the run method.