Changeset 191 in tmcsimulator for trunk/src/atmsdriver/model/Highways.java
- Timestamp:
- 10/30/2017 01:35:05 PM (9 years ago)
- File:
-
- 1 edited
-
trunk/src/atmsdriver/model/Highways.java (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/atmsdriver/model/Highways.java
r190 r191 198 198 { 199 199 Scanner sc = new Scanner(new File(highwaysMapFileName)); 200 // first line of file contains number of FEP Lines 200 201 String firstLine = sc.nextLine(); 201 202 202 Scanner linesc = new Scanner(firstLine); 203 203 int numLines = linesc.nextInt(); 204 204 linesc.close(); 205 205 // FOR each FEP Line 206 206 for (int i = 0; i < numLines; i++) 207 207 { … … 227 227 String line = sc.nextLine(); 228 228 Scanner scline = new Scanner(line); 229 229 // Get the attribute of this FEP Line 230 230 int lineNum = scline.nextInt(); 231 231 int count = scline.nextInt(); 232 232 int numStations = scline.nextInt(); 233 233 ArrayList<Station> stations = new ArrayList<>(); 234 // Read all the stations for thie FEP Line 234 235 for (int i = 0; i < numStations; i++) 235 236 { … … 473 474 } 474 475 476 /** Return a string representation of the Highways */ 477 public String toString() 478 { 479 StringBuilder result = new StringBuilder(); 480 for (Highway hwy: highways) 481 { 482 result.append(""+String.format("%3s ",hwy.routeNumber)); 483 for (Station stat: hwy.stations) 484 { 485 result.append(stat.getColorByDirection(stat.direction)); 486 } 487 result.append("\n"); 488 } 489 return result.toString(); 490 } 475 491 /** 476 492 * XML tags used in writeToXML()
Note: See TracChangeset
for help on using the changeset viewer.
