38 lines
1000 B
Plaintext
38 lines
1000 B
Plaintext
classDiagram
|
|
class WeatherData {
|
|
getTemperature()
|
|
getHumidity()
|
|
getPressure()
|
|
measurementsChanged()
|
|
|
|
subscribe(observer: IWeatherObserver)
|
|
unsubscribe(observer: IWeatherObserver)
|
|
notify(data: WeatherRecord)
|
|
}
|
|
class WeatherRecord {
|
|
f32 temperature
|
|
f32 humidity
|
|
f32 pressure
|
|
}
|
|
class IWeatherObserver {
|
|
update(data: WeatherRecord)
|
|
}
|
|
class IWeatherSubject {
|
|
subscribe(observer: IWeatherObserver)
|
|
unsubscribe(observer: IWeatherObserver)
|
|
notify(data: WeatherRecord)
|
|
}
|
|
class WeatherScreen1 {
|
|
update(data: WeatherRecord)
|
|
draw()
|
|
}
|
|
IWeatherSubject <|.. WeatherData
|
|
IWeatherObserver <|.. WeatherScreen1
|
|
IWeatherObserver <-- IWeatherSubject : observers
|
|
WeatherData <-- WeatherScreen1 : Subjects
|
|
IWeatherObserver .. IWeatherSubject
|
|
class IDisplayElement {
|
|
draw()
|
|
}
|
|
IDisplayElement <|.. WeatherScreen1
|
|
|