next up previous contents index
Next: 8.1.2 Numbering Up: 8.1 Java Code Design Previous: 8.1 Java Code Design   Contents   Index

8.1.1 Class Hierarchy

Figure 8.1: Java class hierarchy of state machines
Image statemachineclasses

In the class hierarchy of the generated Java source code (Figure 8.1), class StateMachine is the common superclass of all the DCharts models. It defines the common interface for the models, so that one model may invoke methods in another without explicitly specifying its concrete type. For each DCharts model (or submodel to be imported), a Java class with the same name is synthesized. The class with the same name as the .des file specified on the command-line is the main class.

SCC searches for the submodels to be imported into the main model. Those submodels are converted into corresponding Java classes, written in the same Java source file. In addition, it also generates code for the subsubmodels (if any) imported into those submodels. This search repeats until no new model is found under the IMPORTATION descriptor of all those model descriptions. If a model is imported by more than one model, or a model is imported by itself directly or indirectly, it is converted into only one class, which can then be reused in different importing models.

For example, in Figure 8.1, class MainModel is generated from a DCharts model in MainModel.des. It imports other models, and those imported models also import more models in their own right. Classes Submodel_1 to Submodel_n are generated from those imported models. All the above classes inherit class StateMachine.


next up previous contents index
Next: 8.1.2 Numbering Up: 8.1 Java Code Design Previous: 8.1 Java Code Design   Contents   Index
Thomas Huining Feng 2004-04-28