Changeset 220 in tmcsimulator
- Timestamp:
- 11/03/2017 02:55:08 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
-
src/tmcsim/application.properties (modified) (1 diff)
-
src/tmcsim/cadsimulator/managers/TrafficModelManager.java (modified) (1 diff)
-
test/tmcsim/cadsimulator/managers/TrafficModelManagerTest.java (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/tmcsim/application.properties
r218 r220 1 #Fri, 03 Nov 2017 00:16:13-07001 #Fri, 03 Nov 2017 16:03:39 -0700 2 2 3 Application.revision=21 73 Application.revision=218 4 4 5 5 Application.buildnumber=69 -
trunk/src/tmcsim/cadsimulator/managers/TrafficModelManager.java
r210 r220 290 290 { 291 291 LinkedList<TrafficEvent> eventList = new LinkedList<TrafficEvent>(); 292 while (scan.hasNext()) 293 { 294 // Read a line and add it to the event queue 295 String line = scan.nextLine().trim(); 296 if (line.charAt(0) != '#') 297 { 298 TrafficEvent evt; 299 try 300 { 301 evt = new TrafficEvent(line); 302 eventList.add(evt); 303 } 304 catch (ParseException ex) 305 { 306 Logger.getLogger(TrafficModelManager.class.getName()).log(Level.SEVERE, null, ex); 307 System.out.println("Wrong format data in batch event file: " + line + " \nskipping."); 308 System.out.println("Skipping badly formatted event."); 309 } 310 } 311 } 292 while (scan.hasNext()) 293 { 294 // Read a line and add it to the event queue 295 String line = scan.nextLine().trim(); 296 // Ignore blank lines and comments 297 if (line.length() > 0 && line.charAt(0) != '#') 298 { 299 TrafficEvent evt; 300 try 301 { 302 evt = new TrafficEvent(line); 303 eventList.add(evt); 304 } 305 catch (ParseException ex) 306 { 307 Logger.getLogger(TrafficModelManager.class.getName()).log(Level.SEVERE, null, ex); 308 System.out.println("Wrong format data in batch event file: " + line + " \nskipping."); 309 System.out.println("Skipping badly formatted event."); 310 } 311 } 312 } 312 313 System.out.println("Events file read, " + eventList.size() + " events queued."); 313 314 // Put the events in chronological order -
trunk/test/tmcsim/cadsimulator/managers/TrafficModelManagerTest.java
r204 r220 35 35 } 36 36 37 /**38 * Test of readBatchFile method, of class TrafficModelManager.39 */40 37 public void testReadBatchFile() throws SimulationException, ParseException 41 38 { … … 55 52 assertEquals(expResult, result); 56 53 } 57 54 /** 55 * Test of readBatchFile method, of class TrafficModelManager. 56 */ 57 public void testReadBatchFile2() throws SimulationException, ParseException 58 { 59 System.out.println("readBatchFile blank lines test"); 60 String alpha = " "; 61 String bravo = "187 00:00:37 55 S 6.88 0.2 R"; 62 String dataIn = alpha + "\n" + bravo + "\n"; 63 Scanner scan = new Scanner(dataIn); 64 65 LinkedList<TrafficEvent> result = TrafficModelManager.readBatchFile(scan); 66 assertEquals(1,result.size()); 67 } 68 58 69 public void testCreateIncidentMap() throws ParseException 59 70 {
Note: See TracChangeset
for help on using the changeset viewer.
