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             * ID for serialization.
016             */
017            private static final long serialVersionUID = 8492672871276120729L;
018    
019            /**
020         * Create a new CurrencyItemImpl.
021         *
022         * @param sName the name of the currency item.
023         * @param nValue the value of the item, expressed in the smallest unit of the associated currency.
024         */
025        public CurrencyItemImpl(String sName, int nValue) {
026            super(sName, new IntegerValue(nValue));
027        }
028    
029        /**
030         * @override Never
031         */
032        public CatalogItemImpl getShallowClone() {
033            return new CurrencyItemImpl(getName(), ((NumberValue)getValue()).getValue().intValue());
034        }
035    
036        /**
037         * @override Never
038         */
039        public String toString() {
040            return getName() + ": " + ((getCatalog() != null) ?
041                    (((Currency)getCatalog()).toString((NumberValue)getValue())) : (getValue().toString()));
042        }
043    }