Changeset 343 in tmcsimulator for trunk/src/atmsdriver/model/Highways.java
- Timestamp:
- 03/23/2019 05:40:52 PM (7 years ago)
- File:
-
- 1 edited
-
trunk/src/atmsdriver/model/Highways.java (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/atmsdriver/model/Highways.java
r306 r343 43 43 * FEP Simulator. 44 44 * 45 * Currently, there is no driving logic within the highways class. It is only46 * done through an instance of the ConsoleDriver.java class. Eventually, it will47 * receive incident data (from exchange.xml or better yet, directly from the48 * TMCSimulator itself) and drive the highways using resident logic.49 45 * 50 46 * @author John A. Torres … … 124 120 } 125 121 122 /** Search for a station with the given attributes 123 * 124 * @param routeNumber 125 * @param direction 126 * @param postmile 127 * @return the desired station, or null if not found. 128 */ 129 public Station findStation(Integer routeNumber, Station.DIRECTION direction, 130 Double postmile) 131 { 132 // Get the highway by route number 133 Highway highway = getHighwayByRouteNumber(routeNumber); 134 if (highway == null) 135 { 136 Logger.getLogger(Highways.class.getName()).log(Level.SEVERE, 137 "Highway "+routeNumber+" not found in findStation()", ""); 138 return null; 139 } 140 //Search the stations on this highway for a match 141 for (Station station : highway.stations) 142 { 143 if (station.matches(direction, postmile)) 144 { 145 return station; 146 } 147 } 148 return null; 149 } 126 150 /** 127 151 * Applies specified color to the specified highway stretch. Route number … … 158 182 // postmiles increase from s to n and w to e 159 183 // if the direction is south or west 160 if (direction.equals(Station.DIRECTION. SOUTH) || direction.equals(Station.DIRECTION.WEST))184 if (direction.equals(Station.DIRECTION.NORTH) || direction.equals(Station.DIRECTION.EAST)) 161 185 { 162 186 // add range value to startPost to get … … 440 464 /** 441 465 * Returns the Highways model data in XML format. 442 * 466 * Probably obsolete, since we aren't using exchange.xml any longer. 443 467 * @return highways data in XML format 444 468 */ … … 507 531 { 508 532 // Consider each route direction 509 for (DIRECTION dir: DIRECTION.values())533 for (DIRECTION dir: hwy.availDirs) 510 534 { 511 535 String rowLabel = ""+String.format("%3s ",hwy.routeNumber)+dir.getLetter()+' '; … … 514 538 for (Station stat: hwy.stations) 515 539 { 540 if (stat.direction.equals(dir)) 541 { 516 542 //lineout.append("" + dir.getLetter() + stat.postmile); 517 543 lineout.append(stat.getColor()); 518 544 //lineout.append(" "); 545 } 546 else 547 { 548 lineout.append("."); 549 } 519 550 } 520 551 // See if there were stations for this direction
Note: See TracChangeset
for help on using the changeset viewer.
