Presentation is loading. Please wait.

Presentation is loading. Please wait.

State Chart Diagrams.

Similar presentations


Presentation on theme: "State Chart Diagrams."— Presentation transcript:

1 State Chart Diagrams

2 UML Statechart Diagram
The Statechart diagrams are one of the five diagram in the UML for modeling the dynamic aspects of systems. هو احد طرق التمثيل الخمسه التي تعرض التغير علي النظام A statechart diagram shows a state machine. flow of control from state to state. يوضح هذا النوع : حالات جهازمحدد و شكل او شرط التغير من حالة لاخرى

3 UML Statechart Diagram(con.)
shows the different status of a class or object at different points in time يعرض الحالات المختلفة للبرنامج (class) في نقاط زمنيه مختلفة Use to illustrate aspects of a system that show interesting changes in behavior as time passes. يستخدم لتوضيح او عرض التغيرات الهامة علي النظام مع تغير الزمن

4 Events and States State – Is the condition of a object at a specific time. هي حالة البرنامج في لحظة زمنية محددة A telephone is on “idle” state until it is taken from the hook. مثال: الهاتف يكون في الوضع المثالي الى ان يتم رفع السماعة Event – Is an occurrence that triggered the state. هو الشرط او حدث الذي يغير من حالة النظام A telephone receiver is taken off the hook. مثال: استقبال مكالمة (يتم رفع سماعة الهاتف)

5 Illustrating External and Internal Events
There are three types of events: هنالك ثلاثة انواع للاحداث: External Event – Events caused by an outside actor, outside of the system’s boundary. احداث خارجية: تتم بواسطة مستخدم او نظام اخر خارج حدود النظام Internal Event – Events caused by an internal action, inside the system’s boundary. احداث داخلية: تتم بواسطة مستخدم او نظام اخر داخل حدود النظام Temporal Event – Events caused by a determined date or time clock. احداث مؤقتة: تتم في تاريخ او زمن محدد

6 Transitions Transition – Involves going from one state to the other when an event occurs. الانتقال: هو تغير حالة النظام الى اخرى بناء على حدث معين Transitions are label in form: Event [Guard] / Action يتم تمثيلها بالشكل الحدث [الشرط]/ التصرف When the event “off hook” occurs, transition the telephone from the “idle” state to the “active” state. عندما يتحقق الشرط «استقبال مكالمة» تتغير حالة النظام من الوضع «مثالي» الى الوضع «يعمل او نشط »

7 Statechart Diagrams A Statechart diagram shows the lifecycle of an object state initial State event transition

8 Statechart Diagrams (Cont.)
The state diagram on the previous slide illustrates a simple telephone state chart diagram, with states, events and transitions. المثال السابق يعرض طريقة عمل الهاتف باوضاعه المختلفه و الاحداث و الانتقال من حالة لاخرى The states are shown in round rectangles. The transitions are shown with arrows, and the events are the labels in each transition. حيث تظهر الحالة علي شكل مربع او مستطيل و يمثل الانتقال بسهم و لاحداث المختلفه تظهر على شكل نص على السهم

9 Concurrent State Diagrams
Sometimes, it is relevant to split the path of execution to two or more state diagrams في بعض الاحيان يتم فصل شكل التنفيذ على اكتر من رسم واحد These state diagrams represent paths of execution that execute concurrently هذا النوع من الرسم يوضح انماط التنفيذ المتكررة At some point, the paths of execution will join into the original execution path في بعض الاحيان هذه الانماط المختلفة تلتقي في نقاط تنفيذ اساسية

10 A Gas Station Example In Service Filling Gas Tank Washing Windshield
pumpGas tankFull Filling Gas Tank arrive depart beginWash endWash Washing Windshield

11 A Gas Station Example Filling Gas Tank Washing Windshield Divergence
pumpGas tankFull Filling Gas Tank arrive depart beginWash endWash Washing Windshield Divergence Convergence

12 When to use Statechart Diagrams
The next slide contains a list of common state- dependant objects that might be worth illustrating in a Statechart diagram: بعض انواع الانظمة التي تحتاج ان تمثل بواسطة هذا النوع :

13 Classes that benefit from Statechart Diagram
Stateful sessions – Server-side software objects Systems – classes representing the system Windows – window’s action “Edit-Copy” Transactions – The way transaction respond to events Devices – Microwave oven, Radio

14 Additional Statechart Diagram Notation
Additional features UML notation for statechart diagram: بعض طرق التمثيل للاضافية Transition actions Transition guard condition Nested states

15 Additional Statechart Diagram Notation (Cont.)
Transitions are what makes an action to fire, such as a method invocation. A transition also can have a Boolean test, such as a guard, that only happens if the test succeeds. الانتقال يمكن ان يكون اختبار لشرط محدد يتم فقط عندما يتحقق هذا الشرط Nested states represents substates. The substate inherits the transitions of its superstate. في حالة التداخل هذه يتم التفرع لاكثر من حالة جزئية ، كل منها يرث نفس الشروط الانتقال للحالة الاساسية

16 Additional Statechart Diagram Notation (Cont.)
Example of Transition action and guard notation

17 Statechart diagram from Sequence diagram:
The dynamic model provides two diagrams that model changes over time - Sequence Diagram - Statechart Diagram The key to understanding the relationship between these diagrams is in understanding states and events المفتاح لفهم العلاقة بينهما هي بفهم الحلات و الاحداث المختلفة للنظام

18 Statechart diagram from Sequence diagram:
A basic Sequence diagram with events and transitions: Event1 Event2 A B C

19 Statechart diagram from Sequence diagram:
Each vertical column represents a portion of the total lifeline for one object. كل خط رأسي يمثل جزء من عملية محددة على النظام Each event directed at a lifeline represents an event that might trigger a change in that object. كل سهم او حدث يتم رسمه قد يمثل تغير علي احد مكونات النظام The space between events on the object lifeline represents a period of time when the object remains in the same state . المسافة بين الاسهم تمثل الفترة الزمنية التي يبقى بها النظام على نفس الحالة The events pointing outward from the object lifeline represent either return values sent to other objects or send events .

20 How we determine the states:
The state of the object is defined by the values of one or more of its attributes. Use these values to find adjectives that describe the object's condition . For example, if one of the attributes indicates whether the object has been sold or not, then you might use sold and unsold as part or all of the state name.

21 How we determine the states:
Event1 Event Event1/C.event2 Return Retuen2/return1 Return1 A B C Draft SD for object B State name1 State name2 State name3

22 Use case : Purchase show seat
Example showseat : select select purchase cancel Use case : Purchase show seat Customer showseat Customer showseat

23 Example showseat (con t):
select select purchase Customer showseat Price ,not held, not sold Price , held, not sold Price ,not held, sold

24 Example showseat (con t):
select select cancel Customer showseat Price ,not held, not sold Price , held, not sold Price ,not held, not sold

25 Example showseat (con t):
Select cancel purchase Price Held Not sold Price Not held Not sold Price Not held Sold

26


Download ppt "State Chart Diagrams."

Similar presentations


Ads by Google