Index: /trunk/src/tmcsim/client/ATMSBatchDriver.java
===================================================================
--- /trunk/src/tmcsim/client/ATMSBatchDriver.java	(revision 128)
+++ /trunk/src/tmcsim/client/ATMSBatchDriver.java	(revision 129)
@@ -15,7 +15,11 @@
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
+import java.util.ArrayList;
 import java.util.Date;
+import java.util.HashMap;
 import java.util.InputMismatchException;
 import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
 import java.util.Properties;
 import java.util.Queue;
@@ -111,4 +115,8 @@
      */
     private Queue<String> eventQueue;
+    /**
+     * Map of incidents to events
+     */
+    private Map<String, List<String>> incidents;
     
     /** Instance of ConsoleDriver that contains the highway model */
@@ -132,4 +140,5 @@
             System.exit(0);
         }
+        incidents = new HashMap<String, List<String>> ();
         highways = new Highways(
         "config/vds_data/lds.txt",
@@ -179,5 +188,8 @@
                     // Get the time to launch the next event
                     String nextEvent = eventQueue.peek();
-                    String eventTimeField = nextEvent.substring(0,8);
+//                    String eventTimeField = nextEvent.substring(0,8);
+                    Scanner evtScan = new Scanner(nextEvent);
+                    String inci = evtScan.next();      
+                    String eventTimeField = evtScan.next();
                     Date eventTime = new Date();
                     try {
@@ -200,4 +212,5 @@
                         try
                         {
+                        lineScan.next(); // skip incident number field
                         lineScan.next(); // skip time field
                         int routeNumber = lineScan.nextInt();
@@ -233,9 +246,28 @@
         try {
             fis = new FileInputStream("config/vds_data/atmsBatchEvents.txt");
+            eventQueue = new LinkedList<String>();
+            // Read all lines from the file of events
             Scanner scan = new Scanner(fis);
-            eventQueue = new LinkedList<String>();
             while (scan.hasNext())
             {
-                eventQueue.add(scan.nextLine());
+                // Read a line and add it to the event queue
+                String line = scan.nextLine();
+                eventQueue.add(line);
+                // Parse the incident from the line
+                Scanner lineScan = new Scanner(line);
+                String incident = lineScan.next();
+                // Add the line to the list for the corresponding incident
+                List evtList;
+                if (incidents.containsKey(incident))
+                {
+                    evtList = incidents.get(incident);
+                }
+                else
+                {
+                    evtList = new ArrayList<String>();
+                }               
+                evtList.add(line);
+                // and put it back in the map
+                incidents.put(incident, evtList);
             }
         } catch (FileNotFoundException ex) {
