next up previous contents index
Next: 2.4 Closure under Importation Up: 2.3 Algorithms Previous: 2.3.2 Alternate Algorithm for   Contents   Index


2.3.3 Importation

When model $M'$ is imported into state $s$ of model $M$, a part of its definition is merged with $M$, while the rest is ignored. The algorithm below describes this merging:

  1. As an stimulus of this importation, a transition $t$ must be fired, or the submodel is placed in a default state of the model so that it is required at the very beginning of a simulation or execution. $t$ has the following properties:

    If such a transition is detected, the simulation/execution environment must first prepare the substates of $s$ by importation (since it is at that time a leaf state) before actually firing the transition.

    If an importation state is a default state of a model, the simulation/execution environment must import the appropriate submodel at the beginning. If the imported model requires more submodels, they are also imported at that time. It is the designer's responsibility to make sure that this repeated importation process ends in finite and acceptable time.

  2. To import model $M'$ into importation state $s$ of $M$, the following merging operations are performed:

    1. The GUIDs of the states in $M'$ are modified to make them globally unique within the states name space. This may be implemented by adding a prefix. The $SRC$ and $DES$ of each transition are modified accordingly. The parent-children relationship function $C$ is modified accordingly.

    2. The state hierarchy of $M'$ is merged with $M$. All the states in $M'$ become substates of $s$. The $C$ function of $M'$ is combined with the $C$ function of $M$.

    3. $T$ of $M'$ is merged with $T$ of $M$. If it is enforced that the $SRC$ of any transition in $M$ cannot be a state in submodel $M'$, the two transition sets do not have overlapping elements. (However, the $DES$ of some transitions may be states in $M'$.) Note that the $DES$ of a transition in $M'$ cannot refer to a state in $M$, since the simulation or execution environment modifies it to be a unique GUID at the time of importation.

    4. $V$ of $M'$ is merged with $V$ of $M$. If a variable in $M'$ has the same name as a variable in $M$, it is considered the same variable. If they have different types in a type system, a run-time exception is raised.

    5. $\Delta$ is merged after the GUIDs of states are changed.

    And the following properties of $M'$ are ignored:

  3. $s$ becomes a non-importation state, because $M'$ has already been imported into it. $s$ is no longer a leaf state, either. When the importation is finished, there is no knowledge of model $M'$ any more.

  4. Repeat steps 2.3.3 to 2.3.3 until no importation state $s$ is found in the path from $CCS(SRC,DES)$ to $DES$ or $DES$ itself.

After this merging of one or more submodels, transition $t$ can be fired according to any of the algorithms described in previous sections.


next up previous contents index
Next: 2.4 Closure under Importation Up: 2.3 Algorithms Previous: 2.3.2 Alternate Algorithm for   Contents   Index
Thomas Huining Feng 2004-04-28