Ignore:
Timestamp:
2013-08-03T00:12:29+02:00 (6 years ago)
Author:
Don-vip
Message:

see #8902 - Small performance enhancements / coding style (patch by shinigami):

  • while -> foreach
  • for -> for each

plus:

  • cleanup of FileDrop class to make it more integrated into JOSM core + remove warnings
Location:
trunk/src/org/openstreetmap/josm/data/projection
Files:
2 edited

Legend:

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

    r5889 r6104  
    160160            parts = new String[0];
    161161        }
    162         for (int i = 0; i < parts.length; i++) {
    163             String part = parts[i];
     162        for (String part : parts) {
    164163            if (part.isEmpty() || part.charAt(0) != '+')
    165164                throw new ProjectionConfigurationException(tr("Parameter must begin with a ''+'' character (found ''{0}'')", part));
     
    288287            throw new ProjectionConfigurationException(tr("Unexpected number of arguments for parameter ''towgs84'' (must be 3 or 7)"));
    289288        List<Double> towgs84Param = new ArrayList<Double>();
    290         for (int i = 0; i < numStr.length; i++) {
     289        for (String str : numStr) {
    291290            try {
    292                 towgs84Param.add(Double.parseDouble(numStr[i]));
     291                towgs84Param.add(Double.parseDouble(str));
    293292            } catch (NumberFormatException e) {
    294                 throw new ProjectionConfigurationException(tr("Unable to parse value of parameter ''towgs84'' (''{0}'')", numStr[i]));
     293                throw new ProjectionConfigurationException(tr("Unable to parse value of parameter ''towgs84'' (''{0}'')", str));
    295294            }
    296295        }
    297296        boolean isCentric = true;
    298         for (int i = 0; i<towgs84Param.size(); i++) {
    299             if (towgs84Param.get(i) != 0.0) {
     297        for (Double param : towgs84Param) {
     298            if (param != 0.0) {
    300299                isCentric = false;
    301300                break;
  • trunk/src/org/openstreetmap/josm/data/projection/datum/NTV2SubGrid.java

    r5909 r6104  
    163163                return this;
    164164            else {
    165                 for (int i = 0; i < subGrid.length; i++) {
    166                     if (subGrid[i].isCoordWithin(lon, lat))
    167                         return subGrid[i].getSubGridForCoord(lon, lat);
     165                for (NTV2SubGrid aSubGrid : subGrid) {
     166                    if (aSubGrid.isCoordWithin(lon, lat))
     167                        return aSubGrid.getSubGridForCoord(lon, lat);
    168168                }
    169169                return this;
Note: See TracChangeset for help on using the changeset viewer.