Changeset 343 in tmcsimulator for trunk/src/atmsdriver/model/Station.java
- Timestamp:
- 03/23/2019 05:40:52 PM (7 years ago)
- File:
-
- 1 edited
-
trunk/src/atmsdriver/model/Station.java (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/atmsdriver/model/Station.java
r285 r343 8 8 9 9 /** 10 * A Station ( LDS or LoopDetector Station) represents a group of lane detectors11 * across all lanes at a particular point on a highway. A station is identified10 * A Station (VDS or Vehicle Detector Station) represents a group of lane detectors 11 * across all lanes in one direction at a particular point on a highway. A station is identified 12 12 * by its highway number and postmile. A station has an associated direction 13 13 * used to establish which direction is Main and which is Opposite. The MLTotVol 14 14 * and OppTotVol for a station can be dynamically updated. A station has other 15 * attributes: lineNum, ldsID, drop, and location which are used by the FEP. A15 * attributes: lineNum, vdsID, drop, and location which are used by the FEP. A 16 16 * station can be compared to other stations by its postmile. 17 17 * 18 * @author John A. Torres 19 * @version 9/10/2017 18 * @author John A. Torres, jdalbey 19 * @version 9/10/2017, 3/22/2019 20 20 */ 21 public class Station implements Comparable21 public final class Station implements Comparable 22 22 { 23 23 24 24 /* Static Station meta data */ 25 25 final public int lineID; 26 final public int ldsID; // double check26 final public int vdsID; // double check 27 27 final public int drop; 28 28 final public String location; … … 37 37 38 38 /* Constructor */ 39 public Station(int lineID, int ldsID, int drop,39 public Station(int lineID, int vdsID, int drop, 40 40 String location, List<LoopDetector> loops, int hwy, 41 41 DIRECTION direction, double postmile) 42 42 { 43 43 this.lineID = lineID; 44 this. ldsID = ldsID;44 this.vdsID = vdsID; 45 45 this.drop = drop; 46 46 this.loops = loops; … … 109 109 { 110 110 StringBuilder build = new StringBuilder(); 111 build.append(Integer.toString(this. ldsID));111 build.append(Integer.toString(this.vdsID)); 112 112 build.append(" "); 113 113 build.append(Integer.toString(this.drop)); … … 170 170 171 171 /** 172 * See if this station matches the specified attributes. 173 * @param dir 174 * @param postmile 175 * @return true if this station's attributes match the given ones. 176 */ 177 public boolean matches(DIRECTION dir, double postmile) 178 { 179 double val = this.postmile - postmile; 180 return (Math.abs(val) < 0.01) && this.direction.equals(dir); 181 } 182 /** 172 183 * Determine which lane fields to update based on given direction and update 173 184 * all the loop detectors with the given color. … … 178 189 public void updateByDirection(DIRECTION direction, DOTCOLOR dotColor) 179 190 { 180 String laneDir = "OS";191 // Is this station going in the desired direction? 181 192 if (direction.equals(this.direction)) 182 193 { 183 laneDir = "ML"; 184 } 185 outputUpdateMessage(dotColor, laneDir); 186 187 for (LoopDetector loop : loops) 188 { 189 // THIS DECISION ISN'T NEEDED after JD's BuildHighwayFile pgm 190 // creates a highway map based on VDS instead of Controller (LDS). 191 // if (loop.loopLocation.startsWith(laneDir)) 192 // { 193 // UPDATE LOOP WITH VALUES 194 loop.updateLoop(dotColor.volume(), dotColor.occupancy()); 195 // } 196 } 197 198 this.MLTotVol = getMLTotVol(); 199 this.OppTotVol = getOPPTotVol(); 200 } 201 194 outputUpdateMessage(dotColor, direction.toString()); 195 196 for (LoopDetector loop : loops) 197 { 198 // THIS DECISION ISN'T NEEDED after JD's BuildHighwayFile pgm 199 // creates a highway map based on VDS instead of Controller (LDS). 200 // if (loop.loopLocation.startsWith(laneDir)) 201 // { 202 // UPDATE LOOP WITH VALUES 203 loop.updateLoop(dotColor.volume(), dotColor.occupancy()); 204 // } 205 } 206 207 this.MLTotVol = getMLTotVol(); 208 this.OppTotVol = getOPPTotVol(); 209 } 210 } 202 211 /** 203 212 * Return the color for the lanes in a given direction. … … 316 325 317 326 Element ldsIDElement = theDoc.createElement(XML_TAGS.LDS_ID.tag); 318 ldsIDElement.appendChild(theDoc.createTextNode(String.valueOf(this. ldsID)));327 ldsIDElement.appendChild(theDoc.createTextNode(String.valueOf(this.vdsID))); 319 328 stationElement.appendChild(ldsIDElement); 320 329 … … 422 431 public String toString() 423 432 { 424 return Integer.toString(this. ldsID);433 return Integer.toString(this.vdsID)+this.getColor(); 425 434 } 426 435 }
Note: See TracChangeset
for help on using the changeset viewer.
