net.degreedays.api.data.impl
Class CustomBreakdown

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

public final class CustomBreakdown
extends DatedBreakdown
implements java.io.Serializable

A type of DatedBreakdown used to specify that degree days should be broken down into the custom date ranges specified e.g. to match the dates of your energy-usage records.

Since:
1.2

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


Constructor Summary
CustomBreakdown(DayRanges dayRanges)
          Constructs a CustomBreakdown object that specifies degree days broken down to match the DayRanges passed in.
 
Method Summary
 DayRanges dayRanges()
          Returns the non-null DayRanges that specifies the dates that each degree-day figure should cover.
 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.
 MaybeEmptyDayRanges toDayRanges(DayRange availableDataRange)
          Returns the breakdown in terms of the day ranges that would constitute it given source data covering availableDataRange.
 java.lang.String toString()
          Returns a non-null, non-empty string representation of this object for logging and debugging purposes.
 CustomBreakdown withAllowPartialLatest(boolean allowPartialLatest)
          Returns a CustomBreakdown with the same dayRanges() as this, but with the DatedBreakdown.allowPartialLatest() property set to the specified value.
 
Methods inherited from class net.degreedays.api.data.DatedBreakdown
allowPartialLatest, custom, daily, monthly, monthly, weekly, yearly, yearly
 
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

CustomBreakdown

public CustomBreakdown(DayRanges dayRanges)
Constructs a CustomBreakdown object that specifies degree days broken down to match the DayRanges passed in.

Parameters:
dayRanges - specifying the dates that each degree-day figure should cover (typically matching the dates of your energy-usage records). Cannot be null.
Throws:
java.lang.NullPointerException - if dayRanges is null.
Method Detail

dayRanges

public DayRanges dayRanges()
Returns the non-null DayRanges that specifies the dates that each degree-day figure should cover.


withAllowPartialLatest

public CustomBreakdown withAllowPartialLatest(boolean allowPartialLatest)
Returns a CustomBreakdown with the same dayRanges() as this, but with the DatedBreakdown.allowPartialLatest() property set to the specified value.

The allowPartialLatest property makes it possible to fetch time-series data (like hourly temperature data) that includes time-series-data values for the current (incomplete) day. It also makes it possible to fetch custom degree-day data that includes a DatedDataValue for the latest specified day range that is partially (but not yet fully) available. See DatedBreakdown.allowPartialLatest() for more on how it works.

Parameters:
allowPartialLatest - true to specify that the latest available day range (of the dayRanges() specified) can be partially filled (i.e. incomplete), or false if the latest available day range must be complete (the default behaviour).
Since:
1.3
See Also:
DatedBreakdown.allowPartialLatest()

toDayRanges

public MaybeEmptyDayRanges toDayRanges(DayRange availableDataRange)
Returns the breakdown in terms of the day ranges that would constitute it given source data covering availableDataRange.

If you call fullRangeOrNull() on the return value, you'll get the same result that you'd get by calling getFullRangeOrNull(availableDataRange) on this object. Essentially this method is a more detailed version of getFullRangeOrNull that makes sense for dated breakdowns, which translate to real ranges of days on a calendar (unlike average breakdowns which are broken down into months of an "average year" rather than applying to a real calendar).

Specified by:
toDayRanges in class DatedBreakdown
Parameters:
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.
Throws:
java.lang.NullPointerException - if availableDataRange is null.

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