Question

In: Computer Science

In a state machine diagram with composite states, what is the meaning of a transition that...

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?

Solutions

Expert Solution

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:

  1. Composite and nested states
  2. Orthogonal regions

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:

  1. State Name – Name of State
  2. Entry – Action performed on entry to state
  3. Do Activity – Action performed on entry to state
  4. Exit State – Action performed on leaving state
  5. Deferrable Trigger – A list of events that are not handled in that state but, rather, are postponed and queued for handling by the object in another state

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

  1. A transition is a relationship between two states indicating that an object in the first state will perform certain actions and enter the second state when a specified event occurs and specified conditions are satisfied.
  2. Transition fires means change of state occurs. Until transition fires, the object is in the source state; after it fires, it is said to be in the target state.
  3. A transition has five parts:
    1. Source state – The state affected by the transition
    2. Event trigger – a stimulus that can trigger a source state to fire on satisfying guard condition,
    3. Guard condition – Boolean expression that is evaluated when the transition is triggered by the reception of the event trigger,
    4. Action – An executable atomic computation that may directly act on the object that owns the state machine, and indirectly on other objects that are visible to the object,
    5. Target state – The state that is active after the completion of the 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:

  1. May cause a change in state
  2. May trigger actions –  Actions can be internal or external
  3. May have associated conditions
  4. Signal events can be used to communicate between state machines

Guard Condition

  1. State transition label –  Event [Guard Condition]
  2. Condition is a Boolean function
    1. Conditions are optional on state machines
    2. Condition is true for finite period of time
  3. When event occurs, condition must be true for state transition to occur. If condition is false, state transition does not occur.

Actions

Action is executed as a result of instantaneously of state transition. State transition label can be expressed as the following format

  1. Event / action(s)
  2. Event [condition] / action(s)
  3. Entry/exit actions

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.

  1. Substates may be nested to any level.
  2. A nested state machine may have at most one initial state and one final state.
  3. Substates are used to simplify complex flat state machines by showing that some states are only possible within a particular context (the enclosing 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:

  1. One state of each region is always active at any point in time, i.e., concurrent substrates
  2. Entry: transition to the boundary of the orthogonal state activates the initial states of all regions
  3. Exit: final state must be reached in all regions to trigger completion event

Note That:

You can use parallel and synchronized node to ordinate different substates. Concurrent Substates are independent and can complete at different time.


Related Solutions

In a state machine diagram with composite states, what is the meaning of a transition that...
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?
In what respects does a UML state diagram differ from a state transition diagram?
In what respects does a UML state diagram differ from a state transition diagram?
What is the possible transition diagram of Turing Machine for the given expression? M (x, y)...
What is the possible transition diagram of Turing Machine for the given expression? M (x, y) = x + y where x and y are integers expressed in unary notation to calculate f (2,3), then the input will be 110111
A state diagram shows the states of an object and the transitions between states •States are...
A state diagram shows the states of an object and the transitions between states •States are particularly common with objects that interact with the program user. •Suppose that a user wants to retrieve recent voice mail messages. •Some part of the voice mail system must keep track of the current state so that it can process the user input correctly Java. I need a state diagram for the following code: What the code Does: adds a new regular task, delete...
Draw ATM Scenario and Library Scenario by component diagram and state machine diagram
Draw ATM Scenario and Library Scenario by component diagram and state machine diagram
In Problem is there a unique way of filling in the missing probabilities in the transition diagram? If so, complete the transition diagram and
In Problem is there a unique way of filling in the missing probabilities in the transition diagram? If so, complete the transition diagram and write the corresponding transition matrix. If not, explain why.  
In Problem is there a unique way of filling in the missing probabilities in the transition diagram? If so, complete the transition diagram and
In Problem is there a unique way of filling in the missing probabilities in the transition diagram? If so, complete the transition diagram and write the corresponding transition matrix. If not, explain why.  
Describe transition state theory and how it applies to enzyme catalysis. Why is a transition-state analog...
Describe transition state theory and how it applies to enzyme catalysis. Why is a transition-state analog not necessarily the same as a competitive inhibitor?
3. Sketch a T-v diagram and find the specified state for the following states a. Propane...
3. Sketch a T-v diagram and find the specified state for the following states a. Propane at critical temp & press find T(°C), p(bar) and v(m3 /kg) b. Water v=.05 m3 /kg, T=140°C find p(bar) c. Water at p=30 MPa, T=100°C find v(m3 /kg)
Chemical reactions are often described using a three state model: Reactants→Transition State→ProductsReactants→Transition State→Products In most cases...
Chemical reactions are often described using a three state model: Reactants→Transition State→ProductsReactants→Transition State→Products In most cases the energy of the transition state is much higher than the energy of the reactant state. This means that the reaction cannot proceed until there is a random thermal fluctuation large enough to `kick' the reactant molecule(s) up to the transition state energy. Say we have a reaction in which the transition state is 9.0×10−20 J above the reactant state. a.) Calculate the ratio...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT