0% found this document useful (0 votes)
122 views20 pages

State Transition Diagram

An object's state can change due to internal or external events, attribute changes, or operations. State transition diagrams show the states an object can be in and the transitions between states caused by events. A state represents an interval between events and is characterized by attribute values. Transitions between states are triggered by events and may have conditions or operations associated with them.

Uploaded by

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

State Transition Diagram

An object's state can change due to internal or external events, attribute changes, or operations. State transition diagrams show the states an object can be in and the transitions between states caused by events. A state represents an interval between events and is characterized by attribute values. Transitions between states are triggered by events and may have conditions or operations associated with them.

Uploaded by

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

State Transition Diagram

`TEAM’ANG
An Object’s state and behavior can
affected by:
▪ Changes to attribute values
▪ Results of operations
▪ Changes of links with other objects
▪ Internal events
▪ External events
Three models

▪ Object model:
– Static structure of objects in a system and their relationship
– Contains class diagrams

▪ Dynamic model:
– Describes aspects that change over time: state transition diagram

▪ Functional model:
– Use case diagram
Dynamic modelling

▪ Events
▪ States
▪ State diagrams
▪ Conditions
▪ Operations
Events

▪ Something that happens at a point in time


– Mouse button clicked / Signal changes

▪ Logically ordered events – causally related

▪ Concurrent events – causally unrelated


– Do not effect each other
– There is no order between them

▪ 1-way transmission of information from one object to another


Event classes

▪ Event occurrences are grouped into event classes


– Flight 123 departs from Chicago / Flight 456 departs from Rome
– Event class is Flight Departs

▪ Attributes of event classes


– Departure origin of flight
– Flight number

▪ Data values are Attributes


Event Classes and Attributes

▪ Aeroplane flight departs (airline, flight no, city)


▪ Mouse button pushed (button, location)
▪ Input string entered (text)
▪ phone receiver lifted
▪ digit dialled (digit)
▪ engine speed enters danger zone
States

▪ A state is an abstraction of the attribute values and links of an object. Sets of


values are grouped together into a state according to properties that affect
the gross behaviour of the object.
▪ E.G.. A bank is solvent or insolvent depending on whether it’s assets exceed
it’s liabilities.
▪ A state corresponds to the interval between 2 events received by an object.
– A state separates 2 events.
– An event separates 2 states.
Characterisations of a state

▪ State: Alarm ringing

▪ Description: alarm on watch is ringing to indicate target time

▪ Event sequence that produces the state:


– set alarm (target time)
– any sequence not including clear alarm
– current time = target time
Condition that characterises the state:

alarm = on,
and
target time <= current time <= target time + 20s
and
button has not been pushed since the target time
Events accepted in the state:

event action next state


current time = target time + 20s reset alarm normal
button pushed (any button) reset alarm normal
State Diagrams

▪ Relates to a specific object


▪ Relate states and events
▪ A change of state is called a transition
▪ All transitions leaving a state must correspond to different events
▪ The transition fires
▪ An event that has no transition is ignored
▪ A sequence of events corresponds to a path through the graph
State Transition Diagram
Initial/final States

▪ The previous example is a continuous loop


▪ Most situations will have an initial and final state
▪ Chess game
Conditions

▪ Used as guards on transitions.


– A guarded transition only fires when the condition is true e.g.
▪ When you go out in the morning (event),
▪ If the temperature is below freezing (condition).
▪ Put on your gloves (next state).
State Transition Diagram With Conditions
Operations

▪ Attached to state
▪ Performed in response to the state
▪ Attached to a transition
▪ Performed in response to the event
Activities and Actions

▪ An activity is an operation that takes time.


– E.G.. Display a picture on a screen.
– “Do:a ” indicates that activity A occurs throughout the lifetime of the state
to which it is attached.
▪ An action is an instantaneous operation.
– E.G.. Disconnect phone line.
– An action is shown on a transition as “action / event.”
Nesting Diagrams

▪ Done by generalising states


– E.G. Aircraft in flight

▪ Done by generalising events


– E.G. Booking clerk books flight

You might also like