Class WeatherForecastRepo

  • All Implemented Interfaces:
    DomainRepo

    @Service
    public class WeatherForecastRepo
    extends Object
    implements DomainRepo
    Repository for WeatherReports. The weather reports are indexed by the timeslot that they are issued for. This allows them to be quickly accessed via a hashMap. The parameter maxForecastCount controls the number of old forecasts kept in memory.
    Author:
    Erik Onarheim
    • Constructor Detail

      • WeatherForecastRepo

        public WeatherForecastRepo()
        standard constructor
    • Method Detail

      • add

        public void add​(WeatherForecast weather)
        Adds a WeatherForecast to the repo
      • allWeatherForecasts

        public List<WeatherForecast> allWeatherForecasts()
        Returns a list of all the issued weather forecast up to the currentTimeslot
      • count

        public int count()
        Returns the number of WeatherForecasts that have been successfully created.
      • runOnce

        public void runOnce()
        Called by weather service to indicate weather exists
      • recycle

        public void recycle()
        Description copied from interface: DomainRepo
        Implementations must clear out the repository in preparation for a new simulation.
        Specified by:
        recycle in interface DomainRepo