import java.util.*;
import java.io.*;

public class Util
{
    public static final Vector<Category> loadData (String inputFile, boolean debug)
    {
        /*
         * Open the data file and read it in.
         */

        BufferedReader reader = null;
        Vector<Category> values = new Vector<Category>();

        try
        {
            reader = new BufferedReader(new FileReader(inputFile));

            while ((line = reader.readLine()) != null)
            {
                if (line.indexOf(Command.MASK) != -1)
                {
                    if (mask != null) // new entry
                    {
                        values.add(new Command(mask, cmds, debug));
                        cmds = null;
                    }

                    mask = line;
                }
                else
                {
                    if (cmds == null)
                        cmds = new Vector<String>();

                    cmds.add(line);
                }
            }

            if (cmds != null)
                values.add(new Command(mask, cmds, debug));
        }
        catch (Throwable ex)
        {
            ex.printStackTrace();
        }
        finally
        {
            try
            {
                reader.close();
            }
            catch (Throwable ex)
            {
            }
        }

        return values;
    }

    private Util ()
    {
    }
}
@@ -52,16 +52,188 @@
  Util%0A%7B%0A
+    public static final String YOUR_TICKET = %22your ticket:%22;%0A    public static final String NEARBY_TICKETS = %22nearby tickets:%22;%0A%0A    public static final String OR = %22or%22;%0A%0A
     publ
@@ -568,24 +568,57 @@
 putFile));%0A%0A
+            String line = null;%0A%0A
             
@@ -698,40 +698,65 @@
 if (
-line.indexOf(Command.MASK) != -1
+YOUR_TICKET.equals(line) %7C%7C (NEARBY_TICKETS.equals(line))
 )%0A  
@@ -761,38 +761,44 @@
                 
-%7B%0A
     
+break;%0A%0A
                 
@@ -802,128 +802,105 @@
    i
-f (mask != null) // new entry%0A                    %7B%0A                        values.add(new Command(mask, cmds, debug)
+nt colonIndex = line.indexOf(%22:%22);%0A                String type = line.substring(0, colonIndex
 );%0A
+%0A
     
@@ -915,392 +915,219 @@
     
-        cmds = null;%0A                    %7D%0A%0A                    mask = line;%0A                %7D%0A                else%0A                %7B%0A                    if (cmds == null)%0A                        cmds = new Vector%3CString%3E();%0A%0A                    cmds.add(line);%0A                %7D%0A            %7D%0A%0A            if (cmds != null)%0A                values.add(new Command(mask, cmds, debug));
+int orIndex = line.indexOf(OR);%0A                String firstRange = line.substring(colonIndex +1, orIndex).trim();%0A                String secondRange = line.substring(orIndex + OR.length()).trim();%0A            %7D
 %0A   

Update Util.java