list of dots University of Ottawa logo / Université d'Ottawa

User Manual    [Previous]   [Next]   

Unspecified Events

In Umple, the keyword 'unspecified' can be used to handle events that have no handlers in the current state (and would normally be ignored) in a queued or regular state machine. If an 'unspecified' transition is present, no event in that state will be ignored. The keyword can be placed at any level of nesting of the state machine, and specifies a transition, using the same syntax as a regular event name (hence it can have a guard, and and action) as well as a destination state.

For example, in the first example below, if finishedClosing occurs while in the closed state, this event would be ignored if 'unspecified' were not present. But the 'unspecified' keyword causes a transition to be taken for any unexpected event while in closed, opening, open or closing states.

Note that tf the 'unspecified' keyword is used in a pooled state machine, it will simply be treated as a regular event since pooled state machines do not ignore events without handlers, but leave them at the head of the queue.

Unspecified transitions are particilarly useful to transition to error-handling states. In the examples below, the system transitions back to normal functioning after handing the error. The use of transitions to history can also be useful in this situation.


//A garage door can be modeled
//using unspecified events for
//error states

class GarageDoor {
  status {
    functionning {
      unspecified -> error;
      closed {
        pressButton -> opening;
      open {
        pressButton -> closing;
      closing {
        finishedClosing -> closed;
      opening {
        finishedOpening -> open;
    error {
      entry / {
        /* attempt to solve the issue */
      ready -> functionning;

Load the above code into UmpleOnline


Another Example

//The state machine sm makes use
//of the unspecified event to reach
//specific error states to complete

//If the machine is idle and receives
//a non-handled event, the destination
//state is error 1, while if the sm was
//in state active, the machines reaches
//error 2

class AutomatedTellerMachine{
  queued sm{
    idle {
      cardInserted -> active;
      maintain -> maintenance;
      unspecified -> error1;
    maintenance {
      isMaintained -> idle;
    active {
      entry /{readCard();}
      exit /{ejectCard();}
      validating {
        validated -> selecting;
        unspecified -> error2;
      selecting {
        select -> processing;
      processing {
        selectAnotherTransiction -> selecting;
        finish -> printing; 
      printing {
        receiptPrinted -> idle;
      cancel -> idle;
  void readCard() {/*Code would be written here*/}
  void ejectCard() {/*Code would be written here*/}


Load the above code into UmpleOnline



// A transition guard can come before or after the arrow
// The order of guard and event definition can also be interchanged
transition : ( [[eventDefinition]] [[guard]]
    | [[guard]] [[eventDefinition]]
    | [=unspecified]? [[guard]]
    | [[eventDefinition]])? ( [[action]] ->
    | -> [[action]]
    | -> ) [stateName] ;