/*
* Copyright 2011 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an
* "AS IS" BASIS,  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/

package org.powertac.common;

import java.util.List;

import org.powertac.common.state.Domain;
import org.powertac.common.xml.TimeslotConverter;
import com.thoughtworks.xstream.annotations.*;

/**
* A collection of weatherReports giving hourly forecasts for future timeslot.
*
* @author Erik Onarheim and Josh Edeen
*/
@Domain
@XStreamAlias("weather-forecast")
public class WeatherForecast 
{
  @XStreamAsAttribute
  private long id = IdGenerator.createId();
  
  /** the current or reference timeslot from which the weather (forecast) is generated */
  @XStreamAsAttribute
  @XStreamConverter(TimeslotConverter.class)
  private Timeslot currentTimeslot;

  @XStreamImplicit(itemFieldName = "prediction")
  private List<WeatherForecastPrediction> predictions;
  
  public WeatherForecast (Timeslot timeslot)
  {
    super();
    this.currentTimeslot = timeslot;
  }

  public List<WeatherForecastPrediction> getPredictions ()
  {
    return predictions;
  }

  public WeatherForecast setPredictions (List<WeatherForecastPrediction> predictions)
  {
    this.predictions = predictions;
    return this;
  }
  
  public WeatherForecast addPrediction (WeatherForecastPrediction prediction)
  {
    this.predictions.add(prediction);
    return this;
  }

  public long getId ()
  {
    return id;
  }

  public Timeslot getCurrentTimeslot ()
  {
    return currentTimeslot;
  }
  
  
}

@@ -1402,25 +1402,106 @@
 slot
-)%0A  %7B%0A    super()
+, List%3CWeatherForecastPrediction%3E predictions)%0A  %7B%0A    super();%0A    this.predictions = predictions
 ;%0A  
@@ -1636,300 +1636,8 @@
  %7D%0A%0A
-  public WeatherForecast setPredictions (List%3CWeatherForecastPrediction%3E predictions)%0A  %7B%0A    this.predictions = predictions;%0A    return this;%0A  %7D%0A  %0A  public WeatherForecast addPrediction (WeatherForecastPrediction prediction)%0A  %7B%0A    this.predictions.add(prediction);%0A    return this;%0A  %7D%0A%0A
   pu

clean up api