public class PricePoint extends java.lang.Object implements java.lang.Comparable<PricePoint>
Constructor and Description |
---|
PricePoint(MarketBasis marketBasis,
double price,
double demand)
A copy constructor used to create a PricePoint with a new
MarketBasis . |
PricePoint(Price price,
double demand)
A constructor to create an instance of PricePoint.
|
public PricePoint(Price price, double demand)
price
- the Price
valuedemand
- the double
value of the demandpublic PricePoint(MarketBasis marketBasis, double price, double demand)
MarketBasis
.marketBasis
- the new MarketBasis
price
- the Price
valuedemand
- the double
value of the demandpublic Price getPrice()
public double getDemand()
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public int compareTo(PricePoint that)
Price
values of both PricePoint
s. Then it compares the demand
values of both instances. The one with the highest value is the greatest.compareTo
in interface java.lang.Comparable<PricePoint>
that
- The PricePoint
instance you want to compare with this one.