Local termination code with the reusable statechart implementation
The following sections describe how code is generated to support local termination when you use the reusable statechart implementation.
Code is generated for local termination of Or states with the reusable statechart implementation as follows:
- For each final activity, a
Concept
class data member of typeFinalState
is generated. A new class is not created as for other state types. - The following local termination guard is added to each outgoing null transition
from an Or state that needs local termination semantics:
&& IS_COMPLETED(state)
- If an Or state has several final activities, an outgoing null transition is activated when any one of them is reached. However, the specific connector is instrumented.
- The
isCompleted()
function is overridden for an Or state that has a final activity, returningTrue
when the final activity is reached. The function is also overridden for an Or state without a final activity in activity diagram mode, always returningFalse
. - An instance of a
FinalState
is created by a line similar to the following example:FinalA = new FinalState(this, OrState, rootState, "ROOT.OrState.FinalA");
Code is generated for local termination of And states with the reusable statechart implementation as follows:
- The following local termination guard is added to each outgoing null transition
from an And state if one of the components has a final activity:
&& IS_COMPLETED(AndState)
In this case, the
isCompleted()
function of theAndState
framework class is called. - The following local termination guard is added to a join transition for each Or
state that is a source of the transition:
&& IS_COMPLETED(state)
- If a source state of a join transition is a simple state (leaf state), its guard
is as follows:
(IS_IN(state))
The following example shows the code generated for a join transition with a real
guard and local termination guards, where C1
and C2
are Or states
with final activities and C3
is a leaf state:
if(RealGuard() && IS_COMPLETED(C1) && IS_COMPLETED(C2) && IS_IN(C3))