list of dots Digital Research Alliance of Canada logo  NSERC logo  University of Ottawa logo / Université d'Ottawa

User Manual    [Previous]   [Next]   

E237 Composing Two State Entries

Umple semantic error related to state machine composition algorithm

A client can use more than one trait (and obtain more than one state machine) and so it is possible to have more than two states whose entry (or exit) actions (and do activities) need to be composed with the base state’s entry action. In this case, the composition algorithm needs to consider an order among them. Since we do not consider any order when traits are used by clients, this should be respected in the composition of actions. Therefore, the Umple compiler detects this case and raises this error. Note that this conflict happens if more than one state coming from used traits have an entry action.

The example below shows a case in which composition of entry actions is considered as a conflict. The base state s1 in class C1 has no entry action and so it can accept entry actions coming from state machines in T1 and T2. However, there are two entries coming from used traits which cause a conflict. Note that if class C1 did not have state machine sm, it would still be a conflict for composition. However, if state s1 in class C1 had an entry then this would not be a conflict because those entries coming from traits would be disregarded.

Example

// In this example, there is an error
// because class C rename the region
// name r1 to r2 which is already
// available in the state machine sm.
trait T{
  sm {
    s1{
      r1{ e1-> r11; }
      r11{}
      ||
      r2{ e2-> r21; }
      r21{}
    }
  }
}
class C{
  isA T<sm.s1.r1 as r2>;
}
      

Load the above code into UmpleOnline