Changeset 10678 in josm for trunk/src/org/openstreetmap


Ignore:
Timestamp:
2016-07-30T13:01:26+02:00 (8 years ago)
Author:
Don-vip
Message:

see #12472 - fix "OperatorPrecedence" warnings

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

Legend:

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

    r10662 r10678  
    692692            int posn0 = selectedWay.getNodes().indexOf(currentNode);
    693693            // CHECKSTYLE.OFF: SingleSpaceSeparator
    694             if (posn0 != -1 && // n0 is part of way
    695                (posn0 >= 1                             && targetNode.equals(selectedWay.getNode(posn0-1))) || // previous node
    696                (posn0 < selectedWay.getNodesCount()-1) && targetNode.equals(selectedWay.getNode(posn0+1))) {  // next node
     694            if ((posn0 != -1 && // n0 is part of way
     695                (posn0 >= 1                            && targetNode.equals(selectedWay.getNode(posn0-1)))) || // previous node
     696                (posn0 < selectedWay.getNodesCount()-1 && targetNode.equals(selectedWay.getNode(posn0+1)))) {  // next node
    697697                getLayerManager().getEditDataSet().setSelected(targetNode);
    698698                lastUsedNode = targetNode;
  • trunk/src/org/openstreetmap/josm/data/validation/tests/ConditionalKeys.java

    r10657 r10678  
    7676        }
    7777        final String[] parts = key.replaceAll(":conditional", "").split(":");
    78         return parts.length == 3 && isRestrictionType(parts[0]) && isTransportationMode(parts[1]) && isDirection(parts[2])
    79                 || parts.length == 1 && (isRestrictionType(parts[0]) || isTransportationMode(parts[0]))
    80                 || parts.length == 2 && (
    81                 isRestrictionType(parts[0]) && (isTransportationMode(parts[1]) || isDirection(parts[1]))
    82                         || isTransportationMode(parts[0]) && isDirection(parts[1]));
     78        return isKeyValid3Parts(parts) || isKeyValid1Part(parts) || isKeyValid2Parts(parts);
     79    }
     80
     81    private static boolean isKeyValid3Parts(String[] parts) {
     82        return parts.length == 3 && isRestrictionType(parts[0]) && isTransportationMode(parts[1]) && isDirection(parts[2]);
     83    }
     84
     85    private static boolean isKeyValid2Parts(String[] parts) {
     86        return parts.length == 2 && ((isRestrictionType(parts[0]) && (isTransportationMode(parts[1]) || isDirection(parts[1])))
     87                                  || (isTransportationMode(parts[0]) && isDirection(parts[1])));
     88    }
     89
     90    private static boolean isKeyValid1Part(String[] parts) {
     91        return parts.length == 1 && (isRestrictionType(parts[0]) || isTransportationMode(parts[0]));
    8392    }
    8493
Note: See TracChangeset for help on using the changeset viewer.