public abstract static class AbstractWeatherData.Main
extends java.lang.Object
Main
.
Standard behaviors like the has
and the get
methods for information about main weather elements (for example,
temperature, pressure, humidity, etc.) are defined here.Modifier and Type | Field and Description |
---|---|
private float |
humidity
Humidity
|
private java.lang.String |
JSON_MAIN_HUMIDITY
Key for JSON variable
Main -> Humidity |
private java.lang.String |
JSON_MAIN_PRESSURE
Key for JSON variable
Main -> Pressure |
private java.lang.String |
JSON_MAIN_TEMP
Key for JSON variable
Main -> Temperature |
private java.lang.String |
JSON_MAIN_TEMP_MAX
Key for JSON variable
Main -> Maximum temperature |
private java.lang.String |
JSON_MAIN_TEMP_MIN
Key for JSON variable
Main -> Minimum temperature |
private float |
maxTemp
Maximum temperature
|
private float |
minTemp
Minimum temperature
|
private float |
pressure
Pressure
|
private float |
temp
Temperature
|
Constructor and Description |
---|
AbstractWeatherData.Main()
Non-parameterized constructor
|
AbstractWeatherData.Main(org.json.JSONObject jsonObj)
Parameterized constructor
Initializes variables from values from the given JSON object.
|
Modifier and Type | Method and Description |
---|---|
float |
getHumidity()
Returns data for humidity of the city.
|
float |
getMaxTemperature()
Returns data for maximum temperature of the city.
|
float |
getMinTemperature()
Returns data for minimum temperature of the city.
|
float |
getPressure()
Returns data for pressure of the city.
|
float |
getTemperature()
Returns data for temperature of the city.
|
boolean |
hasHumidity()
Tells if the data for humidity of the city is available or not.
|
boolean |
hasMaxTemperature()
Tells if the data for maximum temperature of the city is available or not.
|
boolean |
hasMinTemperature()
Tells if the data for minimum temperature of the city is available or not.
|
boolean |
hasPressure()
Tells if the data for pressure of the city is available or not.
|
boolean |
hasTemperature()
Tells if the data for temperature of the city is available or not.
|
private final java.lang.String JSON_MAIN_TEMP
Main -> Temperature
private final java.lang.String JSON_MAIN_TEMP_MIN
Main -> Minimum temperature
private final java.lang.String JSON_MAIN_TEMP_MAX
Main -> Maximum temperature
private final java.lang.String JSON_MAIN_PRESSURE
Main -> Pressure
private final java.lang.String JSON_MAIN_HUMIDITY
Main -> Humidity
private final float temp
private final float minTemp
private final float maxTemp
private final float pressure
private final float humidity
public AbstractWeatherData.Main()
Initializes variables as per following basis:
Boolean: false
Integral: Minimum value (MIN_VALUE)
Floating point: Not a number (NaN)
Others: null
public AbstractWeatherData.Main(org.json.JSONObject jsonObj)
jsonObj
- JSON object containing data about main weather
elements. For example, temperature, pressure, etc.public boolean hasTemperature()
true
if data available, otherwise false
public boolean hasMinTemperature()
true
if data available, otherwise false
public boolean hasMaxTemperature()
true
if data available, otherwise false
public boolean hasPressure()
true
if data available, otherwise false
public boolean hasHumidity()
true
if data available, otherwise false
public float getTemperature()
Float.NaN
, i.e., Not a Number.public float getMinTemperature()
Float.NaN
, i.e., Not a Number.public float getMaxTemperature()
Float.NaN
, i.e., Not a Number.public float getPressure()
Float.NaN
, i.e., Not a Number.public float getHumidity()
Float.NaN
, i.e., Not a Number.