Changeset 212 in tmcsimulator for trunk/src/atmsdriver/model
- Timestamp:
- 11/02/2017 01:42:45 PM (9 years ago)
- Location:
- trunk/src/atmsdriver/model
- Files:
-
- 2 edited
-
Highway.java (modified) (2 diffs)
-
Highways.java (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/atmsdriver/model/Highway.java
r103 r212 2 2 3 3 import java.util.ArrayList; 4 import java.util.List; 4 5 5 6 /** … … 15 16 public final Integer routeNumber; 16 17 /** The ordered list of stations (lane detector stations) on this highway */ 17 public final ArrayList<Station> stations;18 public final List<Station> stations; 18 19 19 20 /** Construct a highway -
trunk/src/atmsdriver/model/Highways.java
r203 r212 12 12 import java.util.Collections; 13 13 import java.util.HashMap; 14 import java.util.List; 14 15 import java.util.Map; 15 16 import java.util.Scanner; … … 52 53 final private int FEPPortNum; 53 54 54 final private ArrayList<FEPLine> lines;55 final public ArrayList<Highway> highways;55 final private List<FEPLine> lines; 56 final public List<Highway> highways; 56 57 57 58 public Highways(String highwaysMapFileName, String FEPHostName, int FEPPortNum) … … 227 228 String line = sc.nextLine(); 228 229 Scanner scline = new Scanner(line); 229 // Get the attribute of this FEP Line230 // Get the attributes of this FEP Line 230 231 int lineNum = scline.nextInt(); 231 232 int count = scline.nextInt(); 232 233 int numStations = scline.nextInt(); 234 235 // initialze stations array 233 236 ArrayList<Station> stations = new ArrayList<>(); 234 237 // Read all the stations for thie FEP Line … … 251 254 String line = sc.nextLine(); 252 255 Scanner scline = new Scanner(line); 256 253 257 int ldsID = scline.nextInt(); 254 258 int drop = scline.nextInt(); … … 371 375 * Example toCondensedFormat(MetaDataOnly = false) output: 372 376 * 373 * 43 // "number of lines"374 * 32 0 13 // "line id" "count num" "number of stations"375 * 1210831 1 5 S 0.9 8 // "station id" "drop num" "route num"...376 * // ..."direction" "postmile" "number of loops"377 * 1210832 0.0 0 // "loop id" "occ" "vol"378 * 1210833 0.0 0 // ..379 * 1210834 0.0 0 // ..380 * 1210835 0.0 0 // ..381 * 1210836 0.0 0 // ..382 * 1210837 0.0 0 // ..383 * 1210838 0.0 0 // ..384 * 1210839 0.0 0 // ..377 * 43 // "number of lines" 378 * 32 0 13 // "line id" "count num" "number of stations" 379 * 1210831 1 5 S 0.9 8 // "station id" "drop num" "route num"... 380 * // ..."direction" "postmile" "number of loops" 381 * 1210832 0.0 0 ML_1 // "loop id" "occ" "vol" 382 * 1210833 0.0 0 ML_2 // .. 383 * 1210834 0.0 0 ML_3 // .. 384 * 1210835 0.0 0 ML_4 // .. 385 * 1210836 0.0 0 PASSAGE // .. 386 * 1210837 0.0 0 DEMAND // .. 387 * 1210838 0.0 0 QUEUE // .. 388 * 1210839 0.0 0 RAMP_OFF // .. 385 389 * ... 386 390 * … … 404 408 public String toCondensedFormat(boolean MetaDataOnly) 405 409 { 410 // first line: number of FEPLines 406 411 StringBuilder build = new StringBuilder(); 407 412 build.append(lines.size()); 408 413 build.append("\n"); 414 // append each fep line to the string 409 415 for(FEPLine line : lines) 410 416 { 411 417 build.append(line.toCondensedFormat(MetaDataOnly)); 412 418 } 419 // return the full condensed format string 413 420 return build.toString(); 414 421 } … … 458 465 * 459 466 * @param routeNum 460 * @return Highway with specified route number 467 * @return Highway with specified route number, or null if no highway with 468 * the specified route num 461 469 */ 462 470 public Highway getHighwayByRouteNumber(Integer routeNum) 463 471 { 464 472 Highway returnHwy = null; 473 // search through highways and check routeNums 465 474 for (Highway hwy : highways) 466 475 {
Note: See TracChangeset
for help on using the changeset viewer.
