// joi/4/estore/Catalog.java                         
//                                                            
//                                                            
// Copyright 2003 Bill Campbell and Ethan Bolker                         
                                                            
import java.util.TreeMap;

/**
 * A Catalog models the collection of Items that an
 * EStore might carry.
 *
 * @see EStore
 *
 * @version 4
 */

public class Catalog
{
    private TreeMap items;

    /**
     *  Construct a Catalog object.
     */

    public Catalog( ) 
    {
        items = new TreeMap();
    }

    /**
     * Add an Item to this Catalog.
     *
     * @param item the Item to add.
     */

    public void addItem( Item item )
    {
        items.put( item.getName(), item );
    }

    /**
     * Get an Item from this Catalog.
     *
     * @param itemName the name of the wanted Item
     *
     * @return the Item, null if none.
     */

    public Item getItem( String itemName ) 
    {
        return (Item)items.get(itemName);
    }

    /**
     * Display the contents of this Catalog.
     *
     * @param t the Terminal to print to.
     */

    public void show( Terminal t )
    {
        // loop on items, printing name and cost
        t.println("  [sorry, can't yet print Catalog contents]");
    }    
}
