In: Computer Science
In a state machine diagram with composite states, what is the meaning of a transition that goes from the boundary of a state? What is the meaning of a transition that goes to the boundary of a state?
A state machine diagram is a behavior that specifies the sequences of states an object goes through during its lifetime in response to events. A state machine are used to specify the behavior of objects that must respond to asynchronous stimulus or whose current behavior depends on their past. A state machines are used to model the behavior of objects, use cases, or even entire systems, especially reactive systems, which must respond to signals from actors outside the system.
In UML, state machines introduce the two new concepts in additional to traditional start chart notation:
Graphically, a state is rendered as a rectangle with rounded corners. A transition is rendered as a solid directed line.
State
A state is a condition during the life of an object which it may either satisfy some condition for performing some activities, or waiting for some events to be received.
A state has five parts:
An object remains in a state for a finite amount of time. For example, a Heater in a home might be in any of four states: Idle, Cooling, Heating, Initiating and Active.
Transition
Source and Target State
Source State: The state affected by the transition; if an object is in the source state, an outgoing transition may fire when the object receives the trigger event of the transition and if the guard condition, if any, is satisfied.
Target State: The state that is active after the completion of the transition.
Events
Event is a discrete signal that happens at a point in time. It also known as a stimulus and in a kind of input to an object. Here is the characteristics of events:
Guard Condition
Actions
Action is executed as a result of instantaneously of state transition. State transition label can be expressed as the following format
Decision Node
A Decision ode is used to represent a test condition to ensure that the control flow or object flow only goes down one path.
Fork node is a pseudo state used to split an incoming transition into two or more transitions terminating on orthogonal target vertices. The segments outgoing from a fork vertex must not have guards or triggers and it must have exactly one incoming and at least two outgoing transitions.
Join node is a pseudo state used to merge several transitions emanating from source vertices in different orthogonal regions. The transitions entering a join vertex cannot have guards or triggers and it must have at least two incoming transitions and exactly one outgoing transition.
Merge node is used to bring back together different decision paths that ware created using a decision node.
Choice is a pseudo state which, when reached, result in the dynamic evaluation of the guards of the triggers of its outgoing transitions. This realizes a dynamic conditional branch. It allows splitting of transitions into multiple outgoing paths such that the decision on which path to take.
Example: Choice Node for State Machine Diagram
Terminate is a pseudo state indicates that the lifeline of the state machine has ended. A terminate pseudo-state is represented by a cross.
Unlike a final state, a terminate pseudo state implies that the state machine is ended due to the context object is terminated. There is no exit of any states nor does the state machine perform any exit actions other than the actions associated with the transition that leads to the terminate state.
Composite State
A simple state is one which has no substructure. Composite States can be further broken down into substates (either within the state or in a separate diagram). A state which has substates (nested states) is called a composite state.
Composite State vs Submachine State
Besides composite state, there is another symbol called submachine state, which is semantically equivalent to a composite state.
Orthogonal State
A composite state with two or more regions is called orthogonal. Unlike composite states, submachine states are intended to group states, so you can reuse them. Orthogonal state is divided into two or more regions separated by a dashed line:
Note That:
You can use parallel and synchronized node to ordinate different substates. Concurrent Substates are independent and can complete at different time.