An event is the thing that triggers the transition. In your case counter > 4
is a change event, meaning "the counter value has changed and its value is now greater than 4".
The code between the brackets is the guard. In your case pin is high
, meaning "the transition is only enabled if the pin is high".
switch on
is the behavior that is executed when the transition is executed.
Footnote: In your example the event is indeed very similar to the guard.
In C it could look like that:
/**
* this interrupt is triggered when the
* counter exceeds the threshold (4)
*/
static void counter_isr(void)
{
if (pin_is_high(PIN))
switch_on();
}
From the UML 2.5 specification:
14.2.3.8 Transitions
...
A Transition may own a set of Triggers, each of which specifies an Event
whose occurrence, when dispatched, may trigger traversal of the
Transition. A Transition trigger is said to be enabled if the dispatched
Event occurrence matches its Event type.
14.2.4.9 Transition ...
The default textual notation for a Transition is defined by
the following BNF expression:
[<trigger> [‘,’ <trigger>]* [‘[‘ <guard>’]’] [‘/’ <behavior-expression>]]
In other words: trigger [guard] / behavior