This repository has been archived on 2022-11-20. You can view files and clone it, but cannot push or open issues or pull requests.
patterns/observer/request/app.d

23 lines
865 B
D
Raw Normal View History

2022-11-11 09:54:25 +00:00
module observer.request.app;
2022-11-11 07:56:59 +00:00
2022-11-11 09:54:25 +00:00
import observer.request.weatherdata;
import observer.request.currentconditionsdisplay;
import observer.request.heatindexdisplay;
import observer.request.forecastdisplay;
import observer.request.statiscticdisplay;
2022-11-11 00:03:18 +00:00
void main()
{
WeatherData weatherData = new WeatherData();
CurrentConditionsDisplay currentDisplay = new CurrentConditionsDisplay(weatherData);
2022-11-11 07:22:38 +00:00
HeatIndexDisplay heatIndexDisplay = new HeatIndexDisplay(weatherData);
2022-11-11 07:56:59 +00:00
ForecastDisplay forecastDisplay = new ForecastDisplay(weatherData);
StatisticsDisplay statisticsDisplay = new StatisticsDisplay(weatherData);
2022-11-11 00:03:18 +00:00
weatherData.setMeasurements(80, 65, 30.4f);
weatherData.setMeasurements(82, 70, 29.2f);
2022-11-11 07:56:59 +00:00
weatherData.removeObserver(forecastDisplay);
2022-11-11 00:03:18 +00:00
weatherData.setMeasurements(78, 90, 29.2f);
2022-11-11 07:22:38 +00:00
weatherData.setMeasurements(81, 72, 29.5f);
2022-11-11 00:03:18 +00:00
}