Chapter 5: State Modeling & Event Types

Object-Oriented Modeling and Design with UML (2nd Edition) — B.Tech Lecture Notes[cite: 1]

Learning Objectives for Students:

1. Core Concepts & Event Categories

An event is an instantaneous occurrence that can trigger a state transition[cite: 1]. UML categorizes them into three distinct primary types[cite: 1]:

1. Signal Event

An explicit, asynchronous message sent from one object to another[cite: 1].

Example: Pressing a power button on a TV remote[cite: 1].

Off powerButtonPressed() On

Figure 5.1: Signal Event Transition Diagram

2. Change Event

Fired continuously monitoring a boolean condition; triggers automatically when condition evaluates to true[cite: 1]. Syntactically noted using when (condition)[cite: 1].

Example: A thermal sensor activating a cooler when room temperature exceeds 30°C[cite: 1].

Normal when (temp > 30°C) Cooling

Figure 5.2: Change Event Transition Diagram

3. Time Event

Triggers after the passage of a specified duration or reaching a specific clock time[cite: 1]. Syntactically noted using after (duration) or at (time)[cite: 1].

Example: A web application timing out an inactive user session after 5 minutes.

ActiveSession after (5 minutes) LoggedOut

Figure 5.3: Time Event Transition Diagram

2. Complete System Example: Digital Watch

Combining various event types into a cohesive multi-mode system model:

TimeDisplay do / showCurrentTime() pressMode() [Signal] after(2 mins idle) [Time] Stopwatch do / runTimer() off()

Figure 5.4: State Diagram using multiple Event Types

Exam Tip: In University Exams, make sure to clearly write the event keyword prefix: