Changeset 186 in tmcsimulator for trunk


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.

Location:
trunk
Files:
8 edited

Legend:

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

    r184 r186  
    116116                Integer.parseInt(ATMSDriverProperties.getProperty( 
    117117                                PROPERTIES.FEP_WRITER_PORT.name))); 
     118        System.out.println(highways.toCondensedFormat(false)); 
    118119        // create the exchange reader 
    119120        exchangeReader = new ExchangeReader(); 
  • trunk/src/atmsdriver/model/FEPLine.java

    r184 r186  
    3737    } 
    3838     
    39     /** 
    40      * Returns the FEPLine meta data in string format 
    41      * @return FEPLine metadata 
     39    /** Returns a string of highways data. If MetaDataOnly is true, you get a full 
     40     *  dump of the highways meta data, which does not include dynamic loop values, 
     41     *  and does include the string location names. If MetaDataOnly is false, 
     42     *  dynamic loop values are included, and unnecessary information like string 
     43     *  location values are included. 
     44     *  
     45     *  The FEPSimulator takes in the toCondensedFormat() output, with a MetaDataOnly 
     46     *  value of false, over the socket. 
     47     *  
     48     *  The MetaDataOnly flag should be used to get a full dump of the highways 
     49     *  information. This was used to get the highways_fullmap.txt output. 
     50     *  
     51     * @param MetaDataOnly Whether you want meta data, or a full dump for FEPSim 
     52     * @return String, highways data in condensed format 
    4253     */ 
    43     public String getLineMeta() 
     54    public String toCondensedFormat(boolean MetaDataOnly) 
    4455    { 
    4556        StringBuilder build = new StringBuilder(); 
     
    5061        build.append(Integer.toString(this.stations.size())); 
    5162        build.append("\n"); 
    52         for (Station station : stations) 
     63        for(Station station : stations) 
    5364        { 
    54             build.append(station.getStationMeta()); 
     65            build.append(station.toCondensedFormat(MetaDataOnly)); 
    5566        } 
    5667        return build.toString(); 
  • trunk/src/atmsdriver/model/Highways.java

    r184 r186  
    354354        } 
    355355    } 
    356  
    357     /** 
    358      * Returns the highways metadata in condensed form. This function took the  
    359      * highways model and wrote it into condensed form. It is also useful for 
    360      * testing. 
    361      * 
    362      * @return the highways meta data string 
    363      */ 
    364     public String getHighwaysMeta() 
    365     { 
    366             StringBuilder build = new StringBuilder(); 
    367             build.append(lines.size()); 
    368             build.append("\n"); 
    369             for (FEPLine line : lines) 
    370             { 
    371                 build.append(line.getLineMeta()); 
    372             } 
    373             return build.toString(); 
    374     } 
    375  
     356     
     357    /** Returns a string of highways data. If MetaDataOnly is true, you get a full 
     358     *  dump of the highways meta data, which does not include dynamic loop values, 
     359     *  and does include the string location names. If MetaDataOnly is false, 
     360     *  dynamic loop values are included, and unnecessary information like string 
     361     *  location values are included. 
     362     *  
     363     *  The FEPSimulator takes in the toCondensedFormat() output, with a MetaDataOnly 
     364     *  value of false, over the socket. 
     365     *  
     366     *  The MetaDataOnly flag should be used to get a full dump of the highways 
     367     *  information. This was used to get the highways_fullmap.txt output. 
     368     *  
     369     * @param MetaDataOnly Whether you want meta data, or a full dump for FEPSim 
     370     * @return String, highways data in condensed format 
     371     */ 
     372    public String toCondensedFormat(boolean MetaDataOnly) 
     373    { 
     374        StringBuilder build = new StringBuilder(); 
     375        build.append(lines.size()); 
     376        build.append("\n"); 
     377        for(FEPLine line : lines) 
     378        { 
     379            build.append(line.toCondensedFormat(MetaDataOnly)); 
     380        } 
     381        return build.toString(); 
     382    } 
     383     
    376384    /** 
    377385     * Returns the Highways model data in XML format. 
  • trunk/src/atmsdriver/model/LoopDetector.java

    r184 r186  
    6868    } 
    6969     
    70     /** 
    71      * Returns the loop metadata in condensed form. 
    72      * This is just a quick script function to make a proper highway 
    73      * metadata configuration file, so that we can read the network 
    74      * faster. 
    75      *  
    76      * @return loop metadata 
    77      */ 
    78     public String getLoopMeta() 
     70    /** Returns a string of highways data. If MetaDataOnly is true, you get a full 
     71     *  dump of the highways meta data, which does not include dynamic loop values, 
     72     *  and does include the string location names. If MetaDataOnly is false, 
     73     *  dynamic loop values are included, and unnecessary information like string 
     74     *  location values are included. 
     75     *  
     76     *  The FEPSimulator takes in the toCondensedFormat() output, with a MetaDataOnly 
     77     *  value of false, over the socket. 
     78     *  
     79     *  The MetaDataOnly flag should be used to get a full dump of the highways 
     80     *  information. This was used to get the highways_fullmap.txt output. 
     81     *  
     82     * @param MetaDataOnly Whether you want meta data, or a full dump for FEPSim 
     83     * @return String, highways data in condensed format 
     84     */ 
     85    public String toCondensedFormat(boolean MetaDataOnly) 
    7986    { 
    8087        StringBuilder build = new StringBuilder(); 
     
    8390        build.append(Integer.toString(this.laneNum)); 
    8491        build.append(" "); 
    85         build.append(this.loopLocation); 
     92        if(!MetaDataOnly) 
     93        { 
     94            build.append(" "); 
     95            build.append(this.occ); 
     96            build.append(" "); 
     97            build.append(this.vol); 
     98            build.append(" "); 
     99            build.append(this.spd); 
     100        } 
     101        else 
     102        { 
     103            build.append(this.loopLocation); 
     104        } 
    86105        build.append("\n"); 
    87106        return build.toString(); 
  • 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(); 
  • trunk/src/tmcsim/application.properties

    r185 r186  
    1 #Sat, 28 Oct 2017 19:14:00 -0700 
     1#Sat, 28 Oct 2017 19:54:27 -0700 
    22 
    3 Application.revision=184 
     3Application.revision=185 
    44 
    5 Application.buildnumber=63 
     5Application.buildnumber=67 
  • trunk/test/atmsdriver/model/LoadSadDotsTest.java

    r185 r186  
    6161        ArrayList<Station> stations = fiftyfiveN.stations; 
    6262        Station sad = stations.get(0); 
    63         System.out.println(""+sad.getStationMeta()); 
     63        System.out.println(""+sad.toCondensedFormat(true)); 
    6464        assertEquals(22, sad.loops.size()); 
    6565 
     
    6969        stations = fourohfiveS.stations; 
    7070        Station happy = stations.get(0); 
    71         System.out.println(""+happy.getStationMeta()); 
     71        System.out.println(""+happy.toCondensedFormat(true)); 
    7272        assertEquals(9, happy.loops.size()); 
    7373    } 
  • trunk/test/atmsdriver/model/StationTest.java

    r103 r186  
    5050        System.out.println("getStationMeta"); 
    5151        String expResult = "2 3 4 N 1.0 0 A\n"; 
    52         String result = alpha.getStationMeta(); 
     52        String result = alpha.toCondensedFormat(true); 
    5353        assertEquals(expResult, result); 
    5454    } 
Note: See TracChangeset for help on using the changeset viewer.