Constructor and Description |
---|
ArrayBid.Builder(MarketBasis marketBasis)
Constructor to create an instance of this class.
|
Modifier and Type | Method and Description |
---|---|
ArrayBid |
build()
Makes sure the whole array is filled, then creates the ArrayBid with the Builder's internal values.
|
ArrayBid.Builder |
demand(double demand)
Adds a demand
double to builderDemand. |
ArrayBid.Builder |
demandArray(double... demand)
Sets the demandArray with the supplied demand array.
|
ArrayBid.Builder |
fillTo(int priceStep)
fills the demand array from the nextIndex until the designated priceStep with the last set demand Will do
nothing on an already filled array.
|
public ArrayBid.Builder(MarketBasis marketBasis)
marketBasis
- the MarketBasis
of the cluster.public ArrayBid.Builder demand(double demand)
double
to builderDemand.demand
- The demand to be added to the demand array. Must not be higher than the previous added demand.java.lang.IllegalArgumentException
- when the demand to be added is higher than the demand already in the arrayjava.lang.ArrayIndexOutOfBoundsException
- when the demand array is already fullpublic ArrayBid.Builder demandArray(double... demand)
demand
- The new demand arrayjava.lang.IllegalArgumentException
- if the size of the array differs from the number of priceSteps in the MarketBasis or if the
demand array is ascendingpublic ArrayBid build()
java.lang.IllegalArgumentException
- When the length of the demandArray is not equal to the number of price stepspublic ArrayBid.Builder fillTo(int priceStep)
priceStep
- The priceStep to fill to.java.lang.IllegalStateException
- when nextIndex is zero (no demand has been set, yet)java.lang.IllegalArgumentException
- when the supplied priceStep is higher than the number of price steps in the marketBasis