Changeset 422 in tmcsimulator for trunk/src/tmcsim/highwaymodel/LoopDetector.java
- Timestamp:
- 06/23/2019 10:27:35 AM (7 years ago)
- Location:
- trunk/src/tmcsim/highwaymodel
- Files:
-
- 1 added
- 1 copied
-
. (added)
-
LoopDetector.java (copied) (copied from trunk/src/atmsdriver/model/LoopDetector.java) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/tmcsim/highwaymodel/LoopDetector.java
r343 r422 1 package atmsdriver.model;1 package tmcsim.highwaymodel; 2 2 3 3 import java.util.ArrayList; … … 12 12 * occ, and spd. 13 13 * 14 * Lane Type A string indicating the type of lane. Possible values (and their meaning) are: 15 * 16 * CD (Coll/Dist) 17 * CH (Conventional Highway) 18 * FF (Fwy-Fwy connector) 19 * FR (Off Ramp) 20 * HV (HOV) 21 * ML (Mainline) 22 * OR (On Ramp) 14 23 * @author John A. Torres 15 24 * @version 09/10/2017 … … 28 37 /** 29 38 * Constructs a LoopDetector from loopID, loopLocation, and laneNum 39 * with initially free flowing traffic. 30 40 * 31 41 * @param loopID … … 44 54 } 45 55 56 /** 57 * Setter for loop detector dynamic attributes. Reserved for future use 58 * with "live" highway data. 59 * @param vol volume 60 * @param occ occupancy 61 * @param spd speed not used 62 */ 63 public void setAttributes(int vol, float occ) 64 { 65 this.vol = vol; 66 this.occ = occ; 67 } 68 /** Set the attributes of this detector given a color. 69 * @param DOTCOLOR of the attributes to assign. 70 */ 71 public void setAttributes(DOTCOLOR color) 72 { 73 this.vol = color.volume(); 74 this.occ = color.occupancy(); 75 } 46 76 /** 47 77 * XML tags used for toXML() method. … … 100 130 return build.toString(); 101 131 } 102 103 /**104 * Updates loop detector dynamic attributes.105 * @param vol volume106 * @param occ occupancy107 * @param spd speed108 */109 public void updateLoop(int vol, float occ)110 {111 this.vol = vol;112 this.occ = occ;113 }114 132 115 133 /** … … 144 162 /** 145 163 * Enum for highway status dot colors. Each color has associated volume 146 * and occupancy constants .164 * and occupancy constants, single character symbol, and hml color name. 147 165 * 148 166 * @author John A. Torres, jdalbey … … 151 169 public static enum DOTCOLOR { 152 170 153 RED(1, 0.06f ), // "Stopped" is less than 25mph154 YELLOW(3,0.059f ), // speed = 26155 GREEN(0,0 );171 RED(1, 0.06f,'@',"red"), // "Stopped" is less than 25mph 172 YELLOW(3,0.059f,'+',"yellow"), // speed = 26 173 GREEN(0,0,'-',"lime"); // freeflowing 156 174 157 175 // All the first letters of the values, in order. … … 160 178 private int vol; /* volume */ 161 179 private float occ; /* occupancy */ 162 163 private DOTCOLOR(int v, float o) 180 private char symbol; /* symbolic representation of this color */ 181 private String htmlColor; /* html color name */ 182 183 184 private DOTCOLOR(int v, float o, char symbol, String htmlColor) 164 185 { 165 186 vol = v; 166 187 occ = o; 188 this.symbol = symbol; 189 this.htmlColor = htmlColor; 167 190 } 168 191 /** … … 183 206 return occ; 184 207 } 208 public char symbol() 209 { 210 return symbol; 211 } 212 public String htmlColor() 213 { 214 return htmlColor; 215 } 185 216 /** 186 * Returns a dot colorgiven its first character.217 * Returns a DOTCOLOR given its first character. 187 218 * 188 * @param letter the first character of a dot color189 * @return dot colorcorresponding to letter219 * @param letter the first character of a DOTCOLOR 220 * @return DOTCOLOR corresponding to letter 190 221 * @pre letter must be one of allLetters 191 222 */
Note: See TracChangeset
for help on using the changeset viewer.
