Ignore:
Timestamp:
2017-01-12T01:24:40+01:00 (7 years ago)
Author:
Don-vip
Message:

sonar - fb-contrib:SEO_SUBOPTIMAL_EXPRESSION_ORDER - Performance - Method orders expressions in a conditional in a sub optimal way

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

Legend:

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

    r11435 r11452  
    296296        if (changesetId < 0)
    297297            throw new IllegalArgumentException(MessageFormat.format("Parameter ''{0}'' >= 0 expected, got {1}", "changesetId", changesetId));
    298         if (isNew() && changesetId > 0)
     298        if (changesetId > 0 && isNew())
    299299            throw new IllegalStateException(tr("Cannot assign a changesetId > 0 to a new primitive. Value of changesetId is {0}", changesetId));
    300300
     
    380380    @Override
    381381    public void setVisible(boolean visible) {
    382         if (isNew() && !visible)
     382        if (!visible && isNew())
    383383            throw new IllegalStateException(tr("A primitive with ID = 0 cannot be invisible."));
    384384        updateFlags(FLAG_VISIBLE, visible);
  • trunk/src/org/openstreetmap/josm/data/osm/BBox.java

    r11277 r11452  
    313313     */
    314314    public boolean isInWorld() {
    315         return isValid() && xmin >= -180.0 && xmax <= 180.0 && ymin >= -90.0 && ymax <= 90.0;
     315        return xmin >= -180.0 && xmax <= 180.0 && ymin >= -90.0 && ymax <= 90.0 && isValid();
    316316    }
    317317
  • trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java

    r11385 r11452  
    11701170     */
    11711171    public boolean hasEqualTechnicalAttributes(OsmPrimitive other) {
    1172         if (other == null) return false;
    1173 
    1174         return isDeleted() == other.isDeleted()
    1175                 && isModified() == other.isModified()
    1176                 && timestamp == other.timestamp
    1177                 && version == other.version
    1178                 && isVisible() == other.isVisible()
    1179                 && Objects.equals(user, other.user)
    1180                 && changesetId == other.changesetId;
     1172        return other != null
     1173            && timestamp == other.timestamp
     1174            && version == other.version
     1175            && changesetId == other.changesetId
     1176            && isDeleted() == other.isDeleted()
     1177            && isModified() == other.isModified()
     1178            && isVisible() == other.isVisible()
     1179            && Objects.equals(user, other.user);
    11811180    }
    11821181
  • trunk/src/org/openstreetmap/josm/data/osm/QuadBuckets.java

    r11397 r11452  
    274274            }
    275275            doAddContent(o);
    276             if (isLeaf() && content.size() > MAX_OBJECTS_PER_NODE && level < QuadTiling.NR_LEVELS) {
     276            if (level < QuadTiling.NR_LEVELS && isLeaf() && content.size() > MAX_OBJECTS_PER_NODE) {
    277277                doSplit();
    278278            }
  • trunk/src/org/openstreetmap/josm/data/osm/RelationMemberData.java

    r10216 r11452  
    107107        RelationMemberData that = (RelationMemberData) obj;
    108108        return memberId == that.memberId &&
    109                 Objects.equals(role, that.role) &&
    110                 memberType == that.memberType;
     109               memberType == that.memberType &&
     110               Objects.equals(role, that.role);
    111111    }
    112112}
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java

    r11351 r11452  
    10891089                } else if (m.isNode()) {
    10901090                    Node n = m.getNode();
    1091                     if ("via".equals(m.getRole()) && via == null) {
     1091                    if (via == null && "via".equals(m.getRole())) {
    10921092                        via = n;
    10931093                    }
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/WireframeMapRenderer.java

    r11090 r11452  
    297297        /* head only takes over control if the option is true,
    298298           the direction should be shown at all and not only because it's selected */
    299         boolean showOnlyHeadArrowOnly = showThisDirectionArrow && !ds.isSelected(w) && showHeadArrowOnly;
     299        boolean showOnlyHeadArrowOnly = showThisDirectionArrow && showHeadArrowOnly && !ds.isSelected(w);
    300300        Color wayColor;
    301301
Note: See TracChangeset for help on using the changeset viewer.