Changeset 109 in tmcsimulator for trunk/src/atmsdriver
- Timestamp:
- 10/12/2017 12:23:11 PM (9 years ago)
- File:
-
- 1 edited
-
trunk/src/atmsdriver/model/Station.java (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/atmsdriver/model/Station.java
r103 r109 121 121 } 122 122 123 public void updateByDirection(DIRECTION direction, DOTCOLOR dotColor) { 123 /** Determine which lane fields to update based on given direction 124 * and update all the loop detectors with the given color. 125 * @param direction desired highway direction 126 * @param dotColor desired dot color 127 */ 128 public void updateByDirection(DIRECTION direction, DOTCOLOR dotColor) 129 { 130 String laneDir = "OPP"; 124 131 if(direction.equals(this.direction)) 125 132 { 126 updateML(dotColor); 127 } 128 else 129 { 130 updateOPP(dotColor); 131 } 132 } 133 134 private void updateML(DOTCOLOR dotcolor) 135 { 136 outputUpdateMessage(dotcolor, "ML"); 133 laneDir = "ML"; 134 } 135 outputUpdateMessage(dotColor, laneDir); 137 136 138 137 for(LoopDetector loop : loops) 139 138 { 140 if(loop.loopLocation.startsWith( "ML"))139 if(loop.loopLocation.startsWith(laneDir)) 141 140 { 142 141 // UPDATE LOOP WITH VALUES 142 // TODO: Perhaps enhance DOTCOLOR enum to include constants for 143 // vol and occ along with each color. Then the updateLoop call 144 // below could be update(dotColor.volume, dotColor.occ, speed) 145 int volume = 0; 146 int occ = 0; 147 int speed = 0; 148 loop.updateLoop(volume, occ, speed); 143 149 } 144 150 } 145 151 } 146 147 private void updateOPP(DOTCOLOR dotcolor) 148 { 149 outputUpdateMessage(dotcolor, "OPP"); 150 for(LoopDetector loop : loops) 151 { 152 if(loop.loopLocation.startsWith("OP")) 153 { 154 // UPDATE LOOP WITH VALUES 155 } 156 } 157 } 158 152 159 153 private void outputUpdateMessage(DOTCOLOR dotcolor, String OPP_ML) 160 154 {
Note: See TracChangeset
for help on using the changeset viewer.
