public final class FullYearsAverageBreakdown extends AverageBreakdown implements java.io.Serializable
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 and Description |
---|
FullYearsAverageBreakdown(Period period)
Constructs a
FullYearsAverageBreakdown object that specifies
average degree days derived from data covering full calendar years
determined by the specified period . |
Modifier and Type | Method and Description |
---|---|
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.
|
fullYears
public FullYearsAverageBreakdown(Period period)
FullYearsAverageBreakdown
object that specifies
average degree days derived from data covering full calendar years
determined by the specified period
.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.java.lang.NullPointerException
- if period
is null
.public Period period()
public DayRange getFullRangeOrNull(DayRange availableDataRange)
availableDataRange
, or null
if
availableDataRange
would not be enough for this breakdown.getFullRangeOrNull
in class Breakdown
availableDataRange
- the range of temperature data available (or the
available range of daily degree-day data if summing daily degree
days into a different breakdown). Cannot be null
.java.lang.NullPointerException
- if availableDataRange
is
null
.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.