net.degreedays.api.data
Class AverageDataSet

java.lang.Object
  extended by net.degreedays.api.data.DataSet
      extended by net.degreedays.api.data.AverageDataSet
All Implemented Interfaces:
java.io.Serializable

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 Also:
DatedDataSet

Instances of this class are immutable. You can safely reuse them and call them from multiple threads at once.


Nested Class Summary
static class AverageDataSet.Builder
          A builder class for creating immutable AverageDataSet objects e.g. for testing purposes.
 
Method Summary
 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.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

percentageEstimated

public double percentageEstimated()
Description copied from class: DataSet
Returns a number between 0 and 100 (both inclusive), indicating the overall extent to which this 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.

Specified by:
percentageEstimated in class DataSet

fullRange

public DayRange fullRange()
Returns a non-null 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().

Specified by:
fullRange in class DataSet

firstYear

public int firstYear()
Returns the first year of the continuous set of data that was used to calculate the average figures.


lastYear

public int lastYear()
Returns the last year of the continuous set of data that was used to calculate the average figures.


numberOfYears

public 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).


monthlyAverage

public 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).

Parameters:
monthIndexWithJanAs1 - a number between 1 (for January) and 12 (for December).
Throws:
java.lang.IndexOutOfBoundsException - if monthIndexWithJanAs1 is less than 1 or greater than 12.

annualAverage

public DataValue annualAverage()
Returns the non-null average annual value.


equals

public 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.

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overridden to ensure consistency with equals.

Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Returns a non-null, non-empty string representation of this object for logging and debugging purposes.

The exact details of the representation are unspecified and subject to change.

Overrides:
toString in class java.lang.Object


www.degreedays.net/api/