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 CONTAINS = "contain";
    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)
            {
                String bagColour = line.substring(0, index);
                Bag theBag = new Bag(bagColour);

                inv.add(theBag);

                String contains = line.substring(index + BAGS_CONTAINS.length());

                if (!contains.equals(NO_BAGS))
                {
                    index = 0;

                    while (index < contains.length())
                    {
                        int temp = contains.indexOf(Rules.SEPARATOR, index);

                        if (temp != -1)
                        {
                            
                        }
                    }
                }
            }
            else
            {
                System.out.println("Error, no bag name found!");

                error = true;
            }
        }

        return inv;
    }

    private boolean _debug;
}
@@ -352,16 +352,60 @@
 R = %22.%22;
+%0A    public static final String SPACE = %22 %22;
 %0A%0A    pu
@@ -836,17 +836,22 @@
     int 
-i
+startI
 ndex = l
@@ -911,17 +911,22 @@
     if (
-i
+startI
 ndex != 
@@ -996,17 +996,22 @@
 ring(0, 
-i
+startI
 ndex);%0A 
@@ -1116,24 +1116,25 @@
  String 
-contains
+remainder
  = line.
@@ -1143,17 +1143,22 @@
 bstring(
-i
+startI
 ndex + B
@@ -1203,24 +1203,25 @@
    if (!
-contains
+remainder
 .equals(
@@ -1268,17 +1268,69 @@
         
-i
+boolean finished = false;%0A%0A                    startI
 ndex = 0
@@ -1363,33 +1363,17 @@
 le (
-index %3C contains.length()
+!finished
 )%0A  
@@ -1424,23 +1424,28 @@
 int 
-temp = contains
+endIndex = remainder
 .ind
@@ -1466,17 +1466,22 @@
 ARATOR, 
-i
+startI
 ndex);%0A%0A
@@ -1512,12 +1512,18 @@
 if (
-temp
+startIndex
  != 
@@ -1580,16 +1580,165 @@
         
+int spaceIndex = remainder.indexOf(Rules.SPACE, startIndex);%0A                            String number = remainder.substring(startIndex, spaceIndex);
 %0A       

Update Rules.java