001    package data.events;
002    
003    import java.util.*;
004    
005    import data.*;
006    
007    /**
008     * <i>Abstract</i> super class of all events indicating changes in a Stock's contents.
009     *
010     * <p>The concrete implementations depend on the concrete implementations of the Stock interface.</p>
011     *
012     * @author Steffen Zschaler
013     * @version 2.0 19/08/1999
014     * @since v2.0
015     */
016    public abstract class StockChangeEvent<T extends StockItem, CT extends CatalogItem> extends EventObject {
017    
018        /**
019         * The DataBasket that was used to perform the operation.
020         *
021         * @serial
022         */
023        private DataBasket m_dbBasket;
024    
025        /**
026         * Create a new StockChangeEvent.
027         *
028         * @param lstSource the Stock that triggers the event.
029         * @param dbBasket the basket used for the operation.
030         */
031        public StockChangeEvent(ListenableStock<T, CT> lstSource, DataBasket dbBasket) {
032            super(lstSource);
033    
034            m_dbBasket = dbBasket;
035        }
036    
037        /**
038         * Get the name of the items that are affected by the event.
039         *
040         * @override Always
041         */
042        public abstract String getAffectedKey();
043    
044        /**
045         * Count the items affected by this event.
046         *
047         * @override Always
048         */
049        public abstract int countAffectedItems();
050    
051        /**
052         * Get the items that are affected by the event.
053         *
054         * @override Always
055         */
056        public abstract Iterator<T> getAffectedItems();
057    
058        /**
059         * Get the DataBasket used for the operation.
060         *
061         * @override Never
062         */
063        public DataBasket getBasket() {
064            return m_dbBasket;
065        }
066    }