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


Ignore:
Timestamp:
10/28/2017 06:48:11 PM (9 years ago)
Author:
jtorres
Message:

Highways.java, FEPLine.java, LoopDetector?.java, Station.java: reconfigured the getHighwaysMeta() function to a toCondensedFormat(boolean MetaDataOnly?) method. By specifying MetaDataOnly? as true, you get the same output as the previous getHighwaysMeta() function. By specifying MetaDataOnly? as false, you get the new condensed format needed to send to the FEPSim over the socket. This allows us to use the same function to get a meta data dump, as well as get the highways data format needed for FEPSim socket. HighwaysParser?.cpp: removed the old tinyxml code, set up skeleton for new parser. NetworkReader?.h: deleted, and added HighwaysParser?.h. LoadSadDotsTest?.java and StationTest?.java: configured to use new toCondensedFormat method instead of getHighwaysMeta.

File:
1 edited

Legend:

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

    r184 r186  
    8888        return oppTotVol; 
    8989    } 
    90  
    91     /** 
    92      * Returns the station metadata in condensed form. This is just a quick 
    93      * script function to make a proper highway metadata configuration file, so 
    94      * that we can read the network faster. 
    95      * 
    96      * @return station metadata 
    97      */ 
    98     public String getStationMeta() 
     90     
     91    /** Returns a string of highways data. If MetaDataOnly is true, you get a full 
     92     *  dump of the highways meta data, which does not include dynamic loop values, 
     93     *  and does include the string location names. If MetaDataOnly is false, 
     94     *  dynamic loop values are included, and unnecessary information like string 
     95     *  location values are included. 
     96     *  
     97     *  The FEPSimulator takes in the toCondensedFormat() output, with a MetaDataOnly 
     98     *  value of false, over the socket. 
     99     *  
     100     *  The MetaDataOnly flag should be used to get a full dump of the highways 
     101     *  information. This was used to get the highways_fullmap.txt output. 
     102     *  
     103     * @param MetaDataOnly Whether you want meta data, or a full dump for FEPSim 
     104     * @return String, highways data in condensed format 
     105     */ 
     106    public String toCondensedFormat(boolean MetaDataOnly) 
    99107    { 
    100108        StringBuilder build = new StringBuilder(); 
     
    111119        build.append(Integer.toString(loops.size())); 
    112120        build.append(" "); 
    113         build.append(this.location); 
     121        if(MetaDataOnly) 
     122        { 
     123            build.append(this.location); 
     124        } 
    114125        build.append("\n"); 
    115126        for (LoopDetector loop : loops) 
    116127        { 
    117             build.append(loop.getLoopMeta()); 
     128            build.append(loop.toCondensedFormat(MetaDataOnly)); 
    118129        } 
    119130        return build.toString(); 
Note: See TracChangeset for help on using the changeset viewer.