Beispiel #1
0
        public void RunSimulation()
        {
            var ferengi   = new Planet("Ferengi", new PolarCoordinates(0, 500), -1);
            var betasoide = new Planet("Betasoide", new PolarCoordinates(0, 2000), -3);
            var vulcano   = new Planet("Vulcano", new PolarCoordinates(0, 1000), 5);

            var solarSystem = new SolarSystem(new List <Planet>()
            {
                ferengi, betasoide, vulcano
            });
            var weatherCollection = new WeatherConditionCollection();

            var droughtObserver     = new DroughtObserver(weatherCollection);
            var rainObserver        = new RainObserver(weatherCollection);
            var optimalCondObserver = new OptimalConditionsObserver(weatherCollection);

            solarSystem.AddObserver(droughtObserver);
            solarSystem.AddObserver(rainObserver);
            solarSystem.AddObserver(optimalCondObserver);

            solarSystem.AdvanceDays(3650);

            this.weatherConditionRepository.Persist(weatherCollection.GetAll());
        }
Beispiel #2
0
 public DroughtObserver(WeatherConditionCollection collection)
 {
     this.droughts   = new List <Drought>();
     this.collection = collection;
 }
Beispiel #3
0
 public RainObserver(WeatherConditionCollection collection)
 {
     this.rains      = new List <RainPeriod>();
     this.collection = collection;
 }
Beispiel #4
0
 public OptimalConditionsObserver(WeatherConditionCollection collection)
 {
     this.optimalConditions = new List <OptimalConditions>();
     this.collection        = collection;
 }