Changeset 127 in tmcsimulator


Ignore:
Timestamp:
10/16/2017 04:38:16 PM (9 years ago)
Author:
jdalbey
Message:

Station.java Enhance DOTCOLOR enum to have volume and occupancy fields. Minor changes to error messages in other files.

Location:
trunk/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/atmsdriver/ConsoleDriver.java

    r121 r127  
    409409     
    410410    /** 
    411      * Enum for highway status dot colors. 
     411     * Enum for highway status dot colors. Each color has associated volume 
     412     * and occupancy constants. 
    412413     * 
    413      * @author John A. Torres 
     414     * @author John A. Torres, jdalbey 
    414415     * @version 10/11/2017 
    415416     */ 
    416417    public static enum DOTCOLOR { 
    417418 
    418         RED, 
    419         YELLOW, 
    420         GREEN; 
     419        RED(10,10), 
     420        YELLOW(5,5), 
     421        GREEN(0,0); 
    421422         
    422423        // All the first letters of the values, in order. 
    423424        private static String allLetters = "RYG"; 
    424425         
     426        private int vol;  /* volume */ 
     427        private int occ;  /* occupancy */       
     428         
     429        private DOTCOLOR(int v, int o) 
     430        { 
     431            vol = v; 
     432            occ = o; 
     433        } 
    425434        /** 
    426435         * Return the first letter of this enum. 
     
    432441        } 
    433442 
     443        public int volume() 
     444        { 
     445            return vol; 
     446        } 
     447        public int occupancy() 
     448        { 
     449            return occ; 
     450        } 
    434451        /** 
    435452         * Returns a dot color given its first character. 
  • trunk/src/atmsdriver/model/Highways.java

    r118 r127  
    211211    public void writeToFEP() { 
    212212        try { 
    213             Socket sock = new Socket(/*FEPHostName*/ "192.168.251.130", 8080); 
     213            Socket sock = new Socket(FEPHostName /*"192.168.251.130"*/, 8080); 
    214214            PrintWriter out = new PrintWriter(sock.getOutputStream(), true); 
    215215            out.println(this.toXML()); 
     
    217217        } catch (IOException ex) { 
    218218            Logger.getLogger(Highways.class.getName()).log(Level.SEVERE, null, ex); 
     219            System.out.println("Highway Model failed writing to FEPSim."); 
    219220        } 
    220221    } 
  • trunk/src/atmsdriver/model/Station.java

    r114 r127  
    166166            { 
    167167                // UPDATE LOOP WITH VALUES 
    168                 // TODO: Perhaps enhance DOTCOLOR enum to include constants for 
    169                 // vol and occ along with each color.  Then the updateLoop call 
    170                 // below could be update(dotColor.volume, dotColor.occ, speed) 
    171                 int volume = 10; 
    172                 int occ = 10; 
    173168                int speed = 0; 
    174                 loop.updateLoop(volume, occ, speed); 
     169                loop.updateLoop(dotColor.volume(), dotColor.occupancy(), speed); 
    175170            } 
    176171        } 
  • trunk/src/tmcsim/application.properties

    r124 r127  
    1 #Sun, 15 Oct 2017 17:38:51 -0700 
     1#Mon, 16 Oct 2017 17:41:29 -0700 
    22 
    3 Application.revision=123 
     3Application.revision=125 
    44 
    55Application.buildnumber=53 
  • trunk/src/tmcsim/client/ATMSBatchDriver.java

    r121 r127  
    6060    public void refresh() throws RemoteException 
    6161    { 
    62         throw new UnsupportedOperationException("Not supported yet."); 
     62        System.out.println("ATMSBatchDriver.refresh() was invoked."); 
    6363    } 
    6464 
     
    214214        timer.start(); 
    215215 
    216         // Start the FEP thread (to update ATMS every 30 sec) 
     216        // Start the FEP thread (to update ATMS every 30 sec). (See class def below) 
    217217        new WriteToFEPThread().run(); 
    218218 
Note: See TracChangeset for help on using the changeset viewer.