public final class AverageDataSet extends DataSet implements java.io.Serializable
Contains a set of average degree-day data generated to fulfil an
AverageDataSpec
for a specific Location
.
See AverageDataSpec
for example code showing how to fetch an
AverageDataSet
of average degree days from the API.
DatedDataSet
,
TimeSeriesDataSet
Instances of this class are immutable. You can safely reuse them and call them from multiple threads at once.
Modifier and Type | Class and Description |
---|---|
static class |
AverageDataSet.Builder
A builder class for creating immutable
AverageDataSet objects
e.g. for testing purposes. |
Modifier and Type | Method and Description |
---|---|
DataValue |
annualAverage()
Returns the non-null average annual value.
|
boolean |
equals(java.lang.Object o)
Returns
true if o is an
AverageDataSet containing equal values and calculated from
data covering an equal period in time. |
int |
firstYear()
Returns the first year of the continuous set of data that was used to
calculate the average figures.
|
DayRange |
fullRange()
Returns a non-null
DayRange object indicating the period of
data from which this AverageDataSet 's figures were
calculated. |
int |
hashCode()
Overridden to ensure consistency with
equals . |
int |
lastYear()
Returns the last year of the continuous set of data that was used to
calculate the average figures.
|
DataValue |
monthlyAverage(int monthIndexWithJanAs1)
Returns the non-null average value for the specified month
(e.g. pass 1 for the average value for the month of January).
|
int |
numberOfYears()
Returns the number of years of data that the average figures were
calculated from (e.g. for 5-year-average data this would return 5).
|
double |
percentageEstimated()
Returns a number between 0 and 100 (both inclusive), indicating the
overall extent to which this
DataSet is based on estimated
data. |
java.lang.String |
toString()
Returns a non-null, non-empty string representation of this object for logging and debugging purposes.
|
public double percentageEstimated()
DataSet
DataSet
is based on estimated
data.
Generally speaking, data with a lower percentage-estimated figure is likely to be more reliable than data with a higher percentage-estimated figure.
percentageEstimated
in class DataSet
public DayRange fullRange()
DayRange
object indicating the period of
data from which this AverageDataSet
's figures were
calculated. The returned object will range from the first of January on
the firstYear()
to the 31st of December on the
lastYear()
.public int firstYear()
public int lastYear()
public int numberOfYears()
public DataValue monthlyAverage(int monthIndexWithJanAs1)
monthIndexWithJanAs1
- a number between 1 (for January) and 12 (for
December).java.lang.IndexOutOfBoundsException
- if monthIndexWithJanAs1
is
less than 1 or greater than 12.public DataValue annualAverage()
public boolean equals(java.lang.Object o)
true
if o
is an
AverageDataSet
containing equal values and calculated from
data covering an equal period in time.equals
in class java.lang.Object
public int hashCode()
equals
.hashCode
in class java.lang.Object
public java.lang.String toString()
The exact details of the representation are unspecified and subject to change.
toString
in class java.lang.Object
See www.degreedays.net/api/ for more about the Degree Days.net API.
You can sign up for a Degree Days.net API account and read the integration guide that is useful and applicable whether you are using Java or not.