net.degreedays.api.data
Class Calculation

java.lang.Object
  extended by net.degreedays.api.data.Calculation
Direct Known Subclasses:
CoolingDegreeDaysCalculation, HeatingDegreeDaysCalculation

public abstract class Calculation
extends java.lang.Object

Defines how degree days should be calculated e.g. HDD or CDD to a specific base temperature.

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

 Calculation hdd = Calculation.heatingDegreeDays(Temperature.celsius(12.5));
 Calculation cdd = Calculation.coolingDegreeDays(Temperature.celsius(21));
 

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 CoolingDegreeDaysCalculation coolingDegreeDays(Temperature baseTemperature)
          Returns a non-null CoolingDegreeDaysCalculation object with the specified base temperature.
 boolean equals(java.lang.Object o)
          Two Calculation objects are equal if they have the same class and the same configuration.
 int hashCode()
          Overridden to ensure consistency with equals.
static HeatingDegreeDaysCalculation heatingDegreeDays(Temperature baseTemperature)
          Returns a non-null HeatingDegreeDaysCalculation object with the specified base temperature.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

heatingDegreeDays

public static HeatingDegreeDaysCalculation heatingDegreeDays(Temperature baseTemperature)
Returns a non-null HeatingDegreeDaysCalculation object with the specified base temperature.

Parameters:
baseTemperature - the base temperature that the heating degree days should be calculated to. Cannot be null.
Throws:
java.lang.NullPointerException - if baseTemperature is null.
See Also:
coolingDegreeDays(Temperature)

coolingDegreeDays

public static CoolingDegreeDaysCalculation coolingDegreeDays(Temperature baseTemperature)
Returns a non-null CoolingDegreeDaysCalculation object with the specified base temperature.

Parameters:
baseTemperature - the base temperature that the cooling degree days should be calculated to. Cannot be null.
Throws:
java.lang.NullPointerException - if baseTemperature is null.
See Also:
heatingDegreeDays(Temperature)

equals

public final boolean equals(java.lang.Object o)
Two Calculation 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/