| 1 | package atmsdriver.network.model; |
|---|
| 2 | |
|---|
| 3 | import java.util.List; |
|---|
| 4 | |
|---|
| 5 | /** A LoopDetectorStation is a simulation of a station in a traffic network. |
|---|
| 6 | * |
|---|
| 7 | * A LoopDetectorStation (LDS) contains static meta data about the station, and |
|---|
| 8 | * two dynamic attributes, MLTotVol and OppTotVol. |
|---|
| 9 | * |
|---|
| 10 | * A single LDS contains multiple LoopDetectors, which |
|---|
| 11 | * contain data for a single lane on one direction of the freeway. A LDS |
|---|
| 12 | * is specific to a single freeway, direction, and postmile. |
|---|
| 13 | * |
|---|
| 14 | * @author John A. Torres |
|---|
| 15 | * @version 9/10/2017 |
|---|
| 16 | */ |
|---|
| 17 | public class LoopDetectorStation { |
|---|
| 18 | /* Static LoopDetectorStation meta data */ |
|---|
| 19 | final private int lineNum; |
|---|
| 20 | final private int ldsID; // double check |
|---|
| 21 | final private int drop; |
|---|
| 22 | final private String location; |
|---|
| 23 | final private List<LoopDetector> loops; |
|---|
| 24 | final private int freeway; |
|---|
| 25 | final private double postmile; |
|---|
| 26 | final private DIRECTION direction; |
|---|
| 27 | |
|---|
| 28 | /* Dynamic LoopDetectorStation data */ |
|---|
| 29 | private int MLTotVol; |
|---|
| 30 | private int OppTotVol; |
|---|
| 31 | |
|---|
| 32 | /* Constructor */ |
|---|
| 33 | public LoopDetectorStation(int lineNum, int ldsID, int drop, |
|---|
| 34 | String location, List<LoopDetector> loops, int fwy, |
|---|
| 35 | DIRECTION direction, double postmile) |
|---|
| 36 | { |
|---|
| 37 | this.lineNum = lineNum; |
|---|
| 38 | this.ldsID = ldsID; |
|---|
| 39 | this.drop = drop; |
|---|
| 40 | this.loops = loops; |
|---|
| 41 | this.location = location; |
|---|
| 42 | this.postmile = postmile; |
|---|
| 43 | this.direction = direction; |
|---|
| 44 | this.freeway = fwy; |
|---|
| 45 | |
|---|
| 46 | this.MLTotVol = 0; |
|---|
| 47 | this.OppTotVol = 0; |
|---|
| 48 | } |
|---|
| 49 | |
|---|
| 50 | /** |
|---|
| 51 | * Enum for freeway direction. |
|---|
| 52 | * |
|---|
| 53 | * @author John A. Torres |
|---|
| 54 | * @version 9/10/2017 |
|---|
| 55 | */ |
|---|
| 56 | public static enum DIRECTION |
|---|
| 57 | { |
|---|
| 58 | NORTH("N"), |
|---|
| 59 | SOUTH("S"), |
|---|
| 60 | EAST("E"), |
|---|
| 61 | WEST("W"); |
|---|
| 62 | |
|---|
| 63 | String name; |
|---|
| 64 | |
|---|
| 65 | DIRECTION(String name) |
|---|
| 66 | { |
|---|
| 67 | this.name = name; |
|---|
| 68 | } |
|---|
| 69 | |
|---|
| 70 | /** |
|---|
| 71 | * Returns the direction enum, given a string value. |
|---|
| 72 | * @param name str value for enum |
|---|
| 73 | * @return enum for given str value |
|---|
| 74 | */ |
|---|
| 75 | public static DIRECTION getEnum(String name) |
|---|
| 76 | { |
|---|
| 77 | switch(name) |
|---|
| 78 | { |
|---|
| 79 | case "S": |
|---|
| 80 | return SOUTH; |
|---|
| 81 | case "N": |
|---|
| 82 | return NORTH; |
|---|
| 83 | case "E": |
|---|
| 84 | return EAST; |
|---|
| 85 | case "W": |
|---|
| 86 | return WEST; |
|---|
| 87 | default: |
|---|
| 88 | return null; |
|---|
| 89 | } |
|---|
| 90 | } |
|---|
| 91 | } |
|---|
| 92 | } |
|---|