next up previous contents index
Next: 8.2.2 State Properties Up: 8.2 Transformation Strategies Previous: 8.2 Transformation Strategies   Contents   Index

8.2.1 State Hierarchy

As was discussed previously, each state in a model is given an integer ID. Those IDs are unique within a single model but may be duplicated across different models. This is a flattening of the state hierarchy, which causes a loss of information, such as the parent-children relations and information about orthogonal components. Auxiliary functions and arrays are generated to preserve information like this.

Constant attributes ParentTable and Hierarchy of the model class record the parent-children relations. ParentTable[i] contains the state ID ($\geq 0$) of the parent of state i. If state i is at the top level, ParentTable[i] is equal to -1. Hierarchy[i][j] is a boolean specifying whether state j is a child of state i. With these data structures, the following simple Java function tests if a state is the parent of another state (suppose that a state with ID less than 0 is parent of any state):

private boolean isParent(int sp, int sc) {
return sc$>=$0 && (sp$<$0 $\vert\vert$ Hierarchy[sp][sc]);
}

Each model class has a state hierarchy defined in it. The hierarchy of a submodel is not visible from the model that imports it. However, the importation states are statically decided in the importing model. A model calls the member functions of its submodels to access to their states.


next up previous contents index
Next: 8.2.2 State Properties Up: 8.2 Transformation Strategies Previous: 8.2 Transformation Strategies   Contents   Index
Thomas Huining Feng 2004-04-28