A transition denotes a switch from one state to another. A transition indicates that if the specified trigger event occurs and the specified guard condition is true, the statechart switches from one state to another and performs the specified action. When this occurs, we say that the transition is taken.
The starting point of a transition lies on the border of the transition’s source state. The end point of a transition lies on the border of the transition’s destination state. A transition may freely cross simple state and composite state borders. If the source of a transition lies either on or inside a state, and the destination of that transition lies outside of the state, then that state is considered exited by the transition. If such a transition is taken, the exit action of the exited state is executed. If the source of a transition lies outside a state, and the destination of that transition lies either on or inside the state, then that state is considered entered by the transition. If such a transition is taken, the entry action of the entered state is executed. In case a part of a transition lies inside a state, but both source and destination are outside the state, this state is considered neither entered nor exited.
There is a special type of transition called internal transition. An internal transition lies inside a state, and both start and end points of the transition lie on the border of this state. Since an internal transition does not exit the enclosing state, neither exit nor entry actions are executed when the transition is taken. Moreover, the current simple state within the state is not exited too. Therefore, the internal transition is very useful for implementing simple background jobs, which should not interrupt the main activity of the composite state.
Name – The name of the transition.
Ignore – If selected, the transition is excluded from the model.
Show name – If selected, the name of the transition is displayed on a presentation diagram.
type of event that
triggers the transition.
Timeout – the transition is triggered after the specified timeout elapses.
Rate - the transition is triggered with the specified rate.
Condition - the transition is triggered when the specified boolean condition is true.
Message - the transition is triggered when a message arrives to the connected port.
Agent arrival - the transition is triggered when an agent (whose behavior is defined by this particular statechart) reaches its destination.
Timeout – [Visible if the transition is Triggered by: Timeout] The timeout triggering the transition. The transition triggering will be enabled after the specified timeout will elapse .
Rate – [Visible if the transition is Triggered by: Rate] The rate triggering the transition. The transition is executed with the timeout distributed exponentially with the parameter Rate (counted from the moment the statechart came to the transition's source state). I.e. if the rate is 5, the transition will be executed on average 5 times per time unit.
Condition – [Visible if the transition is Triggered by: Condition] The condition triggering the transition. The transition triggering will be enabled when the specified Boolean expression is true .
Message type – [Visible if the transition is Triggered by: Message] Specify the type of the message that will trigger this transition. You can choose one of the most-used types (int, double, boolean, String) using the corresponding option to the right. However, if your messages are of some other Java class, choose the Other option and type the required class name in the Class name field below.
[Visible if the
transition is Triggered
by: Message] Here
you can impose additional condition that should be satisfied to allow
Unconditionally – Choose this option if you do not want to perform message type checking.
On particular message - If selected, only messages equal to the text string specified in the Message edit box below will trigger the transition.
If expression is true - In the Expression field below, you can define a sophisticated message contents checking. The just received message can be accessed here as msg variable. If the specified expression returns true, the transition is triggered.
Action – Here you can write Java code to be executed when the transition is taken.
Guard – Boolean expression that allows (if returns true) or prohibits (if returns false) the transition. If the guard expression is not specified, true is assumed.
Transitions exiting branch states have the following properties, slightly different from other transitions properties:
Condition – If selected, this transition will be triggered when the boolean condition specified in the Condition field below will be true.
Default (is taken if all other conditions are false) – If selected, the transition is the default branch exit and will be taken if conditions defined for all other transitions exiting the branch state are false. If all outgoing transitions are closed and there is no default exit from a branch, a runtime error is issued.
Please note that transitions exiting branches do not have Guard conditions.
Triggering a transition
Statechart declaration rules
Statechart execution order