next up previous contents index
Next: 8.1.3 Members of Model Up: 8.1 Java Code Design Previous: 8.1.1 Class Hierarchy   Contents   Index

8.1.2 Numbering

A unique integer number is assigned to each state of a DCharts model. Internally, the state number is used instead of the name or full path of the state. This has two effects:

A linked list of current leaf states is maintained in each model. It may contain more than one state ID for a model with orthogonal components.

Two states of different models may have the same ID, whether there is an importation relation between those models or not. The Java function to get the current state first checks the leaf states that the main model is currently in. If any of those leaf states is originally (before importation) an importation state, it then further checks the current leaf states of the submodel imported in that state. This is because, unlike SVM, SCC does not merge the imported model with the importing model but it records the imported model as an attribute of the importation state. This lookup process repeats until the bottom of the state hierarchy is reached.

Similarly, all the events are numbered. Those event IDs are the internal representation of the events that trigger transitions. The synthesized code uses a switch-case structure to test acceptable events. Events handled by different models may have the same ID, even if they have different event names in their model descriptions.


next up previous contents index
Next: 8.1.3 Members of Model Up: 8.1 Java Code Design Previous: 8.1.1 Class Hierarchy   Contents   Index
Thomas Huining Feng 2004-04-28