SalesPoint Framework v3.0

data.ooimpl
Class StockItemImpl

java.lang.Object
  |
  +--data.AbstractNameable
        |
        +--data.ooimpl.StockItemImpl
Direct Known Subclasses:
StockImpl

public class StockItemImpl
extends AbstractNameable
implements StockItem, DataBasketKeys

Pure Java implementation of the StockItem interface. See the documentation for StockItem for a description of the semantics of this class.

Hooks:
Define StockItem
Since:
v2.0
Version:
2.0 19/08/1999
Author:
Steffen Zschaler
See Also:
Serialized Form

Fields inherited from class data.AbstractNameable
m_ncContext, m_pcsPropertyListeners
 
Constructor Summary
StockItemImpl(String sName)
          Create a new StockItemImpl.
 
Method Summary
 Object clone()
          Clone this StockItem.
 int compareTo(Object o)
          Compare this StockItem to the given object.
 boolean equals(Object o)
          Check whether this StockItem equals the given object.
 CatalogItem getAssociatedItem(DataBasket db)
          Get the CatalogItem that is associated with this StockItem.
 StockItemImpl getShallowClone()
          Get a shallow clone of this item.
 Stock getStock()
          Get the Stock that contains this StockItem.
protected  void setStock(StockImpl sti)
          Set the Stock that contains this StockItem.
 String toString()
          Return a String representation of the item.
 
Methods inherited from class data.AbstractNameable
addNameListener, addPropertyChangeListener, attach, detachNC, getName, removeNameListener, removePropertyChangeListener, setName
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StockItemImpl

public StockItemImpl(String sName)
Create a new StockItemImpl.
Parameters:
sName - the name of the new item.
Method Detail

getStock

public Stock getStock()
Get the Stock that contains this StockItem.
Override:
Never.
Specified by:
getStock in interface StockItem

getAssociatedItem

public CatalogItem getAssociatedItem(DataBasket db)
Get the CatalogItem that is associated with this StockItem.

If the StockItem has a Stock, the associated CatalogItem is the CatalogItem of the same name that is found in the Stock's associated Catalog. Otherwise, it is null.

Override:
Never.
Specified by:
getAssociatedItem in interface StockItem
Parameters:
db - the DataBasket used to determine visibility.

setStock

protected void setStock(StockImpl sti)
Set the Stock that contains this StockItem.
Override:
Never.

clone

public Object clone()
Clone this StockItem.
Override:
Always.
Specified by:
clone in interface StockItem
Overrides:
clone in class Object
Hooks:
Define StockItem

getShallowClone

public StockItemImpl getShallowClone()
Get a shallow clone of this item.

For a normal item, shallow and deep clones are identical, which is why the default implementation returns ((StockItemImpl) clone()). However, when making a shallow clone of a Stock, the individual StockItems will not be cloned.

Override:
Sometimes.
The default implementation returns (StockItemImpl) clone().

equals

public boolean equals(Object o)
Check whether this StockItem equals the given object.
Override:
Sometimes.
The default implementation returns (this == o).
Overrides:
equals in class Object
Hooks:
Define StockItem

compareTo

public int compareTo(Object o)
Compare this StockItem to the given object.
Override:
Sometimes.
The default implementation will assume o to be a StockItem and will compare the names. Stocks, however, will always be greater than StockItems.
Throws:
ClassCastException - if the given object cannot be converted into a StockItem.
Hooks:
Define StockItem

toString

public String toString()
Return a String representation of the item.
Override:
Sometimes.
Overrides:
toString in class Object

SalesPoint Framework v3.0