Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Course 08

Download as pdf or txt
Download as pdf or txt
You are on page 1of 13

Democratic and Popular Republic of Algeria

Ministry of Higher Education and Scientific Research


University of Relizane
Faculty of Science and Technology
Department of Computer Science

3rd year Computer Science

Software Engineering
State Transition Diagram

1
Definition

• A state diagram is a diagram that expresses the behavior


• It describes how an object works when it receives an event (or before
it is received)
• It represents the different states in which an object can find itself and
the way in which this object passes to another state in response to an
event.

2
Example

3
State----------------Transition
State:
Describes a moment in the life of an instance. This instance can only
be in one state at a time.
Instances of the same class react to events in the same way.

Transition:
The response of an instance in a given state to an event.
Event: Triggers the transition.
Action: performing an operation when the transition is performed.

4
The State

• When it is created, the object is in an initial state.


• When the system no longer needs the object, it ends up in a final
state.

• An object may not have a final state.

5
The transition

• A Transition defines an Object's Response to the occurrence of an


Event .
• It indicates that an Object that is in a State can "Transit" to another
State, possibly performing certain activities.

6
Syntax of an event

• EVENT
it causes the crossing of the transition.
• GUARD-GUARD CONDITION: [] associate a condition with a transition. For the
transition to be crossed, the condition must be verified in addition to the
reception of the associated event, if it exists. It is a boolean expression (on the
attributes of the object or the parameters of the triggering event) which must be
true for the transition to be triggered ;
• EFFECT: ACTIVITY, a set of actions to be performed when triggered,
❑a primitive operation such as an instruction to assign a value to an attribute;
❑sending a signal;
❑calling an operation; etc.
❑when the action execution is completed, the target state of the transition
becomes active,

7
Example of a file

8
Types of events

1. Signal Event
2. Operation Call Event (Call Event ) (example openFile ())
3. Change Event
4.Time Event

9
temporal event
• events are generated by the flow of time.
• They are specified either absolutely (precise date),
• Absolutely ( triggered on a specific date)
• Syntax: when (date= “precise expression of a date”) ex: when (date=17/12/2010)
• • Relatively (triggered after a certain duration spent in the current state ).
• Syntax: after (“expression of a duration”) ex: after (10 seconds)

10
External/internal transition

11
Decision point

12
Distributor

13

You might also like