package cs221.groupk.common; import java.util.Vector; import cs221.groupk.exceptions.database.*; /** * BoughtItemList is a container class for BoughtItems. This class is used * interanlly used within Disk to store/manipulate the BoughtItems, as well as * being passed out when the data has been reconstituted. * * <P><I>Code spell-checked - Chris Milner - 5th December 2000.</I><P> * * @author <A HREF="mailto:[email protected]">Paul Smith</A> */ public class BoughtItemList { /**data is a Vector that stores the BoughtItems*/ private Vector data = new Vector(50, 10); /** * Default Constructor. */ public BoughtItemList() { } /** * add adds the BoughtItem boughtItem to the data Vector. * @param BoughtItem boughtItem to be added. */ public void add(BoughtItem boughtItem) { data.add(boughtItem); } /** * getBoughtItem returns the BoughtItem at location index in the Vector * data. If the index is invalid then an exception is thrown. * @param int index of BoughtItem in Vector * @return BougthItem at index of Vector data. * @exception BoughtItemNotFoundException is thrown if the specified index * is out of range/otherwise invalid. */ public BoughtItem getBoughtItem(int index) throws BoughtItemNotFoundException { try { return null; //data.get(index); } catch(Exception e) { throw new BoughtItemNotFoundException("The BoughtItem index: " + String.valueOf(index) + " cannot be found."); } } }Page automatically generated on: 28/12/00 at: 7:58:12 PM.