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

User Manual    [Previous]   [Next]   

W1006 State Machine Not Parsed

Umple semantic warning reported when a state machine could not be fully parsed and is treated as 'extra code'.

In Umple, elements of a class not recognized as valid Umple are assumed to be elements of the target programming language that are embedded in the Umple. However, this warning is raised when the Umple compiler has reason to believe that the developer might have been trying to specify a state machine, because the segment of code starts with something like sm {.

Since that sequence is not found in target languages, and since it is easy to make a mistake specifying states, substates, guards, or events, this message is generated. If you encounter this message and indeed intended to specify a state machine, look carefully at the state machine code.

The following are some common mistakes and things to check if you get this warning when writing a state machine

  • Make sure the curly brackets match for each state machine, state, substate and action block.
  • Make sure there are semicolons after transitions. In the example below, a semicolon is needed at the end of line 9 to declare the transition.
  • In guards, make sure the expression is a valid condition (Boolean expression). For example, in the example below, the v = 5 should be v == 5.
  • Make sure the order of items in transitions is valid. For example, in the example below the arrow should be after the guard, not before it.
  • Make sure an element of the syntax is not missing. For example, in the example below, after the entry keyword there should be a slash / prior to the block of code to execute on entering the state. All such actions (exit actions and transition actions) also use the slash symbol, since this is the notation inherited from UML.

If you are still stuck when writing details of a state machine, comment out segments until you can narrow down the problem.

Example

// This example generates the warning
// on line 9 there is a missing semicolon
// on line 17 the = should be ==
// on line 24 the -> should be after the guard
// on line 30 there should be an / after entry
class X {
  sm1 {
    s1 {
      a -> sb
    }
    s2{}
  }

  Integer v = 0;
  sm2 {
    s3 {
      e1 [v = 5] -> s4;
    }
    s4 {}
  }

  sm3 {
    s5{
      e2 -> [v==1] s6;
    }
    s6{}
  }

  sm4 {
    s6 {
      entry {dosomething();}
      e3 -> s7;
    }
    s7 {}
  }
}
class X {
  sm {
    a -> b
    b -> c
  }
}

      

Load the above code into UmpleOnline