001    package data.ooimpl;
002    
003    import data.*;
004    
005    /**
006     * Pure Java implementation of the {@link CurrencyItem} interface.
007     *
008     * @author Steffen Zschaler
009     * @version 2.0 19/08/1999
010     * @since v2.0
011     */
012    public class CurrencyItemImpl extends CatalogItemImpl implements CurrencyItem {
013    
014        /**
015         * Create a new CurrencyItemImpl.
016         *
017         * @param sName the name of the currency item.
018         * @param nValue the value of the item, expressed in the smallest unit of the associated currency.
019         */
020        public CurrencyItemImpl(String sName, int nValue) {
021            super(sName, new IntegerValue(nValue));
022        }
023    
024        /**
025         * @override Never
026         */
027        public CatalogItemImpl getShallowClone() {
028            return new CurrencyItemImpl(getName(), ((NumberValue)getValue()).getValue().intValue());
029        }
030    
031        /**
032         * @override Never
033         */
034        public String toString() {
035            return getName() + ": " + ((getCatalog() != null) ?
036                    (((Currency)getCatalog()).toString((NumberValue)getValue())) : (getValue().toString()));
037        }
038    }