Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 5 state Modeling

Similar presentations


Presentation on theme: "Chapter 5 state Modeling"— Presentation transcript:

1 Chapter 5 state Modeling

2 5. State Modeling State Model consists of multiple state diagrams – one for each class with important temporal behavior State diagrams relate events and states Events States Transitions and Conditions State Diagram State Diagram Behavior

3 5.1 events An occurrence at a point in time
Happens instantaneously with regard to the time scale of an application Two events that are causally unrelated are said to be concurrent – no effect on each other Events include error conditions & normal occurrences Examples : Transaction Aborted ; Time Out Three Kinds of Events Signal Event Change Event Time Event

4 5.1 Three Kinds of events 5.1.1 Signal Event
Signal : An explicit message - one way transmission of info from one object to another Example Traffic Light Signal event : It’s an occurrence in time UML Notation of Signal in a class Keyword “Signal” in guilemets << >> 5.1.2 Change Event A event that is caused by the satisfaction of a boolean expression UML Notation Keyword “when” followed by paranthesized boolean expression When (battery power < lowerlimit) 5.1.3 Time Event An event that is caused by the occurrence of an absolute time or the elapse of a time interval Keyword “when” - in parathesis expression involving time Eg: when (date = September ) Keyword “after” - in paranthesis expression that evaluates to a time duration Eg: after (10 seconds)

5 5.2 States An abstraction of the values & links of an object
Often a verb with a suffix of “ing” Phone states - Waiting; Dialing UML Notation A rounded box containing a optional state name Convention: State name in bold, center & near the top of the box with Capitalize Various Characterization of States - Refer Book

6 5.3 Transitions & Guard conditions
Transition: Instantaneous change from one state to another Guard Conditions(GC): Boolean expression that must be true in order for a transition to occur UML Notation: Transition: A line from the origin state to the target state. An arrow head points to the target. Guard Condition: Optionally listed in square brackets A GC triggers only once is different from Change Event which needs to be satisfies all time.

7 5.4 state diagram A graph whose nodes are states & whose arcs are transition between states State names must be unique within the scope of a state diagram UML Notation A state diagram is a rectangle with its name in a small pentagonal tag in the upper left corner 5.4.1 Sample State Diagram 5.4.2 One shot State Diagram Represents Object with finite lives and have initial & final states

8 5.5 StATE DIAGRAM BEHAVIOR 5.5.1 Activity Effects
Activity: Actual behavior that can be worked by any number of effect Effect: A reference to a behavior that is executed in response to an event An activity may be performed upon a transition or event within a state UML Notation “/” & the name of the activity following the event that causes it “do” keyword for ongoing activity

9 5.5.2 do activities A do activity is an activity that continues for an extended time A do activity can only occur within a state & cannot be attached to a transition

10 5.5.3 Entry & exit activities
Activities can be bound to entry or to exit from a state or on transition If a state has multiple activities they are performed in order Activities on incoming transition Entry activities Do activities Exit activities Activities on the outgoing transition Any event can occur within a state & cause an activity to be performed Self transition: Causes entry & exit activities to be executed

11 5.5.4 Completion transition
An arrow without an event name indicates an automatic transition that fires when the activity associated with the source state is completed Such unlabelled transition are called completion transition as they are triggered by completion of activity in the source state

12 5.5.5 Sending signals From one object if a signal is sent to another object If an object can receive signals from more than one object the order in which concurrent signals are received may affect the final state. This is called race condition


Download ppt "Chapter 5 state Modeling"

Similar presentations


Ads by Google