Ignore:
Timestamp:
2016-03-17T01:50:12+01:00 (10 years ago)
Author:
Don-vip
Message:

sonar - Local variable and method parameter names should comply with a naming convention

File:
1 edited

Legend:

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

    r9999 r10001  
    328328
    329329        // orthogonalize
    330         final Direction[] HORIZONTAL = {Direction.RIGHT, Direction.LEFT};
    331         final Direction[] VERTICAL = {Direction.UP, Direction.DOWN};
    332         final Direction[][] ORIENTATIONS = {HORIZONTAL, VERTICAL};
    333         for (Direction[] orientation : ORIENTATIONS) {
     330        final Direction[] horizontal = {Direction.RIGHT, Direction.LEFT};
     331        final Direction[] vertical = {Direction.UP, Direction.DOWN};
     332        final Direction[][] orientations = {horizontal, vertical};
     333        for (Direction[] orientation : orientations) {
    334334            final Set<Node> s = new HashSet<>(allNodes);
    335             int s_size = s.size();
    336             for (int dummy = 0; dummy < s_size; ++dummy) {
     335            int size = s.size();
     336            for (int dummy = 0; dummy < size; ++dummy) {
    337337                if (s.isEmpty()) {
    338338                    break;
    339339                }
    340                 final Node dummy_n = s.iterator().next();     // pick arbitrary element of s
    341 
    342                 final Set<Node> cs = new HashSet<>(); // will contain each node that can be reached from dummy_n
    343                 cs.add(dummy_n);                      // walking only on horizontal / vertical segments
     340                final Node dummyN = s.iterator().next();     // pick arbitrary element of s
     341
     342                final Set<Node> cs = new HashSet<>(); // will contain each node that can be reached from dummyN
     343                cs.add(dummyN);                      // walking only on horizontal / vertical segments
    344344
    345345                boolean somethingHappened = true;
     
    364364                }
    365365
    366                 final Map<Node, Double> nC = (orientation == HORIZONTAL) ? nY : nX;
     366                final Map<Node, Double> nC = (orientation == horizontal) ? nY : nX;
    367367
    368368                double average = 0;
     
    385385                // both heading nodes collapsing to one point, we simply skip this segment string and
    386386                // don't touch the node coordinates.
    387                 if (orientation == VERTICAL && headingNodes.size() == 2 && cs.containsAll(headingNodes)) {
     387                if (orientation == vertical && headingNodes.size() == 2 && cs.containsAll(headingNodes)) {
    388388                    continue;
    389389                }
     
    404404            final double dy = tmp.north() - n.getEastNorth().north();
    405405            if (headingNodes.contains(n)) { // The heading nodes should not have changed
    406                 final double EPSILON = 1E-6;
    407                 if (Math.abs(dx) > Math.abs(EPSILON * tmp.east()) ||
    408                         Math.abs(dy) > Math.abs(EPSILON * tmp.east()))
     406                final double epsilon = 1E-6;
     407                if (Math.abs(dx) > Math.abs(epsilon * tmp.east()) ||
     408                        Math.abs(dy) > Math.abs(epsilon * tmp.east()))
    409409                    throw new AssertionError();
    410410            } else {
     
    572572    private static int angleToDirectionChange(double a, double deltaMax) throws RejectedAngleException {
    573573        a = standard_angle_mPI_to_PI(a);
    574         double d0    = Math.abs(a);
    575         double d90   = Math.abs(a - Math.PI / 2);
    576         double d_m90 = Math.abs(a + Math.PI / 2);
     574        double d0   = Math.abs(a);
     575        double d90  = Math.abs(a - Math.PI / 2);
     576        double dm90 = Math.abs(a + Math.PI / 2);
    577577        int dirChange;
    578578        if (d0 < deltaMax) {
     
    580580        } else if (d90 < deltaMax) {
    581581            dirChange =  1;
    582         } else if (d_m90 < deltaMax) {
     582        } else if (dm90 < deltaMax) {
    583583            dirChange = -1;
    584584        } else {
Note: See TracChangeset for help on using the changeset viewer.