Ignore:
Timestamp:
2017-04-13T01:08:58+02:00 (7 years ago)
Author:
Don-vip
Message:

sonar - squid:S1126 - Return of boolean expressions should not be wrapped into an "if-then-else" statement

Location:
trunk/src/org/openstreetmap/josm/data/osm
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/osm/Changeset.java

    r11878 r11893  
    380380        } else if (!user.equals(other.user))
    381381            return false;
    382         if (commentsCount != other.commentsCount) {
    383             return false;
    384         }
    385         return true;
     382        return commentsCount == other.commentsCount;
    386383    }
    387384
  • trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java

    r11608 r11893  
    11521152        if (!isNew() && id != other.id)
    11531153            return false;
    1154         if (isIncomplete() ^ other.isIncomplete()) // exclusive or operator for performance (see #7159)
    1155             return false;
    1156         return true;
     1154        return !(isIncomplete() ^ other.isIncomplete()); // exclusive or operator for performance (see #7159)
    11571155    }
    11581156
  • trunk/src/org/openstreetmap/josm/data/osm/WaySegment.java

    r11397 r11893  
    121121     */
    122122    public boolean isSimilar(WaySegment s2) {
    123         if (getFirstNode().equals(s2.getFirstNode()) && getSecondNode().equals(s2.getSecondNode()))
    124             return true;
    125         if (getFirstNode().equals(s2.getSecondNode()) && getSecondNode().equals(s2.getFirstNode()))
    126             return true;
    127         return false;
     123        return (getFirstNode().equals(s2.getFirstNode()) && getSecondNode().equals(s2.getSecondNode()))
     124            || (getFirstNode().equals(s2.getSecondNode()) && getSecondNode().equals(s2.getFirstNode()));
    128125    }
    129126
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java

    r11870 r11893  
    14541454        if (bounds.isEmpty()) return false;
    14551455        MapViewPoint p = mapState.getPointFor(new EastNorth(bounds.getX(), bounds.getY()));
    1456         if (p.getInViewX() > mapState.getViewWidth()) return false;
    1457         if (p.getInViewY() < 0) return false;
     1456        if (p.getInViewY() < 0 || p.getInViewX() > mapState.getViewWidth()) return false;
    14581457        p = mapState.getPointFor(new EastNorth(bounds.getX() + bounds.getWidth(), bounds.getY() + bounds.getHeight()));
    1459         if (p.getInViewX() < 0) return false;
    1460         if (p.getInViewY() > mapState.getViewHeight()) return false;
    1461         return true;
    1462     }
    1463 
     1458        return p.getInViewX() >= 0 && p.getInViewY() <= mapState.getViewHeight();
     1459    }
     1460
     1461    /**
     1462     * Determines if the paint visitor shall render OSM objects such that they look inactive.
     1463     * @return {@code true} if the paint visitor shall render OSM objects such that they look inactive
     1464     */
    14641465    public boolean isInactiveMode() {
    14651466        return isInactiveMode;
Note: See TracChangeset for help on using the changeset viewer.