a1
Class Catalog

java.lang.Object
  extended by a1.Catalog
All Implemented Interfaces:
Iterable<Item>

public class Catalog
extends Object
implements Iterable<Item>

This represents the set of Items that are available for purchase.


Constructor Summary
Catalog(String storeName)
           
 
Method Summary
 void add(Item item)
           
 Item getItem(String name)
           
 String getStoreName()
           
 Iterator<Item> iterator()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Catalog

public Catalog(String storeName)
Parameters:
storeName - is a string that defines the name of the catalog
Effects:
constructs a new Catalog with the store's name and a set of items indexed by the items name and the item
Method Detail

add

public void add(Item item)
Parameters:
item - is an Item to add to the set of items in the catalog
Modifies:
Catalog, inserting the Item into the Catalog, indexed by the item's name and the item

getItem

public Item getItem(String name)
Parameters:
name - is the name of an Item
Returns:
given the item name, return the Item with that name

getStoreName

public String getStoreName()
Returns:
the name of the Catalog

iterator

public Iterator<Item> iterator()
Specified by:
iterator in interface Iterable<Item>
Returns:
an iterator for the items in the catalog