DraftManualPageTracingStateMachines

Kevin Brightwell edited this page Aug 26, 2015 · 1 revision
Clone this wiki locally

Draft Manual Page - Tracing State Machines

This is one of a set of Draft manual pages

This will describe the syntax and semantics an MOTL or Umple feature being developed.When we have agreed on it, we will move towards test cases, implementation and formal manual pages.


Tracing State Machines
Tracing
noreferences

@@description

In Umple, if you request to trace a state machine, then calls to all event methods defined in that state machine will be traced, whether or not they cause a transition. Trace output will indicate the origin and destination state and the name of the event (and any argument -- which is to be a future extension). Trace output will also indicate whether or not the event caused a transition, and whether any guard evaluates to true or false.

A request to trace a substate is the same as requesting to trace an entire state machine except that the substate is considered as a state machine in its own right. Events causing incoming transitions to the substate are traced as well as events causing exit from the substate, and events defined within the substate that may cause transitions among nested substates. If there is more than one substate with the same name, either in different state machines or nested in different state machines, then all will be traced.

If any trace directive is located within a state, this the scope of the tracing is limited to when the object is in that state. So, for example, a trace directive to trace an attribute would normally trace all sets of the attribute. But if the trace directive was specified inside a state, then it would only trace sets of the attribute that occur during time-periods that the system is within that state.

@@syntax

TBD - place here all relevant non-terminals each in double-square brackets.

@@example

// This show how tracing can be performed on state machines
class CourseSection {

  // An association that will be used to demonstrate state-specific tracing
  1 -- * Registration;

  // Request to trace all changes of the status state machine
  trace status;

  status {
    Planned {
      open -> Open;
    }
    Open
    {
      // Request to trace  the Registration association only when in Open state
      trace Registration;
      close -> Closed;
    } Closed {}
  }
}

class Registration {}

@@endexample

@@example

// Example showing tracing of substates
class X {

  // This will trace both the s1 substate in sm1 and the s1 substate in sm2.
  trace s1;

  sm1 {
    sa {
      e2 -> sb;
    }
    sb {
      // This will trace the s2 only within sb
      trace s2;
      s1 {
        e3 -> s2;
      }
      s2 {
      }
    }

  }

  sm2 {
    s1 {
      e1 -> s2;
    }
    s2 {
    }
  }

}

@@endexample