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

User Manual    [Previous]   [Next]   

Events With Parameters

An event can have a parameter (of any valid type that the generated language can accept). The generated event method will have this parameter. The value of the parameter can be used in guards or transition actions.

It is absolutely necessary that all events with the same name have the same parameter type, or else an error will be raised.


// The do activity of the first state machine is a thread that
// communicates with the second state machine.
// It calls the event method e with different arguments.
// The second state machine only changes state when the
// guard detects that the argument is valid
// The argument is also used in the transition action code.
class X {
  stateMachine1 {
    s1a {
      do {
        // This do activity sends events to stateMachine2
      -> s1b;
    s1b {}
  stateMachine2 {
    s2a {
      entry / {System.out.println("s2a");}
      e(int a) [a > 6] / {System.out.println("e"+a);} -> s2b;
    s2b {
      entry / {System.out.println("s2b");}
      e(int a) / {System.out.println("e"+a);} -> s2a;
  public static void main(String [ ] args) {
    X x = new X();


Load the above code into UmpleOnline