Changeset 285 in tmcsimulator for trunk/src/atmsdriver/model/Station.java


Ignore:
Timestamp:
02/28/2019 10:21:36 AM (7 years ago)
Author:
jdalbey
Message:

Station.java: Add getColorName method, comment out dead code.

File:
1 edited

Legend:

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

    r278 r285  
    202202    /** 
    203203     * Return the color for the lanes in a given direction. 
    204      * 
    205      * @param direction 
    206      * @return character representing color of lanes in given direction '@' = 
    207      * red, '+' = yellow, '-' = green 
    208      */ 
    209     public char getColorByDirection(DIRECTION direction) 
     204     * @return character representing color of this station's traffic flow 
     205     * '@' = red, '+' = yellow, '-' = green 
     206     */ 
     207    public char getColor() 
    210208    { 
    211209        /* For now just use the color of the first lane.  
     
    213211 
    214212        String laneDir = ""; 
    215         if (direction.equals(this.direction)) 
    216         { 
    217             laneDir = "ML"; 
    218         } 
    219         else if (direction.equals(this.direction.getOpposite())) 
    220         { 
    221             laneDir = "OS"; 
    222         } 
     213         
     214            // THIS DECISION ISN'T NEEDED after JD's BuildHighwayFile pgm 
     215            // creates a highway map based on VDS instead of Controller (LDS). 
     216//        if (direction.equals(this.direction)) 
     217//        { 
     218//            laneDir = "ML"; 
     219//        } 
     220//        else if (direction.equals(this.direction.getOpposite())) 
     221//        { 
     222//            laneDir = "OS"; 
     223//        } 
    223224        // Search lanes to find specified direction 
    224225        for (LoopDetector loop : loops) 
     
    245246        // Default case for when the route is not on this direction 
    246247        return ' '; 
    247  
    248     } 
    249  
     248    } 
     249    /** 
     250     * Return the color name for the traffic volume of this station. 
     251     */ 
     252    public String getColorName() 
     253    { 
     254        String colorName = ""; 
     255        switch (this.getColor()) 
     256        { 
     257            case '@': colorName = "red";break; 
     258            case '+': colorName = "yellow"; break; 
     259            case '-': colorName = "lime";break; 
     260            case ' ': colorName = "lime";break; 
     261        } 
     262        return colorName; 
     263    } 
    250264    /** 
    251265     * Output for updateByDirection. Logs the update to the console. 
Note: See TracChangeset for help on using the changeset viewer.