net.degreedays.api.data.impl
Class FullYearsAverageBreakdown

java.lang.Object
  extended by net.degreedays.api.data.Breakdown
      extended by net.degreedays.api.data.AverageBreakdown
          extended by net.degreedays.api.data.impl.FullYearsAverageBreakdown
All Implemented Interfaces:
java.io.Serializable

public final class FullYearsAverageBreakdown
extends AverageBreakdown
implements java.io.Serializable

A type of AverageBreakdown used to specify that average-degree-day figures should be derived from data covering a specified number of full calendar years. The years used will always be consecutive (i.e. no gaps), and are specified using the Period passed into the constructor.

Typically you'd want to use Period.latestValues(int) to create the Period, to specify that the last year of the average should be the most recent full calendar year.

If you want average data calculated using a different method, remember that you can always fetch dated data and calculate averages directly from that.

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


Constructor Summary
FullYearsAverageBreakdown(Period period)
          Constructs a FullYearsAverageBreakdown object that specifies average degree days derived from data covering full calendar years determined by the specified period.
 
Method Summary
 DayRange getFullRangeOrNull(DayRange availableDataRange)
          Returns the range of days that this breakdown would cover given source data covering availableDataRange, or null if availableDataRange would not be enough for this breakdown.
 Period period()
          Returns the non-null period in time that the breakdown should average data from.
 java.lang.String toString()
          Returns a non-null, non-empty string representation of this object for logging and debugging purposes.
 
Methods inherited from class net.degreedays.api.data.AverageBreakdown
fullYears
 
Methods inherited from class net.degreedays.api.data.Breakdown
equals, hashCode
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FullYearsAverageBreakdown

public FullYearsAverageBreakdown(Period period)
Constructs a FullYearsAverageBreakdown object that specifies average degree days derived from data covering full calendar years determined by the specified period.

Parameters:
period - specifying the full calendar years of data that the average figures should be derived from. Cannot be null. Typically you'd want to use Period.latestValues(int) for this, specifying at least 2 values (since an average of 1 year of data is not very meaningful). But you can also use Period.dayRange(net.degreedays.time.DayRange) - in this case the period may be widened for calculation purposes to make it cover full calendar years.
Throws:
java.lang.NullPointerException - if period is null.
Method Detail

period

public Period period()
Returns the non-null period in time that the breakdown should average data from.


getFullRangeOrNull

public DayRange getFullRangeOrNull(DayRange availableDataRange)
Returns the range of days that this breakdown would cover given source data covering availableDataRange, or null if availableDataRange would not be enough for this breakdown.

Specified by:
getFullRangeOrNull in class Breakdown
Parameters:
availableDataRange - the non-null range of temperature data available (or the available range of daily degree-day data if summing daily degree days into a different breakdown).
Throws:
java.lang.NullPointerException - if availableDataRange is null.

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/