 

import java.util.ArrayList;
import java.util.Iterator;

/**
 * The database class provides a facility to store multi-
 * media objects. A list of all multi-media items can be printed
 * to the terminal.
 *
 * This version does not save the data to disk, and it does
 * not provide any search functions.
 *
 * @author Michael Kölling and David J. Barnes
 * @updates and changes by Michael Rivers
 * @version April 12th 2006
 */
public class Database
{
    private ArrayList items;
    
    /**
     * Construct an empty Database.
     */
    public Database()
    {
        items = new ArrayList();
    }
    
    /**
     * Add an item to the database.
     */
    public void addItem(Item theItem)
    {
        items.add(theItem);
    }

    /**
     * Print a list of all currently stored items to the text terminal.
     */
    public void list()
    {
        for(Iterator iter = items.iterator(); iter.hasNext(); ) {
            Item item = (Item)iter.next();
            item.print();
            System.out.println();    // empty line between items
        }
    }
}
