Changeset 92 in tmcsimulator for trunk/src/atmsdriver/model


Ignore:
Timestamp:
10/11/2017 11:46:35 AM (9 years ago)
Author:
jdalbey
Message:

Station.java: reformatted braces.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/atmsdriver/model/Station.java

    r90 r92  
    99 * 
    1010 * A Station (LDS) contains static meta data about the station, and two dynamic 
    11  * attributes, MLTotVol and OppTotVol.  * 
    12  * A single LDS contains multiple LoopDetectors, which contain data for a single 
    13  * lane on one direction of the freeway. A LDS is specific to a single freeway, 
    14  * direction, and postmile. 
     11 * attributes, MLTotVol and OppTotVol. * A single LDS contains multiple 
     12 * LoopDetectors, which contain data for a single lane on one direction of the 
     13 * freeway. A LDS is specific to a single freeway, direction, and postmile. 
    1514 * 
    1615 * @author John A. Torres 
    1716 * @version 9/10/2017 
    1817 */ 
    19 public class Station implements Comparable { 
     18public class Station implements Comparable 
     19{ 
     20 
    2021    /* Static Station meta data */ 
    21  
    2222    final private int lineNum; 
    2323    final private int ldsID; // double check 
     
    3636    public Station(int lineNum, int ldsID, int drop, 
    3737            String location, List<LoopDetector> loops, int hwy, 
    38             DIRECTION direction, double postmile) { 
     38            DIRECTION direction, double postmile) 
     39    { 
    3940        this.lineNum = lineNum; 
    4041        this.ldsID = ldsID; 
     
    5455        return this.highwayNum; 
    5556    } 
    56      
     57 
    5758    public DIRECTION getDirection() 
    5859    { 
    5960        return this.direction; 
    6061    } 
    61      
     62 
    6263    /** 
    6364     * Returns the station metadata in condensed form. This is just a quick 
     
    6768     * @return station metadata 
    6869     */ 
    69     public String getStationMeta() { 
     70    public String getStationMeta() 
     71    { 
    7072        StringBuilder build = new StringBuilder(); 
    7173        build.append(Integer.toString(this.ldsID)); 
     
    8385        build.append(this.location); 
    8486        build.append("\n"); 
    85         for (LoopDetector loop : loops) { 
     87        for (LoopDetector loop : loops) 
     88        { 
    8689            build.append(loop.getLoopMeta()); 
    8790        } 
     
    8992    } 
    9093 
    91     public double getPostmile() { 
     94    public double getPostmile() 
     95    { 
    9296        return postmile; 
    9397    } 
    9498 
    95     /** Compare this Station to another by postmile. 
    96      * Note: This might be better as a Comparator since it checks only one field. 
     99    /** 
     100     * Compare this Station to another by postmile. Note: This might be better 
     101     * as a Comparator since it checks only one field. 
    97102     */ 
    98103    @Override 
    99     public int compareTo(Object otherStation) { 
     104    public int compareTo(Object otherStation) 
     105    { 
    100106        // check for identity 
    101         if (this == otherStation) return 0; 
     107        if (this == otherStation) 
     108        { 
     109            return 0; 
     110        } 
    102111        // check that Object is of type Station, if not throw exception 
    103         if (!(otherStation instanceof Station)) { 
     112        if (!(otherStation instanceof Station)) 
     113        { 
    104114            throw new ClassCastException("A Station object expected."); 
    105115        } 
     
    111121        // set appropriate comparable return value 
    112122        int retval = 0; 
    113         if (val > 0) { 
     123        if (val > 0) 
     124        { 
    114125            retval = 1; 
    115         } else if (val < 0) { 
     126        } 
     127        else if (val < 0) 
     128        { 
    116129            retval = -1; 
    117130        } 
     
    120133    } 
    121134 
    122     private static enum XML_TAGS { 
     135    private static enum XML_TAGS 
     136    { 
    123137 
    124138        STATION("Station"), 
     
    136150        String tag; 
    137151 
    138         private XML_TAGS(String n) { 
     152        private XML_TAGS(String n) 
     153        { 
    139154            tag = n; 
    140155        } 
    141156    } 
    142157 
    143     public void toXML(Element currElem) { 
     158    public void toXML(Element currElem) 
     159    { 
    144160        Document theDoc = currElem.getOwnerDocument(); 
    145161 
     
    168184 
    169185        Element directionElement = theDoc.createElement(XML_TAGS.DIRECTION.tag); 
    170         directionElement.appendChild(theDoc.createTextNode(""+this.direction.getLetter())); 
     186        directionElement.appendChild(theDoc.createTextNode("" + this.direction.getLetter())); 
    171187        stationElement.appendChild(directionElement); 
    172188 
     
    186202        stationElement.appendChild(loopsElement); 
    187203 
    188         for (LoopDetector loop : loops) { 
     204        for (LoopDetector loop : loops) 
     205        { 
    189206            loop.toXML(loopsElement); 
    190207        } 
     
    197214     * @version 9/10/2017 
    198215     */ 
    199     public static enum DIRECTION { 
     216    public static enum DIRECTION 
     217    { 
    200218 
    201219        NORTH, 
     
    207225        private static String allLetters = "NSEW"; 
    208226 
    209         /** Return the first letter of this enum. 
    210          *  
     227        /** 
     228         * Return the first letter of this enum. 
     229         * 
    211230         * @return String first letter of this enum. 
    212231         */ 
    213232        public String getLetter() 
    214233        { 
    215             return this.toString().substring(0,1); 
    216         } 
    217          
     234            return this.toString().substring(0, 1); 
     235        } 
     236 
    218237        /** 
    219238         * Returns a direction given its first character. 
     
    227246            return values()[allLetters.indexOf(letter.charAt(0))]; 
    228247        } 
    229          
     248 
    230249    } 
    231250} 
Note: See TracChangeset for help on using the changeset viewer.