|
StocksMonitor 1.5.0 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
ObjectQuote
public final class Quote
Data-centric, immutable value class which represents the
dynamic price data attached to a Stock.
| Constructor Summary | |
|---|---|
Quote(Stock aStock,
BigDecimal aCurrentPrice,
BigDecimal aChange)
Constructor. |
|
| Method Summary | |
|---|---|
boolean |
equals(Object aThat)
|
BigDecimal |
getChange()
Return the aChange passed to the constructor. |
BigDecimal |
getCurrentValue()
Return the product of Stock.getNumShares() and getPrice(). |
BigDecimal |
getPercentChange()
Return the percentage change between the opening price and the current price; if getPrice() returns 0, then this method returns 0. |
BigDecimal |
getPercentProfit()
Return getProfit() divided by Stock.getBookValue(), multiplied
by 100; if Stock.getBookValue() or getPrice() returns 0,
then this method returns 0. |
BigDecimal |
getPrice()
Return the aPrice passed to the constructor. |
BigDecimal |
getProfit()
Return getCurrentValue() less Stock.getBookValue(). |
Stock |
getStock()
Return the aStock passed to the constructor. |
int |
hashCode()
|
String |
toString()
Represent this object as a String - intended for logging purposes only. |
| Methods inherited from class Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Quote(Stock aStock,
BigDecimal aCurrentPrice,
BigDecimal aChange)
aStock - satisfies aStock!=nullaCurrentPrice - current price of aStock,and
satisfies aPrice!=null && aPrice>=0aChange - current price less the opening price of aStock,
and satisfies aChange!=null| Method Detail |
|---|
public BigDecimal getPercentChange()
getPrice() returns 0, then this method returns 0.
Example: current price=1.00 and change=0.20, returns a value of 25.00.
public BigDecimal getCurrentValue()
Stock.getNumShares() and getPrice().
Represents the current value of the holding, using the latest available
price quote.
public BigDecimal getProfit()
getCurrentValue() less Stock.getBookValue().
public BigDecimal getPercentProfit()
getProfit() divided by Stock.getBookValue(), multiplied
by 100; if Stock.getBookValue() or getPrice() returns 0,
then this method returns 0.
public Stock getStock()
public BigDecimal getPrice()
public BigDecimal getChange()
public String toString()
toString in class Objectpublic boolean equals(Object aThat)
equals in class Objectpublic int hashCode()
hashCode in class Object
|
StocksMonitor 1.5.0 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||