package com.upweather.upobject;
import java.util.HashMap;
import com.upweather.upobject.UPUnit;
import com.uplibrary.upobject.UPPair;
/**
* This class represent the forecast object
* It has all the attribute described by the forecast.
* @author Giuseppe Persico - University of Naples "Parthenope"
* @version 1.0
*/
public final class UPForecast {
// The sea pressure
private UPPair<String, UPUnit> seaPressure;
// The wind speed
private UPPair<String, UPUnit> windSpeed;
// The wind direction
private UPPair<String, UPUnit> windDirection;
// The U wind speed
private UPPair<String, UPUnit> windUSpeed;
// The V wind speed
private UPPair<String, UPUnit> windVSpeed;
// The temperature in celsius
private UPPair<String, UPUnit> temperatureCelsius;
// The cloud fraction
private UPPair<String, UPUnit> cloudFraction;
// The hourly rain level
private UPPair<String, UPUnit> hourlyRain;
// Humidity level
private UPPair<String, UPUnit> humidity;
// The air qualiry
private UPPair<String, UPUnit> airQuality;
// Carbon monoxide level
private UPPair<String, UPUnit> carbonMonoxide;
// General visualization
private UPPair<String, UPUnit> generalVisualization;
// Nitrogen oxide level
private UPPair<String, UPUnit> nitrogenOxide;
// Ozone level
private UPPair<String, UPUnit> ozone;
// Particulate at ten micron
private UPPair<String, UPUnit> tenMicronParticulate;
// Particulate at half two micron
private UPPair<String, UPUnit> halfTwoMicronParticulate;
// Sulfuric anhydride level
private UPPair<String, UPUnit> sulfuricAnhydride;
// The forecast date
private String forecastDate;
// A map containing methods to call
public final static HashMap<String,String> HASH_METHODS = new HashMap<>();
// One time initialization of the before declared map with methods names
static {
HASH_METHODS.put("ws10","setWindSpeed");
HASH_METHODS.put("wd10","setWindDirection");
HASH_METHODS.put("u10m","setWindUSpeed");
HASH_METHODS.put("v10m","setWindVSpeed");
HASH_METHODS.put("t2c","setTemperatureCelsius");
HASH_METHODS.put("slp","setSeaPressure");
HASH_METHODS.put("clf","setCloudFraction");
HASH_METHODS.put("crh","setHourlyRain");
HASH_METHODS.put("rh2","setHumidity");
HASH_METHODS.put("caqi","setAirQuality");
HASH_METHODS.put("co","setCarbonMonoxideLevel");
HASH_METHODS.put("gen","setGeneralVisualization");
HASH_METHODS.put("no2","setNitrogenOxide");
HASH_METHODS.put("o3","setOzone");
HASH_METHODS.put("pm10","setTenMicronParticulate");
HASH_METHODS.put("pm25","setHalfTwoMicronParticulate");
HASH_METHODS.put("so2","setSulfuricAnhydride");
}
/**
* Constructor initializes the attribute with their unit measurement
* and values.
*/
public UPForecast() {
this.seaPressure = new UPPair<>(null,new UPUnit("hPA"));
this.windSpeed = new UPPair<>(null,new UPUnit("knt"));
this.windDirection = new UPPair<>(null,new UPUnit("N"));
this.windUSpeed = this.windDirection = new UPPair<>(null,new UPUnit("m/s"));
this.windVSpeed = new UPPair<>(null,new UPUnit("m/s"));
this.temperatureCelsius = new UPPair<>(null,new UPUnit("C°"));
this.cloudFraction = new UPPair<>(null,new UPUnit("%"));
this.hourlyRain = new UPPair<>(null,new UPUnit("mm"));
this.humidity = new UPPair<>(null,new UPUnit("%"));
this.airQuality = new UPPair<>(null,new UPUnit(null));
this.carbonMonoxide = new UPPair<>(null,new UPUnit(null));
this.generalVisualization = new UPPair<>(null,new UPUnit(null));
this.nitrogenOxide = new UPPair<>(null,new UPUnit(null));
this.ozone = new UPPair<>(null,new UPUnit(null));
this.tenMicronParticulate = new UPPair<>(null,new UPUnit(null));
this.halfTwoMicronParticulate = new UPPair<>(null,new UPUnit(null));
this.sulfuricAnhydride = new UPPair<>(null,new UPUnit(null));
}
/**
* This method sets the sea pressure
* @param seaPressure the sea pressure with its unit.
* @return a reference to enable cascade calls.
*/
public final UPForecast setSeaPressure(final UPPair<String, UPUnit> seaPressure) {
this.seaPressure = seaPressure;
return this;
}
/**
* This method sets the sea pressure.
* @param seaPressureValue the sea pressure as string.
* @return a reference to enable cascade calls.
*/
public final UPForecast setSeaPressure(final String seaPressureValue) {
this.seaPressure.setFirst(seaPressureValue);
return this;
}
/**
* This method sets the wind speed
* @param windSpeed the wind speed with its unit.
* @return a reference to enable cascade calls.
*/
public final UPForecast setWindSpeed(final UPPair<String, UPUnit> windSpeed) {
this.windSpeed = windSpeed;
return this;
}
/**
* This method sets the wind speed.
* @param windSpeedValue the wind speed as string.
* @return a reference to enable cascade calls.
*/
public final UPForecast setWindSpeed(final String windSpeedValue) {
this.windSpeed.setFirst(windSpeedValue);
return this;
}
/**
* This method sets the wind direction.
* @param windDirection the wind direction with its unit.
* @return a reference to enable cascade calls
*/
public final UPForecast setWindDirection(final UPPair<String, UPUnit> windDirection) {
this.windDirection = windDirection;
return this;
}
/**
* This method sets the wind direction.
* @param windDirectionValue the wind direction as string.
* @return a reference to enable cascade calls.
*/
public final UPForecast setWindDirection(final String windDirectionValue) {
this.windDirection.setFirst(windDirectionValue);
return this;
}
/**
* This method sets the wind U speed.
* @param windUSpeed the U wind speed with its unit.
* @return a reference to enable cascade calls.
*/
public final UPForecast setWindUSpeed(final UPPair<String, UPUnit> windUSpeed) {
this.windUSpeed = windUSpeed;
return this;
}
/**
* This method sets the wind U speed.
* @param windUSpeedValue the wind U speed as string.
* @return a reference to enable cascade calls.
*/
public final UPForecast setWindUSpeed(final String windUSpeedValue) {
this.windUSpeed.setFirst(windUSpeedValue);
return this;
}
/**
* This method sets the wind V speed.
* @param windVSpeed the wind V speed and its unit.
* @return a reference to enable cascade calls.
*/
public final UPForecast setWindVSpeed(final UPPair<String, UPUnit> windVSpeed) {
this.windVSpeed = windVSpeed;
return this;
}
/**
* This method sets the wind V speed.
* @param windVSpeed the wind V speed as string.
* @return a reference to enable cascade calls.
*/
public final UPForecast setWindVSpeed(final String windVSpeed) {
this.windVSpeed.setFirst(windVSpeed);
return this;
}
/**
* This method sets the temperature in Celsius.
* @param temperatureCelsius the temperature and its unit.
* @return a reference to enable cascade calls.
*/
public final UPForecast setTemperatureCelsius(final UPPair<String, UPUnit> temperatureCelsius) {
this.temperatureCelsius = temperatureCelsius;
return this;
}
/**
* This method sets the temperature in Celsius.
* @param temperatureCelsiusValue the temperature as string.
* @return a reference to enable cascade calls.
*/
public final UPForecast setTemperatureCelsius(final String temperatureCelsiusValue) {
this.temperatureCelsius.setFirst(temperatureCelsiusValue);
return this;
}
/**
* This method sets the cloud fraction.
* @param cloudFraction the cloud fraction and its unit.
* @return a reference to enable cascade calls.
*/
public final UPForecast setCloudFraction(final UPPair<String, UPUnit> cloudFraction) {
this.cloudFraction = cloudFraction;
return this;
}
/**
* This method sets the cloud fraction.
* @param cloudFractionValue the cloud fraction as string.
* @return a reference to enable cascade calls.
*/
public final UPForecast setCloudFraction(final String cloudFractionValue) {
this.cloudFraction.setFirst(cloudFractionValue);
return this;
}
/**
* This method sets the hourly rain level.
* @param hourlyRain the hourly rain level and its unit.
* @return a reference to enable cascade calls.
*/
public final UPForecast setHourlyRain(final UPPair<String, UPUnit> hourlyRain) {
this.hourlyRain = hourlyRain;
return this;
}
/**
* This method sets the hourly rain level.
* @param hourlyRainValue the hourly rain level as string.
* @return a reference to enable cascade calls.
*/
public final UPForecast setHourlyRain(final String hourlyRainValue) {
this.hourlyRain.setFirst(hourlyRainValue);
return this;
}
/**
* This method sets the humidity level.
* @param humidity the humidity level and its unit.
* @return a reference to enable cascade calls.
*/
public final UPForecast setHumidity(final UPPair<String, UPUnit> humidity) {
this.humidity = humidity;
return this;
}
/**
* This method sets the humidity level.
* @param humidityValue the humidity level as string.
* @return a reference to enable cascade calls.
*/
public final UPForecast setHumidity(final String humidityValue) {
this.humidity.setFirst(humidityValue);
return this;
}
/**
* This method sets the forecast date.
* @param forecastDate the forecast date as string.
* @return a reference to enable cascade calls.
*/
public final UPForecast setForecastDate(final String forecastDate) {
this.forecastDate = forecastDate;
return this;
}
/**
* This method sets the air quality.
* @param airQuality the air quality and its unit.
* @return a reference to enable cascade calls.
*/
public final UPForecast setAirQuality(final UPPair<String, UPUnit> airQuality) {
this.airQuality = airQuality;
return this;
}
/**
* This method sets the carbon monoxide level.
* @param carbonMonoxide the carbon monoxide level and its unit.
* @return a reference to enable cascade calls.
*/
public final UPForecast setCarbonMonoxideLevel(final UPPair<String, UPUnit> carbonMonoxide) {
this.carbonMonoxide = carbonMonoxide;
return this;
}
/**
* This method sets the general visualization.
* @param generalVisualization the general visualization and its unit.
* @return a reference to enable cascade calls.
*/
public final UPForecast setGeneralVisualization(final UPPair<String, UPUnit> generalVisualization) {
this.generalVisualization = generalVisualization;
return this;
}
/**
* This method sets the nitrogen oxide level.
* @param nitrogenOxide the nitrogen oxide level and its unit.
* @return a reference to enable cascade calls.
*/
public final UPForecast setNitrogenOxide(final UPPair<String, UPUnit> nitrogenOxide) {
this.nitrogenOxide = nitrogenOxide;
return this;
}
/**
* This method sets the ozone level.
* @param ozone the ozone level and its unit.
* @return a reference to enable cascade calls.
*/
public final UPForecast setOzone(final UPPair<String, UPUnit> ozone) {
this.ozone = ozone;
return this;
}
/**
* This method sets the ten micron particulate.
* @param tenMicronParticulate ten micron particulate and its unit.
* @return a reference to enable cascade calls.
*/
public final UPForecast setTenMicronParticulate(final UPPair<String, UPUnit> tenMicronParticulate) {
this.tenMicronParticulate = tenMicronParticulate;
return this;
}
/**
* This method sets the half two micron particulate.
* @param halfTwoMicronParticulate the half two micron particulate and its unit.
* @return a reference to enable cascade calls.
*/
public final UPForecast setHalfTwoMicronParticulate(final UPPair<String, UPUnit> halfTwoMicronParticulate) {
this.halfTwoMicronParticulate = halfTwoMicronParticulate;
return this;
}
/**
* This method sets the sulfuric anhydride level.
* @param sulfuricAnhydride the sulfuric anhydride level and its unit.
* @return a reference to enable cascade calls.
*/
public final UPForecast setSulfuricAnhydride(final UPPair<String, UPUnit> sulfuricAnhydride) {
this.sulfuricAnhydride = sulfuricAnhydride;
return this;
}
/**
* This method returns the sea pressure level.
* @return the sea pressure level.
*/
public final UPPair<String, UPUnit> getSeaPressure() {
return this.seaPressure;
}
/**
* This method returns the wind speed.
* @return the wind speed.
*/
public final UPPair<String, UPUnit> getWindSpeed() {
return this.windSpeed;
}
/**
* This method returns the wind direction.
* @return the wind direction.
*/
public final UPPair<String, UPUnit> getWindDirection() {
return this.windDirection;
}
/**
* This method returns the wind U speed
* @return the wind U speed.
*/
public final UPPair<String, UPUnit> getWindUSpeed() {
return this.windUSpeed;
}
/**
* This method returns the wind V speed.
* @return a reference to enable cascade calls.
*/
public final UPPair<String, UPUnit> getWindVSpeed() {
return windVSpeed;
}
/**
* This method returns the temperature in Celsius.
* @return the temperature in Celsius.
*/
public final UPPair<String, UPUnit> getTemperatureCelsius() {
return this.temperatureCelsius;
}
/**
* This method returns the cloud fraction level.
* @return the cloud fraction level.
*/
public final UPPair<String, UPUnit> getCloudFraction() {
return this.cloudFraction;
}
/**
* This method returns the hourly rain level.
* @return the hourly rain level.
*/
public final UPPair<String, UPUnit> getHourlyRain() {
return this.hourlyRain;
}
/**
* This method returns the humidity level.
* @return the humidity level.
*/
public final UPPair<String, UPUnit> getHumidity() {
return this.humidity;
}
/**
* This method returns the air quality level.
* @return the air quality level.
*/
public final UPPair<String, UPUnit> getAirQuality() {
return this.airQuality;
}
/**
* This method returns the carbon monoxide level.
* @return the carbon monoxide level.
*/
public final UPPair<String, UPUnit> getCarbonMonoxideLevel() {
return this.carbonMonoxide;
}
/**
* This method returns the general visualization.
* @return the general visualization.
*/
public final UPPair<String, UPUnit> getGeneralVisualization() {
return this.generalVisualization;
}
/**
* This method returns the nitrogen oxide level.
* @return the nitrogen oxide level.
*/
public final UPPair<String, UPUnit> getNitrogenOxide() {
return this.nitrogenOxide;
}
/**
* This method returns the ozone level.
* @return the ozone level.
*/
public final UPPair<String, UPUnit> getOzone() {
return this.ozone;
}
/**
* This method returns the ten micron particulate.
* @return the ten micron particulate
*/
public final UPPair<String, UPUnit> getTenMicronParticulate() {
return this.tenMicronParticulate;
}
/**
* This method returns the half two micron particulate.
* @return the half two micron particulate.
*/
public final UPPair<String, UPUnit> getHalfTwoMicronParticulate() {
return this.halfTwoMicronParticulate;
}
/**
* This method returns the sulfuric anhydride.
* @return the sulfuric anhydride.
*/
public final UPPair<String, UPUnit> getSulfuricAnhydride() {
return this.sulfuricAnhydride;
}
/**
* This method returns the forecast date.
* @return the forecast date.
*/
public final String getForecastDate() {
return this.forecastDate;
}
}