The algorithm in the previous section for firing a transition conforms to David Harel's statecharts, whose semantics is described in [5]. Alternatively, an implementation of DCharts may also support another algorithm for firing a transition. This alternate algorithm is not compatible with David Harel's statecharts. However, it sometimes better expresses the behavior of a system to be modeled.
In this algorithm,
is defined in a different way:
The steps of the firing of a transition is described below:
Compared to the algorithm described in the last section, this
algorithm reverses the first operation and the second operation. As a
result, when the of a transition is executed, the model is
not in
but
. This better reflects the fact
that
is executed while transition
is fired, not
before or after that.
Suppose is a history state, the history leaf substates
are defined as the set of
'
substates recorded in its history, where
,
,
...,
are all
. The default leaf substates
are defined as the set of
'
default substates, where
,
, ...,
are all
. It is possible that
and
contain more than one elements, considering that the
may have
orthogonal components as its substates.
In the special case where , or though
,
is
in the path from
to any state in
or
, the enter/exit actions of
(and its superstates)
are not executed. This is because a self-loop to
is not
considered as a state change. This is the reason for using
instead of
.
An implementation of DCharts must implement the first algorithm described in the previous section. The algorithm discussed here is highly optional.