public abstract class DataValue
extends java.lang.Object
DatedDataValue
,
TimeSeriesDataValue
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.
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object o)
Returns
true if o is a DataValue
object of the same type as this with an equal
value() and percentageEstimated() . |
int |
hashCode()
Overridden to ensure consistency with
equals . |
static DataValue |
of(double value,
double percentageEstimated)
Returns a non-null
DataValue object with the specified
configuration. |
abstract double |
percentageEstimated()
Returns a number between 0 and 100 (both inclusive), indicating the
extent to which the calculated
value() is based on estimated
data. |
java.lang.String |
toString()
Returns a non-null, non-empty string representation of this object for logging and debugging purposes.
|
abstract double |
value()
Returns the value, which will never be
NaN or infinity, and,
for degree days, will always be zero or greater. |
public abstract double value()
NaN
or infinity, and,
for degree days, will always be zero or greater.public abstract double percentageEstimated()
value()
is based on estimated
data.
Generally speaking, a value with a lower percentage-estimated figure is likely to be more reliable than one with a higher percentage-estimated figure.
public static DataValue of(double value, double percentageEstimated)
DataValue
object with the specified
configuration.value
- indicating the value to be held by the returned object (i.e.
the degree days).percentageEstimated
- a number, greater than or equal to zero and
less than or equal to 100, indicating the extent to which the
value
is based on estimated data.java.lang.IllegalArgumentException
- if value
or
percentageEstimated
is NaN
or infinity,
or if percentageEstimated
is less than 0 or greater
than 100. At the moment an IllegalArgumentException
will also be thrown if value
is less than zero
(since degree-day values are always zero or greater), but this
may change in the future if this class is used for other types of
data.public boolean equals(java.lang.Object o)
true
if o
is a DataValue
object of the same type as this
with an equal
value()
and percentageEstimated()
.
Note that it is not possible for a plain DataValue
object to
be equal to a DatedDataValue
object or a
TimeSeriesDataValue
object.
equals
in class java.lang.Object
public int hashCode()
equals
.hashCode
in class java.lang.Object
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.