Index: trunk/src/atmsdriver/model/Highways.java
===================================================================
--- trunk/src/atmsdriver/model/Highways.java	(revision 101)
+++ trunk/src/atmsdriver/model/Highways.java	(revision 103)
@@ -1,8 +1,6 @@
 package atmsdriver.model;
 
-import atmsdriver.NetworkLoader;
-import atmsdriver.model.Station.DIRECTION;
+import atmsdriver.FEPLineLoader;
 import java.io.File;
-import java.io.FileNotFoundException;
 import java.io.FileWriter;
 import java.io.IOException;
@@ -13,12 +11,8 @@
 import java.util.ArrayList;
 import java.util.Collections;
-import java.util.Enumeration;
 import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.List;
 import java.util.Map;
 import java.util.Observable;
 import java.util.Observer;
-import java.util.Scanner;
 import java.util.Set;
 import java.util.logging.Level;
@@ -34,17 +28,29 @@
 import org.w3c.dom.Element;
 
-/**
+/** The Highways class aggregates all Highway instances within a geographic
+ *  region, and all of the FEPLines within an electronic detector 
+ *  network, in the same geographic region. An instance of Highways.java 
+ *  comprises the underlying model for the ATMSDriver application.
+ * 
+ *  Highways uses method writeToFEP() to communicate with the FEP Simulator. 
+ *  It creates a socket client which sends the FEP Simulator a highways status
+ *  message over the socket. This message is in the XML format required by the 
+ *  FEP Simulator, which is provided by the resident toXML() method.
+ * 
+ *  Currently, there is no driving logic within the highways class. It is only
+ *  done through an instance of the ConsoleDriver.java class. Eventually, it
+ *  will receive incident data (from exchange.xml or better yet, directly from 
+ *  the TMCSimulator itself) and drive the highways using resident logic.
  *
  * @author John A. Torres
  */
-public class Highways implements Observer {
+public class Highways {
 
     final private ArrayList<FEPLine> lines;
     final private String FEPHostName;
     final private int FEPPortNum;
-    final private ArrayList<Highway> highways;
-    private Map<Integer, List<Station>> HiwayMap = new HashMap<Integer, List<Station>>();
     
-    // NEED FINISH final private ArrayList<Highway> highways;
+    final public ArrayList<Highway> highways;
+    
     public Highways(String ldsFileName, String loopsFileName,
             String highwayMetaFileName, String FEPHostName, int FEPPortNum) {
@@ -54,5 +60,5 @@
          */
 
-        NetworkLoader ldr = new NetworkLoader(new File(ldsFileName), new File(loopsFileName));
+        FEPLineLoader ldr = new FEPLineLoader(new File(ldsFileName), new File(loopsFileName));
         this.lines = (ArrayList<FEPLine>) ldr.getFEPLines();
         this.FEPHostName = FEPHostName;
@@ -61,10 +67,4 @@
         //writeHighwaysMeta("hard.txt");
     }
-
-    public ArrayList<Highway> getHighways()
-    {
-        return this.highways;
-    }
-    
     
     private ArrayList<Highway> loadHighways() {
@@ -72,46 +72,41 @@
         // The list of highways to return
         ArrayList<Highway> highways = new ArrayList<Highway>();
-        Hashtable<Hashtable<Integer, DIRECTION>, ArrayList<Station>>
-                highwayTable = new Hashtable<>();
+        
+        Map<Integer, ArrayList<Station>>
+                highwayMap = new HashMap<>();
         
         for (FEPLine line : lines)
         {
-            ArrayList<Station> lineStations = (ArrayList<Station>) line.getStations();
+            ArrayList<Station> lineStations = (ArrayList<Station>) line.stations;
             for(Station station : lineStations)
             {
-                Integer hwyNum = station.getHighwayNumber();
-                DIRECTION dir = station.getDirection();
-                Hashtable<Integer, DIRECTION> check = new Hashtable<>();
-                check.put(hwyNum, dir);
-                if(highwayTable.get(check) == null)
+                Integer hwyNum = station.routeNumber;
+
+                if(!highwayMap.containsKey(hwyNum))
                 {
                     ArrayList<Station> stnList = new ArrayList<>();
                     stnList.add(station);
-                    Hashtable<Hashtable<Integer, DIRECTION>, ArrayList<Station>>
-                            newEntry = new Hashtable();
-                    newEntry.put(check, stnList);
-                    highwayTable.putAll(newEntry);
+                    highwayMap.put(hwyNum, stnList);
                 }
                 else
                 {
-                    highwayTable.get(check).add(station);
+                    highwayMap.get(hwyNum).add(station);
                 }
             }
         }
         
-        Set<Hashtable<Integer, DIRECTION>> hwyKeys = highwayTable.keySet();
-        for(Hashtable<Integer, DIRECTION> hwyKey : hwyKeys)
+        Set<Integer> hwyKeys = highwayMap.keySet();
+        for(Integer hwyKey : hwyKeys)
         {
-            Enumeration<Integer> hwyNumEnum = hwyKey.keys();
-            Integer hwyNum = hwyNumEnum.nextElement();
-            ArrayList<Station> hwyStations = highwayTable.get(hwyKey);
-            DIRECTION hwyDir = hwyKey.get(hwyNum);
-            Collections.sort(highwayTable.get(hwyKey));
-            System.out.println("Adding highway: " + hwyNum + " " + hwyDir.toString().charAt(0));
-            highways.add(new Highway(hwyNum, 
+            ArrayList<Station> hwyStations = highwayMap.get(hwyKey);
+            Collections.sort(hwyStations);
+            System.out.println("Loaded highway " + hwyKey + "...");
+            highways.add(new Highway(hwyKey, 
                     hwyStations));
         }
+        System.out.println("");
         return highways;
     }
+    
     /*
      private ArrayList<FEPLine> loadLines(String highwayMetaFileName) {
@@ -215,6 +210,4 @@
 
     public void writeToFEP() {
-                    System.out.println(this.toXML().toCharArray().length);
-
         try {
             Socket sock = new Socket(FEPHostName, FEPPortNum);
@@ -293,7 +286,15 @@
     }
 
-    @Override
-    public void update(Observable o, Object arg) {
-        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+    public Highway getHighwayByRouteNumber(Integer routeNum) {
+        Highway returnHwy = null;
+        for(Highway hwy : highways)
+        {
+            if(hwy.routeNumber.equals(routeNum))
+            {
+                returnHwy = hwy;
+                break;
+            }
+        }
+        return returnHwy;
     }
 
