patterns/observer/delivery/app.d

23 lines
871 B
D
Raw Normal View History

2022-12-05 07:38:19 +00:00
module observer.delivery.app;
import observer.delivery.weatherdata;
import observer.delivery.currentconditionsdisplay;
import observer.delivery.heatindexdisplay;
import observer.delivery.forecastdisplay;
import observer.delivery.statiscticdisplay;
void main()
{
WeatherData weatherData = new WeatherData();
CurrentConditionsDisplay currentDisplay = new CurrentConditionsDisplay(weatherData);
HeatIndexDisplay heatIndexDisplay = new HeatIndexDisplay(weatherData);
ForecastDisplay forecastDisplay = new ForecastDisplay(weatherData);
StatisticsDisplay statisticsDisplay = new StatisticsDisplay(weatherData);
weatherData.setMeasurements(80, 65, 30.4f);
weatherData.setMeasurements(82, 70, 29.2f);
weatherData.removeObserver(forecastDisplay);
weatherData.setMeasurements(78, 90, 29.2f);
weatherData.setMeasurements(81, 72, 29.5f);
}