net.degreedays.api.data
Class AverageDataSet.Builder
java.lang.Object
net.degreedays.api.data.AverageDataSet.Builder
- Enclosing class:
- AverageDataSet
public static final class AverageDataSet.Builder
- extends java.lang.Object
A builder class for creating immutable AverageDataSet
objects
e.g. for testing purposes.
Instances of this builder class are designed for single-threaded use only. It's fine to create and use instances in multiple concurrent threads, but, in the absence of external synchronization, the use of each individual builder instance should be restricted to one thread only.
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AverageDataSet.Builder
public AverageDataSet.Builder()
setFirstYear
public AverageDataSet.Builder setFirstYear(int firstYear)
setLastYear
public AverageDataSet.Builder setLastYear(int lastYear)
setMonthlyAverage
public AverageDataSet.Builder setMonthlyAverage(int monthIndexWithJanAs1,
DataValue monthlyAverage)
- Sets the average value for the specified month (January having index
1).
- Parameters:
monthIndexWithJanAs1
- a number between 1 (for January) and 12
(for December).monthlyAverage
- the monthly-average value to set.
- Returns:
this
, for method chaining.
- Throws:
java.lang.IndexOutOfBoundsException
- if
monthIndexWithJanAs1
is less than 1 or greater
than 12.
java.lang.NullPointerException
- if monthlyAverage
is
null
.
setAnnualAverage
public AverageDataSet.Builder setAnnualAverage(DataValue annualValue)
build
public AverageDataSet build()
www.degreedays.net/api/