Index: /trunk/src/tmcsim/application.properties
===================================================================
--- /trunk/src/tmcsim/application.properties	(revision 87)
+++ /trunk/src/tmcsim/application.properties	(revision 88)
@@ -1,5 +1,5 @@
-#Tue, 10 Oct 2017 02:07:01 -0700
+#Tue, 10 Oct 2017 13:13:29 -0700
 
-Application.revision=84
+Application.revision=87
 
-Application.buildnumber=48
+Application.buildnumber=50
Index: /trunk/src/atmsdriver/ATMSDriver.java
===================================================================
--- /trunk/src/atmsdriver/ATMSDriver.java	(revision 87)
+++ /trunk/src/atmsdriver/ATMSDriver.java	(revision 88)
@@ -78,5 +78,4 @@
                     .getProperty(PROPERTIES.EXCHANGE_FILE_NAME.name));
 
-            System.out.println(highways.toXML());
             highways.writeToFEP();
             // Update if exchangeInfo is recieved
Index: /trunk/src/atmsdriver/model/Highway.java
===================================================================
--- /trunk/src/atmsdriver/model/Highway.java	(revision 87)
+++ /trunk/src/atmsdriver/model/Highway.java	(revision 88)
@@ -1,4 +1,5 @@
 package atmsdriver.model;
 
+import atmsdriver.model.Station.DIRECTION;
 import java.util.ArrayList;
 import java.util.Collections;
@@ -9,15 +10,14 @@
  */
 class Highway {
+    
     final private ArrayList<Station> stations;
+    final private Integer highwayNumber;
+    final private DIRECTION direction;
     
-    public Highway(ArrayList<FEPLine> lines, int highway)
+    public Highway(Integer highwayNum, DIRECTION direction, ArrayList<Station> stations)
     {
-        stations = new ArrayList<Station>();
-        loadHighwayStations(lines);
-    }
-    
-    private void loadHighwayStations(ArrayList<FEPLine> lines)
-    {
-        Collections.sort(stations);
+        this.highwayNumber = highwayNum;
+        this.direction = direction;
+        this.stations = stations;
     }
 }
Index: /trunk/src/atmsdriver/model/Station.java
===================================================================
--- /trunk/src/atmsdriver/model/Station.java	(revision 87)
+++ /trunk/src/atmsdriver/model/Station.java	(revision 88)
@@ -50,4 +50,14 @@
     }
 
+    public int getHighwayNumber()
+    {
+        return this.freeway;
+    }
+    
+    public DIRECTION getDirection()
+    {
+        return this.direction;
+    }
+    
     /**
      * Returns the station metadata in condensed form. This is just a quick
Index: /trunk/src/atmsdriver/model/FEPLine.java
===================================================================
--- /trunk/src/atmsdriver/model/FEPLine.java	(revision 87)
+++ /trunk/src/atmsdriver/model/FEPLine.java	(revision 88)
@@ -40,4 +40,14 @@
         this.globalSeq = globalSeq;
         this.scheduleSeq = scheduleSeq;
+    }
+    
+    public int getLineNumber()
+    {
+        return this.lineNum;
+    }
+    
+    public List<Station> getStations()
+    {
+        return this.stations;
     }
     
Index: /trunk/src/atmsdriver/model/Highways.java
===================================================================
--- /trunk/src/atmsdriver/model/Highways.java	(revision 87)
+++ /trunk/src/atmsdriver/model/Highways.java	(revision 88)
@@ -12,5 +12,10 @@
 import java.net.Socket;
 import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Map;
 import java.util.Scanner;
+import java.util.Set;
 import java.util.logging.Level;
 import java.util.logging.Logger;
@@ -27,5 +32,5 @@
 /**
  *
- * @author andrew
+ * @author John A. Torres
  */
 public class Highways {
@@ -34,128 +39,168 @@
     final private String FEPHostName;
     final private int FEPPortNum;
+    final private ArrayList<Highway> highways;
     
     // NEED FINISH final private ArrayList<Highway> highways;
-    
-    public Highways(String ldsFileName, String loopsFileName, 
+    public Highways(String ldsFileName, String loopsFileName,
             String highwayMetaFileName, String FEPHostName, int FEPPortNum) {
         /*
-        lines = loadLines(highwayMetaFileName);
-        System.out.println("SIZE: " + toXML().toCharArray().length);
-        */
-        
+         lines = loadLines(highwayMetaFileName);
+         System.out.println("SIZE: " + toXML().toCharArray().length);
+         */
+
         NetworkLoader ldr = new NetworkLoader(new File(ldsFileName), new File(loopsFileName));
         this.lines = (ArrayList<FEPLine>) ldr.getFEPLines();
         this.FEPHostName = FEPHostName;
         this.FEPPortNum = FEPPortNum;
-        // NEED FINISH this.highways = loadHighways();
+        this.highways = loadHighways();
         //writeHighwaysMeta("hard.txt");
     }
+
     
-    // NEED FINISH
-    private void loadHighways()
-    {
+    private ArrayList<Highway> loadHighways() {
+        System.out.println("Loading highways...");
+        ArrayList<Highway> highways = new ArrayList<Highway>();
+        Hashtable<Hashtable<Integer, DIRECTION>, ArrayList<Station>>
+                highwayTable = new Hashtable<>();
         
-        //highways.add(new Highway(lines, ));
+        for (FEPLine line : lines)
+        {
+            ArrayList<Station> lineStations = (ArrayList<Station>) line.getStations();
+            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)
+                {
+                    ArrayList<Station> stnList = new ArrayList<>();
+                    stnList.add(station);
+                    Hashtable<Hashtable<Integer, DIRECTION>, ArrayList<Station>>
+                            newEntry = new Hashtable();
+                    newEntry.put(check, stnList);
+                    highwayTable.putAll(newEntry);
+                }
+                else
+                {
+                    highwayTable.get(check).add(station);
+                }
+            }
+        }
         
-    }
-/*
-    private ArrayList<FEPLine> loadLines(String highwayMetaFileName) {
-        ArrayList<FEPLine> lines = new ArrayList<>();
-        try {
-            Scanner sc = new Scanner(new File(highwayMetaFileName));
-            String firstLine = sc.nextLine();
-
-            Scanner linesc = new Scanner(firstLine);
-            int numLines = linesc.nextInt();
-            linesc.close();
-
-            for (int i = 0; i < numLines; i++) {
-                System.out.println("CURR: " + i);
-                lines.add(loadLine(sc));
-            }
-            sc.close();
-
-        } catch (FileNotFoundException ex) {
-            Logger.getLogger(Highways.class.getName()).log(Level.SEVERE, null, ex);
-        }
-        return lines;
-    }
-
-    private FEPLine loadLine(Scanner sc) {
-        String line = sc.nextLine();
-        System.out.println(line);
-        Scanner scline = new Scanner(line);
-
-        int lineNum = scline.nextInt();
-        int count = scline.nextInt();
-        int numStations = scline.nextInt();
-        ArrayList<Station> stations = new ArrayList<>();
-        for (int i = 0; i < numStations; i++) {
-            stations.add(loadStation(sc, lineNum));
-        }
-
-        return new FEPLine(lineNum, stations, count);
-    }
-
-    private Station loadStation(Scanner sc, int lineNum) {
-        String line = sc.nextLine();
-        System.out.println(line);
-        Scanner scline = new Scanner(line);
-        int ldsID = scline.nextInt();
-        int drop = scline.nextInt();
-        int fwy = scline.nextInt();
-        DIRECTION dir = DIRECTION.getEnum(scline.next());
-        double postmile = scline.nextDouble();
-        int numLoops = scline.nextInt();
-        String location = getStationLoc(line);
-        ArrayList<LoopDetector> loops = new ArrayList<>();
-        for (int i = 0; i < numLoops; i++) {
-            loops.add(loadLoop(sc));
-        }
-
-        return new Station(lineNum, ldsID, drop, location, loops, fwy, dir, postmile);
-    }
-
-    private LoopDetector loadLoop(Scanner sc) {
-        String line = sc.nextLine();
-        Scanner scline = new Scanner(line);
-
-        int loopID = scline.nextInt();
-        int laneNum = scline.nextInt();
-        String loopLoc = getLoopLoc(line); // NEED GET LOOPLOC
-        scline.close();
-        return new LoopDetector(loopID, loopLoc, laneNum);
-    }
-
-    private String getLoopLoc(String line) {
-        Scanner sc = new Scanner(line);
-        sc.nextInt();
-        sc.nextInt();
-
-        // GRABS FROM CURRENT TO END OF LINE
+        Set<Hashtable<Integer, DIRECTION>> hwyKeys = highwayTable.keySet();
+        for(Hashtable<Integer, DIRECTION> 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.name + " " + hwyStations.size());
+            highways.add(new Highway(hwyNum, 
+                    hwyDir, hwyStations));
+        }
+        return highways;
+    }
+    /*
+     private ArrayList<FEPLine> loadLines(String highwayMetaFileName) {
+     ArrayList<FEPLine> lines = new ArrayList<>();
+     try {
+     Scanner sc = new Scanner(new File(highwayMetaFileName));
+     String firstLine = sc.nextLine();
+
+     Scanner linesc = new Scanner(firstLine);
+     int numLines = linesc.nextInt();
+     linesc.close();
+
+     for (int i = 0; i < numLines; i++) {
+     System.out.println("CURR: " + i);
+     lines.add(loadLine(sc));
+     }
+     sc.close();
+
+     } catch (FileNotFoundException ex) {
+     Logger.getLogger(Highways.class.getName()).log(Level.SEVERE, null, ex);
+     }
+     return lines;
+     }
+
+     private FEPLine loadLine(Scanner sc) {
+     String line = sc.nextLine();
+     System.out.println(line);
+     Scanner scline = new Scanner(line);
+
+     int lineNum = scline.nextInt();
+     int count = scline.nextInt();
+     int numStations = scline.nextInt();
+     ArrayList<Station> stations = new ArrayList<>();
+     for (int i = 0; i < numStations; i++) {
+     stations.add(loadStation(sc, lineNum));
+     }
+
+     return new FEPLine(lineNum, stations, count);
+     }
+
+     private Station loadStation(Scanner sc, int lineNum) {
+     String line = sc.nextLine();
+     System.out.println(line);
+     Scanner scline = new Scanner(line);
+     int ldsID = scline.nextInt();
+     int drop = scline.nextInt();
+     int fwy = scline.nextInt();
+     DIRECTION dir = DIRECTION.getEnum(scline.next());
+     double postmile = scline.nextDouble();
+     int numLoops = scline.nextInt();
+     String location = getStationLoc(line);
+     ArrayList<LoopDetector> loops = new ArrayList<>();
+     for (int i = 0; i < numLoops; i++) {
+     loops.add(loadLoop(sc));
+     }
+
+     return new Station(lineNum, ldsID, drop, location, loops, fwy, dir, postmile);
+     }
+
+     private LoopDetector loadLoop(Scanner sc) {
+     String line = sc.nextLine();
+     Scanner scline = new Scanner(line);
+
+     int loopID = scline.nextInt();
+     int laneNum = scline.nextInt();
+     String loopLoc = getLoopLoc(line); // NEED GET LOOPLOC
+     scline.close();
+     return new LoopDetector(loopID, loopLoc, laneNum);
+     }
+
+     private String getLoopLoc(String line) {
+     Scanner sc = new Scanner(line);
+     sc.nextInt();
+     sc.nextInt();
+
+     // GRABS FROM CURRENT TO END OF LINE
          
-        sc.useDelimiter("\\z");
-        String loc = sc.next().trim();
-        sc.close();
-        return loc;
-    }
-
-    // Returns the loction given the whole line from the lookup file
-    private String getStationLoc(String line) {
-        Scanner scline = new Scanner(line);
-        scline.nextInt();
-        scline.nextInt();
-        scline.nextInt();
-        scline.next();
-        scline.nextDouble();
-        scline.nextInt();
-
-        // GRABS FROM CURRENT TO END OF LINE
-        scline.useDelimiter("\\z");
-        String loc = scline.next().trim();
-        scline.close();
-        return loc;
-    }
-*/
+     sc.useDelimiter("\\z");
+     String loc = sc.next().trim();
+     sc.close();
+     return loc;
+     }
+
+     // Returns the loction given the whole line from the lookup file
+     private String getStationLoc(String line) {
+     Scanner scline = new Scanner(line);
+     scline.nextInt();
+     scline.nextInt();
+     scline.nextInt();
+     scline.next();
+     scline.nextDouble();
+     scline.nextInt();
+
+     // GRABS FROM CURRENT TO END OF LINE
+     scline.useDelimiter("\\z");
+     String loc = scline.next().trim();
+     scline.close();
+     return loc;
+     }
+     */
+
     public void writeToFEP() {
         try {
@@ -168,5 +213,5 @@
         }
     }
-    
+
     // CHECK: DO WE EVEN NEED TO DO THIS?
     private void updateSequences() {
