net.degreedays.api.data
Class DatedDataSet.Builder

java.lang.Object
  extended by net.degreedays.api.data.DatedDataSet.Builder
Enclosing class:
DatedDataSet

public static final class DatedDataSet.Builder
extends java.lang.Object

A builder class for creating immutable DatedDataSet 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.


Constructor Summary
DatedDataSet.Builder()
           
 
Method Summary
 DatedDataSet.Builder addValue(DatedDataValue v)
          Adds a DatedDataValue object.
 DatedDataSet build()
           
 DatedDataSet.Builder setPercentageEstimated(double percentageEstimated)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DatedDataSet.Builder

public DatedDataSet.Builder()
Method Detail

addValue

public DatedDataSet.Builder addValue(DatedDataValue v)
Adds a DatedDataValue object. Values must be added in chronological order, and they must be continuous (each should start the day after the previous finished).

Parameters:
v - the non-null DatedDataValue to add.
Returns:
this, for method chaining.
Throws:
java.lang.NullPointerException - if v is null.
java.lang.IllegalArgumentException - if v doesn't start on the day following the end of the last DatedDataValue added.

setPercentageEstimated

public DatedDataSet.Builder setPercentageEstimated(double percentageEstimated)

build

public DatedDataSet build()
Throws:
java.lang.IllegalStateException - if there is not at least one DatedDataValue.


www.degreedays.net/api/