Lecture 13 State Models and State Pattern

Lecture 13 State Models and State Pattern - State Models...

Info iconThis preview shows pages 1–12. Sign up to view the full content.

View Full Document Right Arrow Icon
Copyright W. Howden 1 State Models and the State Pattern
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Copyright W. Howden 2 State Models Components States: a condition of an object Events: a state changing occurrence Transitions: from one state to the next, occur when the associated event occurs
Background image of page 2
Applications Class Design and Analysis User Interface design easy to use understandable designs State Pattern basic design pattern that facilitates change Copyright W. Howden 3
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Copyright W. Howden 4 Simple State Diagram Breakfast InClass Studying Sleeping Dinner Alarm ClassOver DinnerTime DinnerFinished ClassTime NextClassStartTime
Background image of page 4
Copyright W. Howden 5 Augmented Diagrams Constraints/guards Format: [c] e If event e occurs, transition takes place only if condition c is satisfied Actions Format: [c] e /a If event e occurs, and c holds, then action a is performed during the transition
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Copyright W. Howden 6 Student Example with Conditions NoMoreClasses] BreakfastOver Breakfast InClass Studying Sleeping Dinner Alarm ClassOver [<DinnerTime or More Classes] DinnerTime [NoMoreClasses] DinnerFinished ClassTime
Background image of page 6
UML State Charts Augmented state diagrams We will look at some additional features in subsequent examples Copyright W. Howden 7
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Copyright W. Howden 8 State Model Representation Graphical: useful for small systems Tables Better for larger models, easier to build up incrementally Event/state table For state x in row 1 column j, if there is a state y in row i column j, the event in row i column 1 causes a transition from state x to state y
Background image of page 8
Copyright W. Howden 9 Event/State Model Table State Event Sleeping Dinner In Class Breakfast Studying Alarm Breakfast BreakfastOver Studying ClassTime InClass Dinner Over Sleeping ClassOver [<DinnerTime or MoreClasses] Studying; NoMoreEvents] Dinner Dinner Time [NoMoreClasses] Dinner
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
State Models and Class Behavior Description Class instance/object states different combinations of class variable values correspond to different object states abstract states correspond to sets of combinations of values A class instance may behave differently depending on what (abstract) state it is in Copyright W. Howden 10
Background image of page 10
Modes of Behavior – Stack Example Following diagram has three abstract states empty, partial and full State diagram indicates that the mode of behavior for the stack is different depending
Background image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 12
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 38

Lecture 13 State Models and State Pattern - State Models...

This preview shows document pages 1 - 12. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online