Ignore:
Timestamp:
2015-10-10T15:15:14+02:00 (5 years ago)
Author:
Don-vip
Message:

sonar - squid:S3047 - Multiple loops over the same set should be combined

Location:
trunk/src/org/openstreetmap/josm/actions
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/OrthogonalizeAction.java

    r8836 r8850  
    255255                wayDataList.get(0).calcDirections(Direction.RIGHT);
    256256                double refHeading = wayDataList.get(0).heading;
     257                EastNorth totSum = new EastNorth(0., 0.);
    257258                for (WayData w : wayDataList) {
    258259                    w.calcDirections(Direction.RIGHT);
    259260                    int directionOffset = angleToDirectionChange(w.heading - refHeading, TOLERANCE2);
    260261                    w.calcDirections(Direction.RIGHT.changeBy(directionOffset));
    261                     if (angleToDirectionChange(refHeading - w.heading, TOLERANCE2) != 0) throw new RuntimeException();
    262                 }
    263                 EastNorth totSum = new EastNorth(0., 0.);
    264                 for (WayData w : wayDataList) {
     262                    if (angleToDirectionChange(refHeading - w.heading, TOLERANCE2) != 0)
     263                        throw new RuntimeException();
    265264                    totSum = EN.sum(totSum, w.segSum);
    266265                }
     
    343342                    }
    344343                }
     344
     345                final Map<Node, Double> nC = (orientation == HORIZONTAL) ? nY : nX;
     346
     347                double average = 0;
    345348                for (Node n : cs) {
    346349                    s.remove(n);
    347                 }
    348 
    349                 final Map<Node, Double> nC = (orientation == HORIZONTAL) ? nY : nX;
    350 
    351                 double average = 0;
    352                 for (Node n : cs) {
    353350                    average += nC.get(n).doubleValue();
    354351                }
  • trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java

    r8840 r8850  
    652652            for (int i : is) {
    653653                segSet.add(Pair.sort(new Pair<>(w.getNode(i), w.getNode(i+1))));
    654             }
    655             for (int i : is) {
    656654                wnew.addNode(i + 1, n);
    657655            }
Note: See TracChangeset for help on using the changeset viewer.