com.oopitis.weather.fio
Interface FioData.DataPoint

All Superinterfaces:
WeatherPropertyMap
All Known Subinterfaces:
FioData.DataBlock, FioData.Response
Enclosing class:
FioData<T>

public static interface FioData.DataPoint
extends WeatherPropertyMap

Data access interface that accepts a forecast.io property name or a WeatherProperty object. This is roughly a Data Point object described by forecast.io.


Method Summary
<T> T
get(WeatherProperty<T> property)
          Gets the data represented by a weather property.
<T> T
getProperty(java.lang.String name, java.lang.Class<T> klass)
          Gets the property value of an expected data type.
<T> T
getStandardDeviation(WeatherProperty<T> property)
          Gets the variability of the data from which a property value is calculated.
 

Method Detail

getProperty

<T> T getProperty(java.lang.String name,
                  java.lang.Class<T> klass)
Gets the property value of an expected data type.

Type Parameters:
T - the type of the data
Parameters:
name - the name of the property
klass - the class object of the expected data type
Returns:
the data
Throws:
java.lang.ClassCastException - if the data cannot be converted into the expected data type

get

<T> T get(WeatherProperty<T> property)
Description copied from interface: WeatherPropertyMap
Gets the data represented by a weather property.

Specified by:
get in interface WeatherPropertyMap
Type Parameters:
T - the type of the data
Parameters:
property - the property for which the data is to be returned
Returns:
the data represented by the weather property; null if no data is available or if the given property is not supported

getStandardDeviation

<T> T getStandardDeviation(WeatherProperty<T> property)
Description copied from interface: WeatherPropertyMap
Gets the variability of the data from which a property value is calculated. If the value returned by get(WeatherProperty) is the average of all data collected, then the value returned by this method shows how much variation or dispersion exists from the average. Smaller variation implies higher confidence statistically.

Implementation note: While this method in general is only applicable to numeric property values, the standard deviation does not have to be an instance of java.lang.Number. The return object however must have the same type as that of the property value. When the comparison between the standard deviation (returned by this method) and the mean (returned by get(WeatherProperty)) is not obvious, a helper method may be provided to illustrate the confidence level in other ways such as the coefficient of variation in percentages.

Specified by:
getStandardDeviation in interface WeatherPropertyMap
Type Parameters:
T - the data type of the property value
Parameters:
property - the property for which the data variability is to be returned
Returns:
the variability of the data from which the property value is calculated; null if such information is unavailable or the given property is not supported
See Also:
WeatherPropertyMap.get(WeatherProperty)