Transition

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.

Internal transitions

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.

 
Transitions

 To draw a transition
  1. Drag the  Transition element from the  Statechart palette onto the graphical diagram of agent (so that the starting point of the transition lies on a border of a state or pseudo state). Then drag the ending point of the transition onto a border of another state.
  2. In some cases (especially when you want to draw a transition containing turning point(s)) it is more convenient to use drawing mode. To activate it, double-click the  Transition element in the palette. Its icon will turn into . Now you can draw a transition in the following way: first, click in the place of the diagram, where the starting point of the transition should be located, then subsequently click the points where the transition should turn and finally double-click the ending point of the transition. As the result, the transition of the required form will be drawn at once.
Properties

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.

Triggered by –  Choose the 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.

Fire transition –  [Visible if the transition is Triggered by Message] Here you can impose additional condition that should be satisfied to allow transition triggering.

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.

ActionHere 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 field to the right 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 falseIf 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.


Related topics

 Statecharts

 Statechart declaration rules

 Statechart execution order