Changeset 194 in tmcsimulator for trunk/src/atmsdriver/model


Ignore:
Timestamp:
10/30/2017 02:50:59 PM (9 years ago)
Author:
jdalbey
Message:

TrafficModelEventDriver?: Clean up code and comments. Highways.java improve formatting of toString output.

File:
1 edited

Legend:

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

    r191 r194  
    480480        for (Highway hwy: highways) 
    481481        { 
    482             result.append(""+String.format("%3s ",hwy.routeNumber)); 
    483             for (Station stat: hwy.stations) 
    484             { 
    485                 result.append(stat.getColorByDirection(stat.direction)); 
    486             } 
    487             result.append("\n"); 
    488         } 
     482            for (DIRECTION dir: DIRECTION.values()) 
     483            { 
     484                StringBuilder lineout = new StringBuilder(); 
     485                lineout.append(""+String.format("%3s ",hwy.routeNumber)+dir.getLetter()+' '); 
     486                for (Station stat: hwy.stations) 
     487                { 
     488                    if (stat.direction == dir) 
     489                    { 
     490                        //lineout.append("" + dir.getLetter() + stat.postmile); 
     491                        lineout.append(stat.getColorByDirection(stat.direction)); 
     492                        //lineout.append("  "); 
     493                    } 
     494                } 
     495                if (lineout.length() > 6) 
     496                { 
     497                    result.append(lineout + "\n"); 
     498                } 
     499            } 
     500        } 
     501        result.append("\n"); 
    489502        return result.toString(); 
    490503    } 
Note: See TracChangeset for help on using the changeset viewer.