public class ArrayBid extends Bid
Bid
with a double
demand array to represent the bid
curve. This is used because it is easy to perform calculations with.Modifier and Type | Class and Description |
---|---|
static class |
ArrayBid.Builder
A builder class to create an
ArrayBid instance. |
marketBasis, SMALLEST_DEMAND
Constructor and Description |
---|
ArrayBid(ArrayBid bid)
A copy constructor to create a copy of the given ArrayBid and its bidNumber.
|
ArrayBid(MarketBasis marketBasis,
double... demandArray)
A constructor to create an instance of ArrayBid.
|
Modifier and Type | Method and Description |
---|---|
ArrayBid |
aggregate(Bid other)
Aggregates this
Bid instance with another Bid. |
Price |
calculateIntersection(double targetDemand)
Calculates the
Price at the intersection with the bid curve at the given demand. |
boolean |
equals(java.lang.Object obj) |
double[] |
getDemand() |
double |
getDemandAt(PriceStep priceStep)
Calculates the demand at the intersection with the bid curve at the given
PriceStep . |
double |
getMaximumDemand() |
double |
getMinimumDemand() |
int |
hashCode() |
ArrayBid |
subtract(ArrayBid other)
Subtract the other bid curve from this bid curve.
|
ArrayBid |
toArrayBid() |
PointBid |
toPointBid() |
java.lang.String |
toString() |
ArrayBid |
transpose(double offset)
Transpose the bid curve by adding an offset to the demand.
|
demandIsEqual, flatDemand, getDemandAt, getMarketBasis
public ArrayBid(MarketBasis marketBasis, double... demandArray)
marketBasis
- the MarketBasis
of the clusterdemandArray
- the demandArray that belongs to this bid.public ArrayBid aggregate(Bid other)
Bid
instance with another Bid. Bid are aggregated by adding their bid curves.public Price calculateIntersection(double targetDemand)
Price
at the intersection with the bid curve at the given demand.calculateIntersection
in class Bid
targetDemand
- the part of the bid curve you want to get the Price
of.Price
public double getMaximumDemand()
getMaximumDemand
in class Bid
public double getMinimumDemand()
getMinimumDemand
in class Bid
public ArrayBid toArrayBid()
toArrayBid
in class Bid
ArrayBid
implementation of this Bid.public PointBid toPointBid()
toPointBid
in class Bid
PointBid
implementation of this Bid.public double[] getDemand()
public double getDemandAt(PriceStep priceStep)
PriceStep
.
Implementation note: you should always override either this method or the Bid.getDemandAt(Price)
method. The
default implementation is to call the other.getDemandAt
in class Bid
priceStep
- the PriceStep
you want to know the demand of.public ArrayBid subtract(ArrayBid other)
other
- The other (Bid
) parameter.public ArrayBid transpose(double offset)
offset
- The offset (double
) parameter.ArrayBid
that has been shifted.public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object