SlideShare a Scribd company logo
1 of 17
SARDAR PATELSARDAR PATEL
COLLEGE OF ENGINEERING,COLLEGE OF ENGINEERING,
BAKROLBAKROL
INFORMATION TECHNOLOGYINFORMATION TECHNOLOGY
DEPARTMENTDEPARTMENT
TOPIC NAME : State Diagram
SUBJECT NAME : OBJECT ORIENTED
PROGRAMMING Using Java(2140705)
STUDENT’S NAME ENROLLMENT NUMBER
Suken Vaghela 151240116061
Sunil Jethvani 151240116062
Vaidik Trivedi 151240116064
INFORMATION TECHNOLOGY
FACULTY NAME:
PROF. RONAK PATEL
State Diagrams
Chapter 14
What is State Diagram?
• Specifically a state diagram describes the behavior of
a single object in response to a series of events in a
system. Sometimes it's also known as a Harel state
chart or a state machine diagram. This UML diagram
models the dynamic flow of control from state to
state of a particular object within a system.
State Diagrams
• State diagrams describe the life of an object using three
main elements:
• States of an object
• Transitions between states
• Events that trigger the transitions
• A state diagram or statechart specifies a state machine
• A state machine is described for a class
• Each object has it’s own state machine
States
• Show what the dependencies are between the state of
an object and its reactions to messages or other events
• State
• is a condition or situation during the life of an object within
which it performs some activity, or waits for some events
• Has a name
• Has actions -- execute the state
• Has internal transitions -- transitions cause no change in a
state
• substates -- the nested structure of a state involving disjoint or
concurrent substates
States
• For example:
entry/unlock door
do/prepare materials
telephone rings/answer telephone
include/lecture state
exit/lock door
At Work state name
action performed on entry to state
activity performed while in state
action performed on arrival of named event
name of a sub-state machine
action performed on leaving state
Actions and Activities
• Action
• is an executable atomic computation
• includes operation calls, the creation or destruction of another
object, or the sending of a signal to an object
• associated with transitions and during which an action is not
interruptible -- e.g., entry, exit
• Activity is associated with states
• Non-atomic or ongoing computation
• May run to completion or continue indefinitely
• Will be terminated by an event that causes a transition from the
state in which the activity is defined
Events
• An event signature is described as
Event-name (comma-separated-parameter-list)
• Events appear in the internal transition compartment of a state or on a
transition between states
• An event may be one of four types
• Signal event
• Corresponding to the arrival of an asynchronous message or signal
• Call event
• Corresponding to the arrival of a procedural call to an operation
• Time event
• Change event
Time Event
• A time event occurs after a specified time has elapsed
• Event name is specified as keyword after
• Parameter list is an expression evaluating to a time interval
• after(10 seconds after state “At Work” is entered)
• No specified start time implies “since entry to the current
state”
• after(2 seconds)
Change Event
• A change event occurs whenever a specified condition is met
• Event name is specified as keyword when
• Parameter list is a boolean expression
• The event occurs when both of the following conditions are met,
irrespective of the order when they happen
• The expression evaluates to true
• The object is in the required state
• For example
• when (state = At Work)
• when (date = January 1 2007)
A transition is drawn as an arrow between states annotated with a
transition string
• The transition string denotes the event and consequent action
• Only one form of arrowhead is used on statecharts
• The distinction between call events and signal events must be deducted
from elsewhere e.g. an interaction diagram
A transition string is described as
• Event-signature [guard-condition]/action-expression^object.message
• If the guard condition is met the transition occurs immediately
Transitions
Transitions
• A transition whose string contains neither an event
signature nor a guard condition is said to be
unlabeled
• Occurs immediately
• May still carry an action expression
Transitions
• A transition is triggered when its event occurs
• If the guard condition is met, the transition is fired
• If the condition is not met the event is discarded
• The guard condition is checked only once
• If there is no guard condition, triggering will always cause firing
• Note the distinction between a guard condition and a change
event
• A guard condition is evaluated once, when the associated event
occurs
• A change event occurs whenever its associated condition is met
• Behaviour is as if the condition were being continually evaluated
State Diagrams notation
PaidUnpaid
paying
Invoice
created
Invoice
destroyed
name
state
final stateInitial state
transition
event
State Diagram Example
Checking
do / check
Item
Dispatching
do / initiate
delivery
Ordering Delivering
*[all items checked]
get next item
[all items checked
&& some items not
in stock]
Order Item
[all items checked &&
all items available]
Dispatch items
[all items available]
Item
received
delivery
get first item
Canceling
cancelled
Exit/ Item received
do / order Item
entry / deliver
Items
do / Remove
Item
some items
not in stock
all items
in stock
Summary
In this chapter we have:
• Introduced the terms used with respect to state
diagrams
• Discussed the context in which state diagrams are
used

More Related Content

What's hot (20)

state modeling In UML
state modeling In UMLstate modeling In UML
state modeling In UML
 
State Machine Diagram
State Machine DiagramState Machine Diagram
State Machine Diagram
 
Activity diagram
Activity diagramActivity diagram
Activity diagram
 
UNIFIED MODELING LANGUAGE
UNIFIED MODELING LANGUAGEUNIFIED MODELING LANGUAGE
UNIFIED MODELING LANGUAGE
 
Introduction to UML
Introduction to UMLIntroduction to UML
Introduction to UML
 
Software design
Software designSoftware design
Software design
 
Sequence diagram- UML diagram
Sequence diagram- UML diagramSequence diagram- UML diagram
Sequence diagram- UML diagram
 
Sequence diagrams
Sequence diagramsSequence diagrams
Sequence diagrams
 
UML
UMLUML
UML
 
Activity diagram
Activity diagramActivity diagram
Activity diagram
 
Activity diagram-UML diagram
Activity diagram-UML diagramActivity diagram-UML diagram
Activity diagram-UML diagram
 
UML Diagrams
UML DiagramsUML Diagrams
UML Diagrams
 
Unit 1( modelling concepts & class modeling)
Unit  1( modelling concepts & class modeling)Unit  1( modelling concepts & class modeling)
Unit 1( modelling concepts & class modeling)
 
08 state diagram and activity diagram
08 state diagram and activity diagram08 state diagram and activity diagram
08 state diagram and activity diagram
 
Object diagram
Object diagramObject diagram
Object diagram
 
Uml Activity Diagram
Uml Activity DiagramUml Activity Diagram
Uml Activity Diagram
 
object oriented methodologies
object oriented methodologiesobject oriented methodologies
object oriented methodologies
 
Class based modeling
Class based modelingClass based modeling
Class based modeling
 
Use case diagram
Use case diagramUse case diagram
Use case diagram
 
Use case Diagram
Use case Diagram Use case Diagram
Use case Diagram
 

Similar to Sardar Patel College of Engineering state diagram guide

Software Engineering :Behavioral Modelling - II State diagram
Software Engineering :Behavioral Modelling - II State diagramSoftware Engineering :Behavioral Modelling - II State diagram
Software Engineering :Behavioral Modelling - II State diagramAjit Nayak
 
STATE DIAGRAM.pptx
STATE DIAGRAM.pptxSTATE DIAGRAM.pptx
STATE DIAGRAM.pptxssuser2d043c
 
Free ebooks download ! Edhole
Free ebooks download ! EdholeFree ebooks download ! Edhole
Free ebooks download ! EdholeEdhole.com
 
Free ebooks download ! Edhole
Free ebooks download ! EdholeFree ebooks download ! Edhole
Free ebooks download ! EdholeEdhole.com
 
Programming models for event controlled programs
Programming models for event controlled programsProgramming models for event controlled programs
Programming models for event controlled programsPriya Kaushal
 
Slide 6 Activity Diagram
Slide 6 Activity DiagramSlide 6 Activity Diagram
Slide 6 Activity DiagramNiloy Rocker
 
Unit 3(advanced state modeling & interaction meodelling)
Unit  3(advanced state modeling & interaction meodelling)Unit  3(advanced state modeling & interaction meodelling)
Unit 3(advanced state modeling & interaction meodelling)Manoj Reddy
 
5. state diagrams
5. state diagrams5. state diagrams
5. state diagramsAPU
 
Unit 4- State Machine in mobile programming
Unit 4- State Machine in mobile programmingUnit 4- State Machine in mobile programming
Unit 4- State Machine in mobile programmingLeahRachael
 
Software System Engineering - Chapter 14
Software System Engineering - Chapter 14Software System Engineering - Chapter 14
Software System Engineering - Chapter 14Fadhil Ismail
 

Similar to Sardar Patel College of Engineering state diagram guide (20)

Diagrams
DiagramsDiagrams
Diagrams
 
State modeling
State modelingState modeling
State modeling
 
State Diagram.pdf
State Diagram.pdfState Diagram.pdf
State Diagram.pdf
 
Software Engineering :Behavioral Modelling - II State diagram
Software Engineering :Behavioral Modelling - II State diagramSoftware Engineering :Behavioral Modelling - II State diagram
Software Engineering :Behavioral Modelling - II State diagram
 
STATE DIAGRAM.pptx
STATE DIAGRAM.pptxSTATE DIAGRAM.pptx
STATE DIAGRAM.pptx
 
Java
Java   Java
Java
 
Seminar State Chart1
Seminar State Chart1Seminar State Chart1
Seminar State Chart1
 
State diagram
State diagramState diagram
State diagram
 
State diagram
State diagramState diagram
State diagram
 
State diagram
State diagramState diagram
State diagram
 
Free ebooks download ! Edhole
Free ebooks download ! EdholeFree ebooks download ! Edhole
Free ebooks download ! Edhole
 
Free ebooks download ! Edhole
Free ebooks download ! EdholeFree ebooks download ! Edhole
Free ebooks download ! Edhole
 
States machine
States machineStates machine
States machine
 
Programming models for event controlled programs
Programming models for event controlled programsProgramming models for event controlled programs
Programming models for event controlled programs
 
Events1
Events1Events1
Events1
 
Slide 6 Activity Diagram
Slide 6 Activity DiagramSlide 6 Activity Diagram
Slide 6 Activity Diagram
 
Unit 3(advanced state modeling & interaction meodelling)
Unit  3(advanced state modeling & interaction meodelling)Unit  3(advanced state modeling & interaction meodelling)
Unit 3(advanced state modeling & interaction meodelling)
 
5. state diagrams
5. state diagrams5. state diagrams
5. state diagrams
 
Unit 4- State Machine in mobile programming
Unit 4- State Machine in mobile programmingUnit 4- State Machine in mobile programming
Unit 4- State Machine in mobile programming
 
Software System Engineering - Chapter 14
Software System Engineering - Chapter 14Software System Engineering - Chapter 14
Software System Engineering - Chapter 14
 

Recently uploaded

Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝soniya singh
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxbritheesh05
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130Suhani Kapoor
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerAnamika Sarkar
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escortsranjana rawat
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZTE
 
Current Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLCurrent Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLDeelipZope
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfAsst.prof M.Gokilavani
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxDeepakSakkari2
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.eptoze12
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learningmisbanausheenparvam
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024Mark Billinghurst
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...srsj9000
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionDr.Costas Sachpazis
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineeringmalavadedarshan25
 

Recently uploaded (20)

Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptx
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
 
Current Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLCurrent Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCL
 
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptx
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learning
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineering
 

Sardar Patel College of Engineering state diagram guide

  • 1. SARDAR PATELSARDAR PATEL COLLEGE OF ENGINEERING,COLLEGE OF ENGINEERING, BAKROLBAKROL INFORMATION TECHNOLOGYINFORMATION TECHNOLOGY DEPARTMENTDEPARTMENT
  • 2. TOPIC NAME : State Diagram SUBJECT NAME : OBJECT ORIENTED PROGRAMMING Using Java(2140705) STUDENT’S NAME ENROLLMENT NUMBER Suken Vaghela 151240116061 Sunil Jethvani 151240116062 Vaidik Trivedi 151240116064 INFORMATION TECHNOLOGY FACULTY NAME: PROF. RONAK PATEL
  • 4. What is State Diagram? • Specifically a state diagram describes the behavior of a single object in response to a series of events in a system. Sometimes it's also known as a Harel state chart or a state machine diagram. This UML diagram models the dynamic flow of control from state to state of a particular object within a system.
  • 5. State Diagrams • State diagrams describe the life of an object using three main elements: • States of an object • Transitions between states • Events that trigger the transitions • A state diagram or statechart specifies a state machine • A state machine is described for a class • Each object has it’s own state machine
  • 6. States • Show what the dependencies are between the state of an object and its reactions to messages or other events • State • is a condition or situation during the life of an object within which it performs some activity, or waits for some events • Has a name • Has actions -- execute the state • Has internal transitions -- transitions cause no change in a state • substates -- the nested structure of a state involving disjoint or concurrent substates
  • 7. States • For example: entry/unlock door do/prepare materials telephone rings/answer telephone include/lecture state exit/lock door At Work state name action performed on entry to state activity performed while in state action performed on arrival of named event name of a sub-state machine action performed on leaving state
  • 8. Actions and Activities • Action • is an executable atomic computation • includes operation calls, the creation or destruction of another object, or the sending of a signal to an object • associated with transitions and during which an action is not interruptible -- e.g., entry, exit • Activity is associated with states • Non-atomic or ongoing computation • May run to completion or continue indefinitely • Will be terminated by an event that causes a transition from the state in which the activity is defined
  • 9. Events • An event signature is described as Event-name (comma-separated-parameter-list) • Events appear in the internal transition compartment of a state or on a transition between states • An event may be one of four types • Signal event • Corresponding to the arrival of an asynchronous message or signal • Call event • Corresponding to the arrival of a procedural call to an operation • Time event • Change event
  • 10. Time Event • A time event occurs after a specified time has elapsed • Event name is specified as keyword after • Parameter list is an expression evaluating to a time interval • after(10 seconds after state “At Work” is entered) • No specified start time implies “since entry to the current state” • after(2 seconds)
  • 11. Change Event • A change event occurs whenever a specified condition is met • Event name is specified as keyword when • Parameter list is a boolean expression • The event occurs when both of the following conditions are met, irrespective of the order when they happen • The expression evaluates to true • The object is in the required state • For example • when (state = At Work) • when (date = January 1 2007)
  • 12. A transition is drawn as an arrow between states annotated with a transition string • The transition string denotes the event and consequent action • Only one form of arrowhead is used on statecharts • The distinction between call events and signal events must be deducted from elsewhere e.g. an interaction diagram A transition string is described as • Event-signature [guard-condition]/action-expression^object.message • If the guard condition is met the transition occurs immediately Transitions
  • 13. Transitions • A transition whose string contains neither an event signature nor a guard condition is said to be unlabeled • Occurs immediately • May still carry an action expression
  • 14. Transitions • A transition is triggered when its event occurs • If the guard condition is met, the transition is fired • If the condition is not met the event is discarded • The guard condition is checked only once • If there is no guard condition, triggering will always cause firing • Note the distinction between a guard condition and a change event • A guard condition is evaluated once, when the associated event occurs • A change event occurs whenever its associated condition is met • Behaviour is as if the condition were being continually evaluated
  • 16. State Diagram Example Checking do / check Item Dispatching do / initiate delivery Ordering Delivering *[all items checked] get next item [all items checked && some items not in stock] Order Item [all items checked && all items available] Dispatch items [all items available] Item received delivery get first item Canceling cancelled Exit/ Item received do / order Item entry / deliver Items do / Remove Item some items not in stock all items in stock
  • 17. Summary In this chapter we have: • Introduced the terms used with respect to state diagrams • Discussed the context in which state diagrams are used