celeboss.data
Class PurchasedShares

java.lang.Object
  extended byceleboss.data.ShareBlock
      extended byceleboss.data.PurchasedShares
All Implemented Interfaces:
java.util.EventListener, Monitorable, java.beans.PropertyChangeListener, java.io.Serializable

public class PurchasedShares
extends ShareBlock
implements java.io.Serializable

This class represents a block of shares assigned to a Celebrity

Version:
1.0
Author:
bevans
See Also:
Serialized Form

Field Summary
static java.lang.String COST
          Property name for cost of Shares
static java.lang.String PROFIT
          Property name for current profit
static java.lang.String WORTH
          Property name for worth of Shares
 
Fields inherited from class celeboss.data.ShareBlock
CELEBRITY, NUMBEROFSHARES, PREDICTEDDIV, PREDICTEDVALUE, PURCHASED
 
Constructor Summary
  PurchasedShares(Portfolio parent, Celebrity celeb, int number, java.lang.Float origPrice)
          Create a new block of shares in a specific celebrity
protected PurchasedShares(PurchasedShares element)
          Create a clone copy of the specified object
 
Method Summary
protected  void calculateWorthProfit()
          Calculate the profit and value based on number of share and current share price
 java.lang.Float getCost()
          Return the cost of purchase
 java.lang.Float getProfit()
          Return the profit
 java.lang.Float getWorth()
          Return the current value of shares
 void init()
          THis method is called to initialise the entity once the complete and has either been accepted by the Portfolio or when the Celebrity model has been loaded.
 void propertyChange(java.beans.PropertyChangeEvent arg0)
          Change has occured
 
Methods inherited from class celeboss.data.ShareBlock
addPropertyChangeListener, calculatePredictedDividend, calculatePredictedValue, firePropertyChange, getCelebrity, getNumberOfShares, getOwner, getPredictedDividend, getPredictedValue, getPurchased, release, removePropertyChangeListener, setNumberOfShares, setPurchased, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

COST

public static final java.lang.String COST
Property name for cost of Shares

See Also:
Constant Field Values

WORTH

public static final java.lang.String WORTH
Property name for worth of Shares

See Also:
Constant Field Values

PROFIT

public static final java.lang.String PROFIT
Property name for current profit

See Also:
Constant Field Values
Constructor Detail

PurchasedShares

public PurchasedShares(Portfolio parent,
                       Celebrity celeb,
                       int number,
                       java.lang.Float origPrice)
Create a new block of shares in a specific celebrity

Parameters:
parent - Parent portfolio.
celeb - Celebrity of shares
number - Number of shares
origPrice - Original purchase cost

PurchasedShares

protected PurchasedShares(PurchasedShares element)
Create a clone copy of the specified object

Parameters:
element - Source for copy.
Method Detail

calculateWorthProfit

protected void calculateWorthProfit()
Calculate the profit and value based on number of share and current share price


getCost

public java.lang.Float getCost()
Return the cost of purchase

Returns:
Money value.

getProfit

public java.lang.Float getProfit()
Return the profit

Returns:
Money value.

getWorth

public java.lang.Float getWorth()
Return the current value of shares

Returns:
Money value.

init

public void init()
THis method is called to initialise the entity once the complete and has either been accepted by the Portfolio or when the Celebrity model has been loaded.

Overrides:
init in class ShareBlock

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent arg0)
Change has occured

Specified by:
propertyChange in interface java.beans.PropertyChangeListener
Overrides:
propertyChange in class ShareBlock
Parameters:
arg0 - Event describing change.