import java.util.*;

public class Rules
{
    public static final String BAGS = "bags";
    public static final String BAGS_CONTAINS = "bags contain";
    public static final String NO_BAGS = "no other bags";
    public static final String SEPARATOR = ",";
    public static final String TERMINATOR = ".";

    public Rules (boolean debug)
    {
        _debug = debug;
    }

    public Inventory parse (String dataFile)
    {
        Vector<String> rules = Util.loadData(dataFile, _debug);
        Inventory inv = new Inventory(_debug);
        Enumeration<String> iter = rules.elements();
        boolean error = false;

        while (iter.hasMoreElements() && !error)
        {
            String line = iter.nextElement();
            int index = line.indexOf(BAGS_CONTAINS);  // name of bag

            if (index != -1)
            {

            }
            else
                error = true;
        }

        return inv;
    }

    private boolean _debug;
}
@@ -186,16 +186,17 @@
 BAGS = %22
+ 
 no other
@@ -199,24 +199,77 @@
 ther bags%22;%0A
+    public static final String CONTAINS = %22contain%22;%0A
     public s
@@ -889,16 +889,473 @@
       %7B%0A
+                String bagColour = line.substring(0, index);%0A                Bag theBag = new Bag(bagColour);%0A%0A                inv.add(theBag);%0A%0A                String contents = line.substring(index + BAGS_CONTAINS.length());%0A                %0A                if (!contents.equals(NO_BAGS))%0A                %7B%0A                    index = 0;%0A%0A                    while (index %3C contents.length())%0A                    %7B%0A%0A                    %7D%0A                %7D
 %0A       

Update Rules.java