1
0
Fork 0
mirror of https://bitbucket.org/ethauvin/owm-japis.git synced 2025-04-25 01:47:10 -07:00

Merged in panstanislav/owm-japis/precipitations-in-daily-forecast (pull request #1)

Added rain and snow precipitation for daily forecast.
This commit is contained in:
Ashutosh Kumar Singh 2014-12-17 00:42:16 +05:30
commit 0ab7938fbf

View file

@ -535,6 +535,14 @@ public class DailyForecastData {
* Key for JSON variable <code>Percentage of clouds</code> * Key for JSON variable <code>Percentage of clouds</code>
*/ */
private final String JSON_FORECAST_CLOUDS = "clouds"; private final String JSON_FORECAST_CLOUDS = "clouds";
/**
* Key for JSON variable <code>Rain precipitation</code>
*/
private final String JSON_FORECAST_RAIN = "rain";
/**
* Key for JSON variable <code>Snow precipitation</code>
*/
private final String JSON_FORECAST_SNOW = "snow";
/** /**
* Pressure * Pressure
@ -556,6 +564,14 @@ public class DailyForecastData {
* Percentage of clouds * Percentage of clouds
*/ */
private final float cloudsPercent; private final float cloudsPercent;
/**
* Precipitation of rain in mm.
*/
private final float rain;
/**
* Precipitation of snow in mm.
*/
private final float snow;
private final Temperature temp; private final Temperature temp;
@ -567,7 +583,6 @@ public class DailyForecastData {
* Count (number) of elements in list of weather information * Count (number) of elements in list of weather information
*/ */
private final int weatherListCount; private final int weatherListCount;
/** /**
* Non-parameterized constructor * Non-parameterized constructor
* <p> * <p>
@ -586,6 +601,8 @@ public class DailyForecastData {
this.windSpeed = Float.NaN; this.windSpeed = Float.NaN;
this.windDegree = Float.NaN; this.windDegree = Float.NaN;
this.cloudsPercent = Float.NaN; this.cloudsPercent = Float.NaN;
this.rain = Float.NaN;
this.snow = Float.NaN;
this.temp = new Temperature(); this.temp = new Temperature();
@ -611,6 +628,8 @@ public class DailyForecastData {
this.windSpeed = (jsonObj != null) ? (float) jsonObj.optDouble(this.JSON_FORECAST_WIND_SPEED, Double.NaN) : Float.NaN; this.windSpeed = (jsonObj != null) ? (float) jsonObj.optDouble(this.JSON_FORECAST_WIND_SPEED, Double.NaN) : Float.NaN;
this.windDegree = (jsonObj != null) ? (float) jsonObj.optDouble(this.JSON_FORECAST_WIND_DEGREE, Double.NaN) : Float.NaN; this.windDegree = (jsonObj != null) ? (float) jsonObj.optDouble(this.JSON_FORECAST_WIND_DEGREE, Double.NaN) : Float.NaN;
this.cloudsPercent = (jsonObj != null) ? (float) jsonObj.optDouble(this.JSON_FORECAST_CLOUDS, Double.NaN) : Float.NaN; this.cloudsPercent = (jsonObj != null) ? (float) jsonObj.optDouble(this.JSON_FORECAST_CLOUDS, Double.NaN) : Float.NaN;
this.rain = (jsonObj != null) ? (float) jsonObj.optDouble(this.JSON_FORECAST_RAIN, Double.NaN) : Float.NaN;
this.snow = (jsonObj != null) ? (float) jsonObj.optDouble(this.JSON_FORECAST_SNOW, Double.NaN) : Float.NaN;
JSONArray jsonArrWeather = (jsonObj != null) ? jsonObj.optJSONArray(this.JSON_WEATHER) : null; JSONArray jsonArrWeather = (jsonObj != null) ? jsonObj.optJSONArray(this.JSON_WEATHER) : null;
this.weatherList = (jsonArrWeather != null) ? new ArrayList<Weather>(jsonArrWeather.length()) : Collections.EMPTY_LIST; this.weatherList = (jsonArrWeather != null) ? new ArrayList<Weather>(jsonArrWeather.length()) : Collections.EMPTY_LIST;
@ -645,6 +664,14 @@ public class DailyForecastData {
return (this.cloudsPercent != Float.NaN); return (this.cloudsPercent != Float.NaN);
} }
public boolean hasRain() {
return (this.rain != Float.NaN);
}
public boolean hasSnow() {
return (this.snow != Float.NaN);
}
public float getHumidity() { public float getHumidity() {
return this.humidity; return this.humidity;
} }
@ -665,6 +692,14 @@ public class DailyForecastData {
return this.cloudsPercent; return this.cloudsPercent;
} }
public float getRain() {
return this.rain;
}
public float getSnow() {
return this.snow;
}
// Objects // Objects
public Temperature getTemperature_Object() { public Temperature getTemperature_Object() {
return this.temp; return this.temp;