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 MarketBasisprice - 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.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectpublic int compareTo(PricePoint that)
Price values of both PricePoints. 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.