net.degreedays.api.data
Class DataSpec

java.lang.Object
  extended by net.degreedays.api.data.DataSpec
Direct Known Subclasses:
AverageDataSpec, DatedDataSpec

public abstract class DataSpec
extends java.lang.Object

Defines a specification of a single set of degree-day data in all aspects other than the location that the data should be generated for.

A DataSpec defines a single set of data only (e.g. just one base temperature), but the DataSpecs class will enable you to include multiple DataSpec objects in a single LocationDataRequest.

To create a DataSpec object you can use the static factory methods of this class. For example:

 DatedDataSpec thirtyMostRecentHddValues = DataSpec.dated(
     Calculation.heatingDegreeDays(Temperature.fahrenheit(55)),
     DatedBreakdown.daily(Period.latestValues(30)));
 
 AverageDataSpec fiveYearAverageCdd = DataSpec.average(
     Calculation.coolingDegreeDays(Temperature.fahrenheit(65)),
     AverageBreakdown.fullYears(Period.latestValues(5)));
 

This abstract class is not designed to be extended by third-party code, which is why it does not have an accessible constructor.

All concrete subclasses of this abstract class are immutable. You can safely reuse them and call them from multiple threads at once.


Method Summary
static AverageDataSpec average(Calculation calculation, AverageBreakdown averageBreakdown)
          Returns an non-null AverageDataSpec object with the specified Calculation and AverageBreakdown.
static DatedDataSpec dated(Calculation calculation, DatedBreakdown datedBreakdown)
          Returns a non-null DatedDataSpec object with the specified Calculation and DatedBreakdown.
 boolean equals(java.lang.Object o)
          Two DataSpec objects are equal if they have the same class and the same configuration.
 int hashCode()
          Overridden to ensure consistency with equals.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

dated

public static DatedDataSpec dated(Calculation calculation,
                                  DatedBreakdown datedBreakdown)
Returns a non-null DatedDataSpec object with the specified Calculation and DatedBreakdown.

Parameters:
calculation - defines the way in which the degree days should be calculated in terms of their base temperature and whether they should be heating degree days or cooling degree days. Cannot be null.
datedBreakdown - defines the way in which the data should be broken down and the period that it should cover. Cannot be null.
Throws:
java.lang.NullPointerException - if calculation or datedBreakdown is null.
See Also:
average(Calculation, AverageBreakdown)

average

public static AverageDataSpec average(Calculation calculation,
                                      AverageBreakdown averageBreakdown)
Returns an non-null AverageDataSpec object with the specified Calculation and AverageBreakdown.

Parameters:
calculation - defines the way in which the degree days should be calculated in terms of their base temperature and whether they should be heating degree days or cooling degree days. Cannot be null.
averageBreakdown - defines the way in which the data should be broken down and the period that it should cover. Cannot be null.
Throws:
java.lang.NullPointerException - if calculation or averageBreakdown is null.
See Also:
dated(Calculation, DatedBreakdown)

equals

public final boolean equals(java.lang.Object o)
Two DataSpec objects are equal if they have the same class and the same configuration.

Overrides:
equals in class java.lang.Object

hashCode

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

Overrides:
hashCode in class java.lang.Object


www.degreedays.net/api/