Changeset 103 in tmcsimulator for trunk/src/atmsdriver/ATMSDriver.java


Ignore:
Timestamp:
10/12/2017 12:28:28 AM (9 years ago)
Author:
jtorres
Message:

trunk/src/atmsdriver/ConsoleDriver.java: Created console driver for ATMSDriver, completed and very nice. Still need to apply correct vol/occ values to actually change the colors. Still need to write a JUnit test for it. trunk/src/atmsdriver/ATMSDriver.java: Refactored to run the console driver. ATMSDriver runs in thread, console driver runs, and they share the highways instance. Renamed NetworkLoader?.java to FEPLineLoader.java. trunk/src/atmsdriver/model/Highways.java: refactored loadHighways() method to conform to new undirected highway abstraction. trunk/src/atmsdriver/model/Station.java: added updateByDirection(DIRECTION dir) method and supporting utility methods. trunk/test/atmsdriver/model/LoadHighwaysTest.java: Conformed LoadHighways? test to new undirected highway abstraction. trunk/test/atmsdriver/model/StationTest.java: Conformed StationTest?.java to new changes - very minor stuff. Went through all model classes and changed any final privates with a getter method to final public, for good OOP practice and simplicity. Went through ALL FILES and commented everything very well. minor application custom configuration changes. Removed all .class or .o.d files from svn repository

File:
1 edited

Legend:

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

    r88 r103  
    22 
    33import atmsdriver.model.Highways; 
    4 import java.io.File; 
    54import java.io.FileInputStream; 
    6 import java.io.FileNotFoundException; 
    7 import java.io.PrintWriter; 
    85import java.util.Properties; 
    96import java.util.logging.Level; 
     
    2522     */ 
    2623    private static Logger ATMSDriverLogger = Logger.getLogger("atmsdriver"); 
    27  
    28     private static final String CONFIG_FILE_NAME = "atms_driver_config.properties"; 
    2924 
    3025    /** 
     
    9590 
    9691    public ATMSDriver(String propertiesFile) { 
    97  
     92        // verify properties file 
    9893        if (!verifyProperties(propertiesFile)) { 
    9994            System.exit(0); 
    10095        } 
    101  
     96        // create the highways model 
    10297        highways = new Highways( 
    10398                ATMSDriverProperties.getProperty( 
     
    110105                Integer.parseInt(ATMSDriverProperties.getProperty( 
    111106                                PROPERTIES.FEP_WRITER_PORT.name))); 
    112          
     107        // create the exchange reader 
    113108        exchangeReader = new ExchangeReader(); 
    114109    } 
    115  
     110     
     111    /** 
     112     * Verifies that the properties file has all necessary properties. 
     113     *  
     114     * @param propertiesFile 
     115     * @return  
     116     */ 
    116117    private boolean verifyProperties(String propertiesFile) { 
    117118        // Load the properties file. 
     
    133134        try { 
    134135            if (System.getProperty("ATMSDRIVER_PROPERTIES") != null) { 
    135                 new Thread(new ATMSDriver(System.getProperty( 
    136                         "ATMSDRIVER_PROPERTIES"))).start(); 
     136                // Create and run the ATMSDriver thread 
     137                ATMSDriver atmsDriver = new ATMSDriver(System.getProperty("ATMSDRIVER_PROPERTIES")); 
     138                Thread ATMSDriverThread = new Thread(atmsDriver); 
     139                ATMSDriverThread.start(); 
     140                 
     141                // run the console driver, pass it the atmsDriver highways model 
     142                ConsoleDriver driver = new ConsoleDriver(atmsDriver.highways); 
     143                 
    137144            } else { 
    138145                throw new Exception("ATMSDRIVER_PROPERTIES system property not defined."); 
Note: See TracChangeset for help on using the changeset viewer.