Next: 8.3 Space Efficiency and
Up: 8.2 Transformation Strategies
Previous: 8.2.4 Event Handling
Contents
Index
Importation is transformed into instantiation in the synthesized
code. A class is generated for each model. When a submodel is
imported, the importing model instantiates an object of the submodel
class, and associates the new object with the ID of the importation
state.
According to the DCharts semantics, an imported model is conceptually
a part of the importing model. Once imported, it remains until the
simulation or execution finishes. All the states and transitions of
the imported model are copied to the inside of the importation
state. This semantics is implemented as instantiation as follows:
- Once an object of a submodel class is instantiated and
associated with a state ID, it is not deleted until the execution
of the top-level model finishes (or, usually until the program
exits).
- When the model leaves an importation state, the object
associated with it is kept as its history.
- If history is recorded for an importation state, it is
restored when the model goes to that state because of the firing
of a transition with the [HS] property. If the state has a
history but the transition does not have the [HS] property,
the submodel is re-initialized to its default states. In the
latter case, for simplicity, the importing model instantiates a
new object of the submodel class, and replaces the old one with
it. The old submodel object is recycled by the Java garbage
collector.
- For each model, the configuration of submodels, including
their number and the states that import them, is fixed and can be
decided statically. The array Submodels of a model class
keeps track of all those submodels.
Next: 8.3 Space Efficiency and
Up: 8.2 Transformation Strategies
Previous: 8.2.4 Event Handling
Contents
Index
Thomas Huining Feng
2004-04-28