Changeset 152 in tmcsimulator for trunk/src


Ignore:
Timestamp:
10/20/2017 09:18:44 AM (9 years ago)
Author:
jdalbey
Message:

Coordinator.java: new method getATMStime added for use by ATMSBatchDriver.

Location:
trunk/src/tmcsim
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/tmcsim/cadsimulator/Coordinator.java

    r123 r152  
    2222import tmcsim.cadmodels.IncidentInquiryUnitsAssigned; 
    2323import tmcsim.cadmodels.IncidentSummaryModel_obj; 
     24import static tmcsim.cadsimulator.CADServer.theATMSMgr; 
    2425import tmcsim.cadsimulator.db.CMSDiversionDB; 
    2526import tmcsim.cadsimulator.managers.ATMSManager; 
     
    221222        } 
    222223    } 
     224    /** Convenience method for clients to get ATMS time. 
     225     *  
     226     * @return current ATMS time in milliseconds. 
     227     * @author jdalbey 
     228     * @version 19 Oct 2017 
     229     */ 
     230    public long getATMStime() 
     231    { 
     232        try 
     233        { 
     234            return CADServer.theATMSMgr.getCurrentTime(); 
     235        } 
     236        catch (Exception ex) 
     237        { 
     238            Logger.getLogger(Coordinator.class.getName()).log(Level.SEVERE, null, ex); 
     239            System.out.println("Exception getting ATMS time, using zero."); 
     240            return 0; 
     241        } 
     242    } 
    223243 
    224244    public void pauseSimulation() throws RemoteException 
  • trunk/src/tmcsim/client/ATMSBatchDriver.java

    r140 r152  
    3232import javax.swing.Timer; 
    3333import javax.swing.UIManager; 
     34import tmcsim.cadsimulator.CADServer; 
    3435import tmcsim.common.SimulationException; 
    3536import tmcsim.interfaces.CADClientInterface; 
     
    158159        theView = new ATMSBatchViewer(this, new ArrayList<String>(incidents.keySet())); 
    159160        theView.setVisible(true); 
    160         theView.update("0:00", eventQueue); 
     161        theView.update("0:00", "1:11", eventQueue); 
    161162 
    162163        // Create a timer that fetches the simulation time every second. 
     
    167168            { 
    168169                String currentClock = ""; 
     170                String currentATMStime = ""; 
    169171                Date simClock = new Date();                 
    170172                // Obtain the simulation time from the CAD server 
     
    173175                    long simtime = theCoorInt.getCurrentSimulationTime(); 
    174176                    currentClock = formatInterval(simtime); 
     177                    long ATMStime = theCoorInt.getATMStime();        
     178                    Date atmsdate = new Date(ATMStime); 
     179                    currentATMStime = formatter.format(atmsdate); 
    175180                    try { 
    176181                        simClock = formatter.parse(currentClock); 
     
    231236                        } 
    232237                    } 
    233                     theView.update(currentClock, eventQueue); 
     238                     
     239                    theView.update(currentClock, currentATMStime, eventQueue); 
    234240                } 
    235241            } 
     
    322328        } 
    323329        // Now refresh the view with the updated queue of events 
    324         theView.update("0:00", eventQueue); 
     330        theView.update("0:00", "0:00", eventQueue); 
    325331    } 
    326332     
  • trunk/src/tmcsim/client/ATMSBatchViewer.form

    r135 r152  
    5858              </Group> 
    5959              <Group type="102" alignment="0" attributes="0"> 
    60                   <EmptySpace min="-2" pref="186" max="-2" attributes="0"/> 
    61                   <Component id="txtClockTime" min="-2" pref="65" max="-2" attributes="0"/> 
     60                  <EmptySpace min="-2" pref="112" max="-2" attributes="0"/> 
     61                  <Component id="txtClockTime" min="-2" pref="225" max="-2" attributes="0"/> 
    6262                  <EmptySpace max="32767" attributes="0"/> 
    6363              </Group> 
  • trunk/src/tmcsim/client/ATMSBatchViewer.java

    r135 r152  
    1313import javax.swing.JList; 
    1414import javax.swing.JOptionPane; 
     15import tmcsim.cadsimulator.CADServer; 
    1516 
    1617/** 
     
    3940    } 
    4041 
    41     public void update(String currentTime, Queue<String> events) 
     42    public void update(String currentTime, String atmsTime, Queue<String> events) 
    4243    { 
    4344        lstEvents.setModel(new MyListModel(events)); 
    44         txtClockTime.setText(currentTime); 
     45        txtClockTime.setText(currentTime + " / " +atmsTime); 
    4546    } 
    4647    class MyListModel extends AbstractListModel<String> 
     
    9697                .addGap(59, 59, 59)) 
    9798            .addGroup(pnlEventsLayout.createSequentialGroup() 
    98                 .addGap(186, 186, 186) 
    99                 .addComponent(txtClockTime, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE) 
     99                .addGap(112, 112, 112) 
     100                .addComponent(txtClockTime, javax.swing.GroupLayout.PREFERRED_SIZE, 225, javax.swing.GroupLayout.PREFERRED_SIZE) 
    100101                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) 
    101102        ); 
     
    229230                ATMSBatchViewer view = new ATMSBatchViewer(null,items); 
    230231                view.setVisible(true); 
    231                 view.update("01", sample); 
     232                view.update("01", "02", sample); 
    232233                 
    233234            } 
  • trunk/src/tmcsim/interfaces/CADInterface.java

    r2 r152  
    310310     */ 
    311311    public LinkedList<CardfileDataObject> getSearchList(String search) throws RemoteException; 
     312 
     313    /** Convenience method for clients to get current ATMS time. 
     314     *  
     315     * @return current ATMS time in milliseconds. 
     316     */ 
     317    public long getATMStime() throws RemoteException; 
    312318} 
    313319 
Note: See TracChangeset for help on using the changeset viewer.