Modifier and Type | Field and Description |
---|---|
protected MarketBasis |
marketBasis
The
MarketBasis of the cluster. |
protected static double |
SMALLEST_DEMAND
The smallest difference between demands, for them to be called different.
|
Modifier | Constructor and Description |
---|---|
protected |
Bid(MarketBasis marketBasis)
A constructor used to create an instance of this class.
|
Modifier and Type | Method and Description |
---|---|
abstract Bid |
aggregate(Bid other)
Aggregates this
Bid instance with another Bid. |
abstract Price |
calculateIntersection(double targetDemand)
Calculates the
Price at the intersection with the bid curve at the given demand. |
protected static boolean |
demandIsEqual(double demand1,
double demand2)
Tests if the difference between the 2 demand values is less that
SMALLEST_DEMAND . |
static Bid |
flatDemand(MarketBasis marketBasis,
double demand)
Creates a new flat
Bid with a given demand. |
double |
getDemandAt(Price price)
Calculates the demand at the intersection in the bid curve with the priceStep in a demand array.
|
double |
getDemandAt(PriceStep priceStep)
Calculates the demand at the intersection with the bid curve at the given
PriceStep . |
MarketBasis |
getMarketBasis() |
abstract double |
getMaximumDemand() |
abstract double |
getMinimumDemand() |
abstract ArrayBid |
toArrayBid() |
abstract PointBid |
toPointBid() |
protected static final double SMALLEST_DEMAND
protected final MarketBasis marketBasis
MarketBasis
of the cluster.protected Bid(MarketBasis marketBasis)
marketBasis
- the MarketBasis
of the cluster.protected static boolean demandIsEqual(double demand1, double demand2)
SMALLEST_DEMAND
.demand1
- The first demanddemand2
- The second demandSMALLEST_DEMAND
public static Bid flatDemand(MarketBasis marketBasis, double demand)
Bid
with a given demand.marketBasis
- The MarketBasis
on which the Bid
should be baseddemand
- The constant demand valueBid
that represents a flat bidpublic MarketBasis getMarketBasis()
public abstract Bid aggregate(Bid other)
Bid
instance with another Bid. Bid are aggregated by adding their bid curves.other
- The Bid
whose bid curve has to be added to the bid curve of this instance.public abstract Price calculateIntersection(double targetDemand)
Price
at the intersection with the bid curve at the given demand.public abstract double getMaximumDemand()
public abstract double getMinimumDemand()
public double getDemandAt(PriceStep priceStep)
PriceStep
.
Implementation note: you should always override either this method or the getDemandAt(Price)
method. The
default implementation is to call the other.priceStep
- the PriceStep
you want to know the demand of.public double getDemandAt(Price price)
getDemandAt(PriceStep)
method.
The default implementation is to call the other.price
- the Price
you want to know the demand of.