0% found this document useful (0 votes)
15 views11 pages

3.2state Machines

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views11 pages

3.2state Machines

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 11

State machines

• A state machine is used to model the behavior of an


independent object.
• It specifies a sequence of states an object goes through
during it’s life time in response to events together with
it’s response to those events.
• State is a condition or situation during the life of an
object during which it satisfies some conditions,
perform some activity or wait for an event. It is
rendered as a rounded as a rectangle with rounded
corner.
• An event is the specification of a significant occurrence
that has a location in time and space.
• An event is an occurrence of a stimulus that can trigger
a state transition (context of state m/c)
• 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.
It is rendered as a solid directed line or path
• An activity is a ongoing nonatomic execution
within a state machine
• An action is an executable computation that
results in achange in state of the model or the
return of a value.
• 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.
It is rendered as a solid directed line or path
• An activity is a ongoing nonatomic execution
within a state machine
• An action is an executable computation that
results in achange in state of the model or the
return of a value.
• Context lifetime-msg-not need m/c-no
transition
States
•State is a condition or situation during the life of an
object during which it satisfies some conditions, perform
some activity or wait for an event.
State has several parts:
Name
Entry/exit actions
Internal transitions-transitions that are handled
without causing a change in state
Sub states-nested structure of a state.
Differed event :events that are postponed and
queued for handling by the object in another
state.
Transitions
A Transition has five parts

Source state-The state affected by the transition


Event trigger-which makes the transition eligible
to fire.
Guard condition-A boolean expression that is
evaluated when the transition is triggered.
Action-computation that may act on the object
that owns the state machine.
Target state-the state that is active after
completion of the transition.
• Sub machines
• A state machine may be referenced within another state
machine such a referenced state machine is called a
submachine( large state model)
• Sub states is a state ie. nested inside another one
• Simple state – has no sub states
• Composite state-has sub states
• Active objects- another way to model concurrency,
rather than partitioning one object ‘s state machine into 2
concurrent regions u would define 2 active objects. each of
which is responsible of one of the concurrent regions.
Sequential sub states
• Sequential sub states partition the state space of the
composite state into disjoint states.
• And the object can be in one of the sub states at any time.
• The sub states are validating customer,select
transaction,process the transaction, print receipt.

Active
Card inserted validating
Idle
cancel [more]
processing
mainte selecting
nance finished
maintenance
printing
Entry/readcard
Exit/eject card
History states
• We would like to model an object so that it remember the
last substate that was active prior to leaving the composite
state
• H is the history state (small circle)

H
collecting
command
query

copying

cleaning
Concurrent sub states- 2 or more state machines that
execute parallel in the context of an enclosing object

Idle

fork join

ATM maintenance

Testin
g Self
testing diagnosis

Commanding [continue]
comman
waiting
d
[not
Key press
continue]

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy