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);
    }

    public final int bagCount (Bag theBag)
    {
        int count = 0;
        Enumeration<Bag> iter = _bags.elements();

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

            if (b.contains(theBag))
                count++;
        }

        return count;
    }

    @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;
}
@@ -333,32 +333,343 @@
 bags.elements();
+%0A        Vector%3CBag%3E indirect = new Vector%3CBag%3E();%0A%0A        while (iter.hasMoreElements())%0A        %7B%0A            Bag b = iter.nextElement();%0A%0A            if (b.contains(theBag))%0A            %7B%0A                count++;%0A%0A                indirect.add(b);%0A            %7D%0A        %7D%0A%0A        iter = indirect.elements();
 %0A%0A        while 

Update Inventory.java