import java.util.*;

public class Inventory
{
    public Inventory (boolean debug)
    {
        _bags = new Vector<Bag>();
        _debug = debug;
    }

    public final void insert (Bag b)
    {
        _bags.add(b);
    }

    @Override
    public String toString ()
    {
        String str = "";
        Enumeration<Bag> iter = _bags.elements();

        while (iter.hasMoreElements())
        {
            Bag b = iter.nextElement();

            str += b.printRule()+"\n";
        }

        return str;
    }

    private Vector<Bag> _bags;
    private boolean _debug;
}
@@ -216,24 +216,338 @@
 (b);%0A    %7D%0A%0A
+    public final int bagCount (Bag theBag)%0A    %7B%0A        int count = 0;%0A        Enumeration%3CBag%3E iter = _bags.elements();%0A%0A        while (iter.hasMoreElements())%0A        %7B%0A            Bag b = iter.nextElement();%0A%0A            if (b.contains(theBag))%0A                count++;%0A        %7D%0A%0A        return count;%0A    %7D%0A%0A
     @Overrid

Update Inventory.java