Ignore:
Timestamp:
2020-11-29T10:33:58+01:00 (3 years ago)
Author:
GerdP
Message:

see #20167: [patch] Improve code readability by replacing indexed loops with foreach
Patch by gaben, slightly modified
I removed the changes for

  • GpxImageCorrelation.java, they introduce a TODO
  • ConnectivityRelations.java (no improvement in readability)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/projection/datum/NTV2GridShiftFile.java

    r17333 r17374  
    263263    private static NTV2SubGrid getSubGrid(NTV2SubGrid[] topLevelSubGrid, double lon, double lat) {
    264264        NTV2SubGrid sub = null;
    265         for (int i = 0; i < topLevelSubGrid.length; i++) {
    266             sub = topLevelSubGrid[i].getSubGridForCoord(lon, lat);
     265        for (NTV2SubGrid topLevel : topLevelSubGrid) {
     266            sub = topLevel.getSubGridForCoord(lon, lat);
    267267            if (sub != null) {
    268268                break;
     
    274274    @Override
    275275    public String toString() {
    276         return new StringBuilder(256)
    277             .append("Headers  : ")
    278             .append(overviewHeaderCount)
    279             .append("\nSub Hdrs : ")
    280             .append(subGridHeaderCount)
    281             .append("\nSub Grids: ")
    282             .append(subGridCount)
    283             .append("\nType     : ")
    284             .append(shiftType)
    285             .append("\nVersion  : ")
    286             .append(version)
    287             .append("\nFr Ellpsd: ")
    288             .append(fromEllipsoid)
    289             .append("\nTo Ellpsd: ")
    290             .append(toEllipsoid)
    291             .append("\nFr Maj Ax: ")
    292             .append(fromSemiMajorAxis)
    293             .append("\nFr Min Ax: ")
    294             .append(fromSemiMinorAxis)
    295             .append("\nTo Maj Ax: ")
    296             .append(toSemiMajorAxis)
    297             .append("\nTo Min Ax: ")
    298             .append(toSemiMinorAxis)
    299             .toString();
     276        char endl = '\n';
     277        return "Headers  : " + overviewHeaderCount + endl +
     278                "Sub Hdrs : " + subGridHeaderCount + endl +
     279                "Sub Grids: " + subGridCount + endl +
     280                "Type     : " + shiftType + endl +
     281                "Version  : " + version + endl +
     282                "Fr Ellpsd: " + fromEllipsoid + endl +
     283                "To Ellpsd: " + toEllipsoid + endl +
     284                "Fr Maj Ax: " + fromSemiMajorAxis + endl +
     285                "Fr Min Ax: " + fromSemiMinorAxis + endl +
     286                "To Maj Ax: " + toSemiMajorAxis + endl +
     287                "To Min Ax: " + toSemiMinorAxis;
    300288    }
    301289
Note: See TracChangeset for help on using the changeset viewer.