Changeset 103 in tmcsimulator for trunk/src/atmsdriver/model/Station.java
- Timestamp:
- 10/12/2017 12:28:28 AM (9 years ago)
- File:
-
- 1 edited
-
trunk/src/atmsdriver/model/Station.java (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/atmsdriver/model/Station.java
r94 r103 1 1 package atmsdriver.model; 2 2 3 import atmsdriver.ConsoleDriver; 4 import atmsdriver.ConsoleDriver.DOTCOLOR; 3 5 import java.util.List; 4 6 import org.w3c.dom.Document; … … 21 23 22 24 /* Static Station meta data */ 23 final p rivateint lineNum;24 final p rivateint ldsID; // double check25 final p rivateint drop;26 final p rivateString location;27 final p rivateList<LoopDetector> loops;28 final p rivate int highwayNum;29 final p rivatedouble postmile;30 final p rivateDIRECTION direction;25 final public int lineNum; 26 final public int ldsID; // double check 27 final public int drop; 28 final public String location; 29 final public List<LoopDetector> loops; 30 final public int routeNumber; 31 final public double postmile; 32 final public DIRECTION direction; 31 33 32 34 /* Dynamic Station data */ … … 46 48 this.postmile = postmile; 47 49 this.direction = direction; 48 this. highwayNum= hwy;50 this.routeNumber = hwy; 49 51 50 52 this.MLTotVol = 0; 51 53 this.OppTotVol = 0; 52 }53 54 public int getHighwayNumber()55 {56 return this.highwayNum;57 }58 59 public DIRECTION getDirection()60 {61 return this.direction;62 54 } 63 55 … … 76 68 build.append(Integer.toString(this.drop)); 77 69 build.append(" "); 78 build.append(Integer.toString(this. highwayNum));70 build.append(Integer.toString(this.routeNumber)); 79 71 build.append(" "); 80 72 build.append(this.direction.getLetter()); … … 91 83 } 92 84 return build.toString(); 93 }94 95 public double getPostmile()96 {97 return postmile;98 85 } 99 86 … … 117 104 118 105 // get difference of values 119 double otherStationPostmile = ((Station) otherStation). getPostmile();106 double otherStationPostmile = ((Station) otherStation).postmile; 120 107 double val = this.postmile - otherStationPostmile; 121 108 … … 134 121 } 135 122 123 public void updateByDirection(DIRECTION direction, DOTCOLOR dotColor) { 124 if(direction.equals(this.direction)) 125 { 126 updateML(dotColor); 127 } 128 else 129 { 130 updateOPP(dotColor); 131 } 132 } 133 134 private void updateML(DOTCOLOR dotcolor) 135 { 136 outputUpdateMessage(dotcolor, "ML"); 137 138 for(LoopDetector loop : loops) 139 { 140 if(loop.loopLocation.startsWith("ML")) 141 { 142 // UPDATE LOOP WITH VALUES 143 } 144 } 145 } 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 159 private void outputUpdateMessage(DOTCOLOR dotcolor, String OPP_ML) 160 { 161 System.out.printf("Updating route %-3.3s %-5.5s %-3.3s lanes\t %-12.12s " 162 + "at postmile %-6.6s to %-7.7s\n", 163 Integer.toString(this.routeNumber), this.direction.name(), 164 OPP_ML, this.location, Double.toString(this.postmile), 165 dotcolor.name()); 166 } 167 136 168 private static enum XML_TAGS 137 169 { … … 189 221 190 222 Element freewayElement = theDoc.createElement(XML_TAGS.FREEWAY.tag); 191 freewayElement.appendChild(theDoc.createTextNode(String.valueOf(this. highwayNum)));223 freewayElement.appendChild(theDoc.createTextNode(String.valueOf(this.routeNumber))); 192 224 stationElement.appendChild(freewayElement); 193 225
Note: See TracChangeset
for help on using the changeset viewer.
