package data.events;

import java.util.*;

import data.*;

/**
  * <i>Abstract</i> super class of all events indicating changes in a Stock's contents.
  *
  * <p>The concrete implementations depend on the concrete implementations of the Stock interface.</p>
  *
  * @author Steffen Zschaler
  * @version 2.0 19/08/1999
  * @since v2.0
  */
public abstract class StockChangeEvent extends EventObject {

  /**
    * The DataBasket that was used to perform the operation.
    *
    * @serial
    */
  private DataBasket m_dbBasket;

  /**
    * Create a new StockChangeEvent.
    *
    * @param lstSource the Stock that triggers the event.
    * @param dbBasket the basket used for the operation.
    */
  public StockChangeEvent (ListenableStock lstSource,
                           DataBasket dbBasket) {
    super (lstSource);

    m_dbBasket = dbBasket;
  }

  /**
    * Get the name of the items that are affected by the event.
    *
    * @override Always
    */
  public abstract String getAffectedKey();

  /**
    * Count the items affected by this event.
    *
    * @override Always
    */
  public abstract int countAffectedItems();

  /**
    * Get the items that are affected by the event.
    *
    * @override Always
    */
  public abstract Iterator getAffectedItems();

  /**
    * Get the DataBasket used for the operation.
    *
    * @override Never
    */
  public DataBasket getBasket() {
    return m_dbBasket;
  }
}