Exemplo n.º 1
0
  /** Returns a list of all the issued weather forecast up to the currentTimeslot */
  public List<WeatherForecast> allWeatherForecasts() {
    int current = timeslotRepo.currentSerialNumber();
    // Some weather forecasts exist in the repo for the future
    // but have not been issued for the current timeslot.
    ArrayList<WeatherForecast> issuedReports = new ArrayList<WeatherForecast>();
    for (WeatherForecast w : indexedWeatherForecasts.values()) {
      if (w.getTimeslotIndex() < current) {
        issuedReports.add(w);
      }
    }

    issuedReports.add(this.currentWeatherForecast());

    return (List<WeatherForecast>) issuedReports;
  }
Exemplo n.º 2
0
 /** Adds a WeatherForecast to the repo */
 public void add(WeatherForecast weather) {
   runOnce();
   indexedWeatherForecasts.put(weather.getTimeslotIndex(), weather);
 }