1 / 12

Unified Modeling Language - Events and State Machines

Unified Modeling Language - Events and State Machines. 劉建宏. Events. An events is the specification of a significant occurrence that has a location in time and space. In the UML, there are four kinds of events: signals calls the passing of time a change in state. Signals an Call Events.

mairi
Download Presentation

Unified Modeling Language - Events and State Machines

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Unified Modeling Language - Events and State Machines 劉建宏 NCKU EE RTES LAB.

  2. Events • An events is the specification of a significant occurrence that has a location in time and space. • In the UML, there are four kinds of events: • signals • calls • the passing of time • a change in state NCKU EE RTES LAB.

  3. Signals an Call Events • A signal represents a named object that is dispatched asynchronously by one object and then received by another. • Signals have a lot in common with plain classes. • A call event represents the dispatch of an operation. • A call event is synchronous. NCKU EE RTES LAB.

  4. Signals and Call Events • A signals may be sent as the action of a state transition in a state machine or the sending of a message in an interaction. MovementAgent <<signal>>Collision positionvelocity <<send>> force:Float moveTo() • When an object invokes an operation on another object, control passes from the sender to the receiver, the operation is completed, control returns to the sender. startAuotopilot(normal) Automatic Manual NCKU EE RTES LAB.

  5. Signals and Call Events • Any instance of any class can send a signal to or invoke an operation of a receiving object. • When an object sends a signal, the sender dispatches the signal and then continues along its flow of control, not waiting for any return from the receiver. • When an object calls an operation, the sender dispatches the operation and then waits for the receiver. NCKU EE RTES LAB.

  6. Time and Change Events • after - A time event is an event that represents the passage of time. • when - A change event is an event that represents a change in state or the satisfaction of some condition. when (11:49PM) / selfTest() after (2 seconds)/ dropConnection() Idle Active NCKU EE RTES LAB.

  7. State Machine • Interaction can model the behavior of a society of objects that work together. • State machine can model the behavior of an individual object. • A state machine is a behavior that specifies the sequences of states an object goes through during its lifetime in response to events. NCKU EE RTES LAB.

  8. Terms • A state is a condition or situation during the life of an object during which it satisfies some condition, performs some activity, or waits for some event. • In the context of state machines, an event is an occurrence of a stimulus that can trigger a state transition. • A transition is a relationship between two states indicating that an object in the first state will enter the second state. NCKU EE RTES LAB.

  9. States • Name – a textual string • Entry/exit actions – actions executed on entering and exiting the state • Internal transitions – transitions that are handled without causing a change in state • Substates – the nested structure of a state • Defferred events – a list of events that are not handled in that state but, are postponed and queued for handling by the object in another state • Initial and final states NCKU EE RTES LAB.

  10. Transitions • Source state – the state affected by the transition • Event trigger – the event whose reception by the object in the source state makes the transition eligible to fire • Guard condition – a boolean expression that is evaluated when the transition is triggered by the reception of the event trigger • Action – an executable atomic computation • Target state – the state that is after the completion of the transition • Note: A change of state is said to fire. NCKU EE RTES LAB.

  11. time event send signal After (2 seconds) / send c.isAlive self-transition triggeriess transition event trigger noise Idle Searching Engaging event trigger with parameters guard condition targetAt(p) [isThreat] / t.addTarget(p) contact Tracking Engaging action NCKU EE RTES LAB.

  12. final state initial state state shutDown event parameter Idle tooHot(desiredTemp) tooCold(desiredTemp) event event atTemp atTemp Heating tooHot(desiredTemp) Cooling ready/turnOn() Activating state tooCold(desiredTemp) Active transition nested state NCKU EE RTES LAB.

More Related