Großmarkt

market.statistics
Class CISalesStats

java.lang.Object
  |
  +--data.AbstractNameable
        |
        +--data.ooimpl.CatalogItemImpl
              |
              +--market.statistics.CISalesStats
All Implemented Interfaces:
CatalogItem, Cloneable, Comparable, DataBasketKeys, Nameable, Serializable

public class CISalesStats
extends CatalogItemImpl

Represents a statistics for one article of the market's offer.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class data.AbstractNameable
m_ncContext, m_pcsPropertyListeners
 
Fields inherited from interface data.CatalogItem
VALUE_PROPERTY
 
Fields inherited from interface data.Nameable
NAME_PROPERTY
 
Fields inherited from interface data.DataBasketKeys
CATALOG_ITEM_MAIN_KEY, STOCK_ITEM_MAIN_KEY
 
Constructor Summary
CISalesStats(String articleID, int revenue, int amount)
           
 
Method Summary
 void addAmount(int amount)
          Increases the saved amount of sold items.
 void addRevenue(int revenue)
          Increases the revenue made from this article.
 void appendOrderHistory(List oh)
          Concatenates an external order history with this one.
 void appendPriceHistory(List ph)
          Concatenates an external price history with this one.
 int getAmount()
           
 String getArticleID()
           
 HistoryEntry getLastEntry(List l)
           
 int getOrderAmount()
          Iterates over the order history and sums up the amount of bought items.
 List getOrderHistory()
           
 List getPriceHistory()
          Returns the price history.
 int getRevenue()
           
 CatalogItemImpl getShallowClone()
           
 void newPriceSet(Calendar date, int newPrice)
          Appends a new entry to the #priceHistory.
 void ordered(Calendar date, int amount)
          Appends a new entry to the #orderHistory.
 String toString()
           
 
Methods inherited from class data.ooimpl.CatalogItemImpl
addValueListener, compareTo, equals, getCatalog, getValue, isEditable, removeValueListener, setValue
 
Methods inherited from class data.AbstractNameable
addNameListener, addPropertyChangeListener, attach, detachNC, getName, removeNameListener, removePropertyChangeListener, setName
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface data.Nameable
addNameListener, addPropertyChangeListener, attach, detachNC, getName, removeNameListener, removePropertyChangeListener, setName
 

Constructor Detail

CISalesStats

public CISalesStats(String articleID,
                    int revenue,
                    int amount)
Parameters:
articleID - the ID of the article statistics. It must match the real article's ID.
revenue - the revenue made from this article.
amount - the amount of sold items.
Method Detail

getArticleID

public String getArticleID()

getRevenue

public int getRevenue()

getAmount

public int getAmount()

getPriceHistory

public List getPriceHistory()
Returns the price history. If the last history entry is provisional, it is removed from the returned list. It is, however, not removed from the internal #priceHistory.

Returns:
the price history.

getOrderHistory

public List getOrderHistory()

getLastEntry

public HistoryEntry getLastEntry(List l)
Parameters:
l - the history (#orderHistory or #priceHistory)list of which the last item is of interest.
Returns:
the last entry of a history list.

addAmount

public void addAmount(int amount)
Increases the saved amount of sold items.

Parameters:
amount - the amount of itmes to add.

addRevenue

public void addRevenue(int revenue)
Increases the revenue made from this article.

Parameters:
revenue - the revenue to be added.

newPriceSet

public void newPriceSet(Calendar date,
                        int newPrice)
Appends a new entry to the #priceHistory.

Parameters:
date - the date of the price change.
newPrice - the new price.

ordered

public void ordered(Calendar date,
                    int amount)
Appends a new entry to the #orderHistory.

Parameters:
date - the date of the price change.
amount - the amount ordered

appendPriceHistory

public void appendPriceHistory(List ph)
Concatenates an external price history with this one.

Parameters:
ph - the price history to be added.

appendOrderHistory

public void appendOrderHistory(List oh)
Concatenates an external order history with this one.

Parameters:
oh - the order history to be added.

getOrderAmount

public int getOrderAmount()
Iterates over the order history and sums up the amount of bought items.

Returns:
the amount of items ordered by the manager.

getShallowClone

public CatalogItemImpl getShallowClone()
Specified by:
getShallowClone in class CatalogItemImpl

toString

public String toString()
Overrides:
toString in class CatalogItemImpl

Großmarkt