Changeset 11452 in josm for trunk/src/org


Ignore:
Timestamp:
2017-01-12T01:24:40+01:00 (3 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
Files:
51 edited

Legend:

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

    r11402 r11452  
    414414                } else
    415415                    continue;
    416                 if (candidateWay.equals(lastWay) && candidateComingToHead)
     416                if (candidateComingToHead && candidateWay.equals(lastWay))
    417417                    continue;
    418418
  • trunk/src/org/openstreetmap/josm/actions/SplitWayAction.java

    r11343 r11452  
    252252            list.addListSelectionListener(e -> {
    253253                final Way selected = list.getSelectedValue();
    254                 if (Main.isDisplayingMapView() && selected != null && selected.getNodesCount() > 1) {
     254                if (selected != null && Main.isDisplayingMapView() && selected.getNodesCount() > 1) {
    255255                    final Collection<WaySegment> segments = new ArrayList<>(selected.getNodesCount() - 1);
    256256                    final Iterator<Node> it = selected.getNodes().iterator();
  • trunk/src/org/openstreetmap/josm/actions/audio/AudioPlayPauseAction.java

    r8510 r11452  
    3636        URL url = AudioPlayer.url();
    3737        try {
    38             if (AudioPlayer.paused() && url != null) {
     38            if (url != null && AudioPlayer.paused()) {
    3939                AudioPlayer.play(url);
    4040            } else if (AudioPlayer.playing()) {
  • trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java

    r10936 r11452  
    229229        // update selection to reflect which way being modified
    230230        OsmDataLayer editLayer = getLayerManager().getEditLayer();
    231         if (getCurrentBaseNode() != null && editLayer != null && !editLayer.data.selectionEmpty()) {
     231        if (editLayer != null && getCurrentBaseNode() != null && !editLayer.data.selectionEmpty()) {
    232232            DataSet currentDataSet = editLayer.data;
    233233            Way continueFrom = getWayForNode(getCurrentBaseNode());
     
    11241124
    11251125        // This happens when nothing is selected, but we still want to highlight the "target node"
    1126         if (mouseOnExistingNode == null && getLayerManager().getEditDataSet().selectionEmpty() && mousePos != null) {
     1126        if (mouseOnExistingNode == null && mousePos != null && getLayerManager().getEditDataSet().selectionEmpty()) {
    11271127            mouseOnExistingNode = Main.map.mapView.getNearestNode(mousePos, OsmPrimitive::isSelectable);
    11281128        }
     
    11611161        if (Main.map.mapView == null || mousePos == null
    11621162                // don't draw line if we don't know where from or where to
    1163                 || getCurrentBaseNode() == null || currentMouseEastNorth == null
     1163                || currentMouseEastNorth == null || getCurrentBaseNode() == null
    11641164                // don't draw line if mouse is outside window
    11651165                || !Main.map.mapView.getBounds().contains(mousePos))
     
    12381238         * Check whether a connection will be made
    12391239         */
    1240         if (getCurrentBaseNode() != null && !wayIsFinished) {
     1240        if (!wayIsFinished && getCurrentBaseNode() != null) {
    12411241            if (alt) {
    12421242                rv.append(' ').append(tr("Start new way from last node."));
  • trunk/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java

    r11385 r11452  
    586586
    587587            // Select Draw Tool if no selection has been made
    588             if (getLayerManager().getEditDataSet().selectionEmpty() && !cancelDrawMode) {
     588            if (!cancelDrawMode && getLayerManager().getEditDataSet().selectionEmpty()) {
    589589                Main.map.selectDrawTool(true);
    590590                updateStatusLine();
     
    639639    @Override
    640640    public void doKeyPressed(KeyEvent e) {
    641         if (!Main.isDisplayingMapView() ||
    642                 !repeatedKeySwitchLassoOption || !getShortcut().isEvent(e)) return;
     641        if (!repeatedKeySwitchLassoOption || !Main.isDisplayingMapView() || !getShortcut().isEvent(e))
     642            return;
    643643        if (Main.isDebugEnabled()) {
    644644            Main.debug(getClass().getName()+" consuming event "+e);
  • trunk/src/org/openstreetmap/josm/actions/search/SearchAction.java

    r11446 r11452  
    776776                    mapCSSSearch == that.mapCSSSearch &&
    777777                    allElements == that.allElements &&
    778                     Objects.equals(text, that.text) &&
    779                     mode == that.mode;
     778                    mode == that.mode &&
     779                    Objects.equals(text, that.text);
    780780        }
    781781
  • trunk/src/org/openstreetmap/josm/command/conflict/CoordinateConflictResolveCommand.java

    r9371 r11452  
    8686        if (!super.equals(obj)) return false;
    8787        CoordinateConflictResolveCommand that = (CoordinateConflictResolveCommand) obj;
    88         return Objects.equals(conflict, that.conflict) &&
    89                 decision == that.decision;
     88        return decision == that.decision && Objects.equals(conflict, that.conflict);
    9089    }
    9190}
  • trunk/src/org/openstreetmap/josm/command/conflict/DeletedStateConflictResolveCommand.java

    r11240 r11452  
    101101        if (!super.equals(obj)) return false;
    102102        DeletedStateConflictResolveCommand that = (DeletedStateConflictResolveCommand) obj;
    103         return Objects.equals(conflict, that.conflict) &&
    104                 decision == that.decision;
     103        return decision == that.decision && Objects.equals(conflict, that.conflict);
    105104    }
    106105}
  • trunk/src/org/openstreetmap/josm/data/Preferences.java

    r11443 r11452  
    444444        if (Main.isPlatformWindows()) {
    445445            String appdata = System.getenv("APPDATA");
    446             if (System.getenv("ALLUSERSPROFILE") != null && appdata != null
     446            if (appdata != null && System.getenv("ALLUSERSPROFILE") != null
    447447                    && appdata.lastIndexOf(File.separator) != -1) {
    448448                appdata = appdata.substring(appdata.lastIndexOf(File.separator));
     
    613613
    614614        // Backup old preferences if there are old preferences
    615         if (prefFile.exists() && prefFile.length() > 0 && initSuccessful) {
     615        if (initSuccessful && prefFile.exists() && prefFile.length() > 0) {
    616616            Utils.copyFile(prefFile, backupFile);
    617617        }
  • trunk/src/org/openstreetmap/josm/data/SystemOfMeasurement.java

    r11100 r11452  
    225225    public String getDistText(final double dist, final NumberFormat format, final double threshold) {
    226226        double a = dist / aValue;
    227         if (!Main.pref.getBoolean("system_of_measurement.use_only_lower_unit", false) && a > bValue / aValue)
     227        if (a > bValue / aValue && !Main.pref.getBoolean("system_of_measurement.use_only_lower_unit", false))
    228228            return formatText(dist / bValue, bName, format);
    229229        else if (a < threshold)
  • trunk/src/org/openstreetmap/josm/data/imagery/TMSCachedTileLoaderJob.java

    r11331 r11452  
    183183                    handleNoTileAtZoom();
    184184                    int httpStatusCode = attributes.getResponseCode();
    185                     if (!isNoTileAtZoom() && httpStatusCode >= 400) {
     185                    if (httpStatusCode >= 400 && !isNoTileAtZoom()) {
    186186                        if (attributes.getErrorMessage() == null) {
    187187                            tile.setError(tr("HTTP error {0} when loading tiles", httpStatusCode));
  • 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
  • trunk/src/org/openstreetmap/josm/data/validation/routines/UrlValidator.java

    r11385 r11452  
    463463
    464464        int slash2Count = countToken("//", path);
    465         if (isOff(ALLOW_2_SLASHES) && (slash2Count > 0)) {
     465        if (slash2Count > 0 && isOff(ALLOW_2_SLASHES)) {
    466466            return false;
    467467        }
  • trunk/src/org/openstreetmap/josm/data/validation/tests/DuplicateRelation.java

    r11129 r11452  
    6565            RelMember relMember = (RelMember) obj;
    6666            return relId == relMember.relId &&
     67                    type == relMember.type &&
    6768                    Objects.equals(role, relMember.role) &&
    68                     type == relMember.type &&
    6969                    Objects.equals(tags, relMember.tags) &&
    7070                    Objects.equals(coor, relMember.coor);
  • trunk/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagChecker.java

    r11399 r11452  
    319319                                    "Unexpected '='. Please only specify the key to remove!");
    320320                            check.fixCommands.add(FixCommand.fixRemove(ai.val));
    321                         } else if ("fixChangeKey".equals(ai.key) && val != null) {
     321                        } else if (val != null && "fixChangeKey".equals(ai.key)) {
    322322                            CheckParameterUtil.ensureThat(val.contains("=>"), "Separate old from new key by '=>'!");
    323323                            final String[] x = val.split("=>", 2);
    324324                            check.fixCommands.add(FixCommand.fixChangeKey(Tag.removeWhiteSpaces(x[0]), Tag.removeWhiteSpaces(x[1])));
    325                         } else if ("fixDeleteObject".equals(ai.key) && val != null) {
     325                        } else if (val != null && "fixDeleteObject".equals(ai.key)) {
    326326                            CheckParameterUtil.ensureThat("this".equals(val), "fixDeleteObject must be followed by 'this'");
    327327                            check.deletion = true;
    328                         } else if ("suggestAlternative".equals(ai.key) && val != null) {
     328                        } else if (val != null && "suggestAlternative".equals(ai.key)) {
    329329                            check.alternatives.add(val);
    330                         } else if ("assertMatch".equals(ai.key) && val != null) {
     330                        } else if (val != null && "assertMatch".equals(ai.key)) {
    331331                            check.assertions.put(val, Boolean.TRUE);
    332                         } else if ("assertNoMatch".equals(ai.key) && val != null) {
     332                        } else if (val != null && "assertNoMatch".equals(ai.key)) {
    333333                            check.assertions.put(val, Boolean.FALSE);
    334                         } else if ("group".equals(ai.key) && val != null) {
     334                        } else if (val != null && "group".equals(ai.key)) {
    335335                            check.group = val;
    336336                        } else {
  • trunk/src/org/openstreetmap/josm/data/validation/tests/UnconnectedWays.java

    r11129 r11452  
    211211                    continue;
    212212                }
    213                 if (endnodesHighway.contains(en) && !s.highway && !s.w.concernsArea()) {
     213                if (!s.highway && endnodesHighway.contains(en) && !s.w.concernsArea()) {
    214214                    map.put(en, s.w);
    215215                } else if (endnodes.contains(en) && !s.w.concernsArea()) {
  • trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java

    r11367 r11452  
    616616            double den = 100 * getScale();
    617617            double scaleMin = 0.01 * den / dm / 100;
    618             if (!Double.isInfinite(scaleMin) && newScale < scaleMin) {
     618            if (newScale < scaleMin && !Double.isInfinite(scaleMin)) {
    619619                newScale = scaleMin;
    620620            }
  • trunk/src/org/openstreetmap/josm/gui/bbox/SlippyMapControler.java

    r11386 r11452  
    130130    @Override
    131131    public void mouseDragged(MouseEvent e) {
    132         if ((e.getModifiersEx() & MouseEvent.BUTTON1_DOWN_MASK) == MouseEvent.BUTTON1_DOWN_MASK &&
    133                 !(Main.isPlatformOsx() && e.getModifiersEx() == MAC_MOUSE_BUTTON3_MASK) && iStartSelectionPoint != null) {
     132        if (iStartSelectionPoint != null && (e.getModifiersEx() & MouseEvent.BUTTON1_DOWN_MASK) == MouseEvent.BUTTON1_DOWN_MASK
     133                && !(Main.isPlatformOsx() && e.getModifiersEx() == MAC_MOUSE_BUTTON3_MASK)) {
    134134            iEndSelectionPoint = e.getPoint();
    135135            iSlippyMapChooser.setSelection(iStartSelectionPoint, iEndSelectionPoint);
  • trunk/src/org/openstreetmap/josm/gui/conflict/tags/RelationMemberConflictDecision.java

    r10378 r11452  
    8383        RelationMemberConflictDecision that = (RelationMemberConflictDecision) obj;
    8484        return pos == that.pos &&
    85                 Objects.equals(relation, that.relation) &&
    86                 Objects.equals(originalPrimitive, that.originalPrimitive) &&
    87                 Objects.equals(role, that.role) &&
    88                 decision == that.decision;
     85               decision == that.decision &&
     86               Objects.equals(relation, that.relation) &&
     87               Objects.equals(originalPrimitive, that.originalPrimitive) &&
     88               Objects.equals(role, that.role);
    8989    }
    9090
  • trunk/src/org/openstreetmap/josm/gui/dialogs/DialogsPanel.java

    r11357 r11452  
    246246            for (int i = 0; i < n; ++i) {
    247247                final ToggleDialog dlg = allDialogs.get(i);
    248                 if (dlg.isDialogInDefaultView() && dlg != triggeredBy) {
     248                if (dlg != triggeredBy && dlg.isDialogInDefaultView()) {
    249249                    final int ha = dlg.getSize().height;                              // current
    250250                    final int h0 = ha * r / sumA;                                     // proportional shrinking
     
    261261            for (int i = 0; i < n; ++i) {
    262262                final ToggleDialog dlg = allDialogs.get(i);
    263                 if (dlg.isDialogInDefaultView() && dlg != triggeredBy) {
     263                if (dlg != triggeredBy && dlg.isDialogInDefaultView()) {
    264264                    final int ha = dlg.getHeight();
    265265                    final int h0 = ha * r / sumA;
  • trunk/src/org/openstreetmap/josm/gui/dialogs/FilterTableModel.java

    r10627 r11452  
    118118        }
    119119
    120         if (Main.isDisplayingMapView() && changed) {
     120        if (changed && Main.isDisplayingMapView()) {
    121121            Main.map.mapView.repaint();
    122122            Main.map.filterDialog.updateDialogHeader();
  • trunk/src/org/openstreetmap/josm/gui/dialogs/InspectPrimitiveDialog.java

    r11177 r11452  
    159159                txtMappaint.append(tr("The 2 selected objects have different style caches."));
    160160            }
    161             if (sc1.equals(sc2) && sc1 != sc2) {
     161            if (sc1 != sc2 && sc1.equals(sc2)) {
    162162                txtMappaint.append(tr("Warning: The 2 selected objects have equal, but not identical style caches."));
    163163            }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/MinimapDialog.java

    r10784 r11452  
    5555    @Override
    5656    public void zoomChanged() {
    57         if (Main.isDisplayingMapView() && !skipEvents) {
     57        if (!skipEvents && Main.isDisplayingMapView()) {
    5858            MapView mv = Main.map.mapView;
    5959            final Bounds currentBounds = new Bounds(
  • trunk/src/org/openstreetmap/josm/gui/dialogs/layer/LayerListTransferHandler.java

    r10762 r11452  
    9696            boolean isSameLayerManager = tableModel.getLayerManager() == layers.getManager();
    9797
    98             if (support.getDropAction() == MOVE && isSameLayerManager) {
     98            if (isSameLayerManager && support.getDropAction() == MOVE) {
    9999                for (Layer layer : layers.getLayers()) {
    100100                    boolean wasBeforeInsert = layers.getManager().getLayers().indexOf(layer) <= dropLocation;
  • trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java

    r11386 r11452  
    12071207                         *  content lengths, so we have to be fuzzy.. (this is UGLY, recode if u know better)
    12081208                         */
    1209                         if (conn.getContentLength() != -1 && osize > -1 && Math.abs(conn.getContentLength() - osize) > 200) {
     1209                        if (osize > -1 && conn.getContentLength() != -1 && Math.abs(conn.getContentLength() - osize) > 200) {
    12101210                            Main.info("{0} is a mediawiki redirect", u);
    12111211                            conn.disconnect();
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/sort/WayConnectionTypeCalculator.java

    r10965 r11452  
    9898            }
    9999
    100             if (!RelationSortUtils.isOneway(m) && lastWct != null) {
     100            if (lastWct != null && !RelationSortUtils.isOneway(m)) {
    101101                wct.direction = determineDirection(i-1, lastWct.direction, i);
    102102                wct.linkPrev = wct.direction != NONE;
     
    307307                        return FORWARD;
    308308                }
    309                 if (n == RelationNodeMap.lastOnewayNode(m) && reversed) {
     309                if (reversed && n == RelationNodeMap.lastOnewayNode(m)) {
    310310                    if (RelationSortUtils.isBackward(m))
    311311                        return FORWARD;
  • trunk/src/org/openstreetmap/josm/gui/io/UploadDialog.java

    r11366 r11452  
    643643        Collection<String> history = Main.pref.getCollection(historyKey, def);
    644644        int age = (int) (System.currentTimeMillis() / 1000 - Main.pref.getInteger(BasicUploadSettingsPanel.HISTORY_LAST_USED_KEY, 0));
    645         if (age < Main.pref.getLong(BasicUploadSettingsPanel.HISTORY_MAX_AGE_KEY, TimeUnit.HOURS.toMillis(4))
    646                 && history != null && !history.isEmpty()) {
     645        if (history != null && age < Main.pref.getLong(BasicUploadSettingsPanel.HISTORY_MAX_AGE_KEY, TimeUnit.HOURS.toMillis(4))
     646                && !history.isEmpty()) {
    647647            return history.iterator().next();
    648648        } else {
  • trunk/src/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayer.java

    r11381 r11452  
    15841584            List<Tile> newlyMissedTiles = new LinkedList<>();
    15851585            for (Tile missed : missedTiles) {
    1586                 if ("no-tile".equals(missed.getValue("tile-info")) && zoomOffset > 0) {
     1586                if (zoomOffset > 0 && "no-tile".equals(missed.getValue("tile-info"))) {
    15871587                    // Don't try to paint from higher zoom levels when tile is overzoomed
    15881588                    newlyMissedTiles.add(missed);
  • trunk/src/org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImages.java

    r11288 r11452  
    10711071            }
    10721072
    1073             if (e.isTagged() && e.getExifCoor() == null && !tagged) {
     1073            if (!tagged && e.isTagged() && e.getExifCoor() == null) {
    10741074                continue;
    10751075            }
     
    12021202            }
    12031203
    1204             if (curImg.tmp.getPos() == null && prevWp != null) {
     1204            if (prevWp != null && curImg.tmp.getPos() == null) {
    12051205                // The values of timeDiff are between 0 and 1, it is not seconds but a dimensionless variable
    12061206                double timeDiff = (double) (imgTime - prevWpTime) / interval;
  • trunk/src/org/openstreetmap/josm/gui/layer/geoimage/ImageViewerDialog.java

    r10763 r11452  
    306306            imageChanged = currentEntry != entry;
    307307
    308             if (centerView && Main.isDisplayingMapView() && entry != null && entry.getPos() != null) {
     308            if (centerView && entry != null && Main.isDisplayingMapView() && entry.getPos() != null) {
    309309                Main.map.mapView.zoomTo(entry.getPos());
    310310            }
  • trunk/src/org/openstreetmap/josm/gui/layer/gpx/GpxDrawHelper.java

    r11451 r11452  
    175175        SystemOfMeasurement som = SystemOfMeasurement.getSystemOfMeasurement();
    176176        velocityScale.addTitle(tr("Velocity, {0}", som.speedName));
    177         if (Main.isDisplayingMapView() && oldSoM != null && newSoM != null) {
     177        if (oldSoM != null && newSoM != null && Main.isDisplayingMapView()) {
    178178            Main.map.mapView.repaint();
    179179        }
     
    11671167     */
    11681168    private void checkCache() {
    1169         if ((computeCacheMaxLineLengthUsed != maxLineLength) || (!neutralColor.equals(computeCacheColorUsed))
    1170                 || (computeCacheColored != colored) || (computeCacheColorTracksTune != colorTracksTune)
     1169        if ((computeCacheMaxLineLengthUsed != maxLineLength)
     1170                || (computeCacheColored != colored)
     1171                || (computeCacheColorTracksTune != colorTracksTune)
    11711172                || (computeCacheColorDynamic != colorModeDynamic)
    11721173                || (computeCacheHeatMapDrawColorTableIdx != heatMapDrawColorTableIdx)
     1174                || (!neutralColor.equals(computeCacheColorUsed))
    11731175      ) {
    11741176            computeCacheMaxLineLengthUsed = maxLineLength;
  • trunk/src/org/openstreetmap/josm/gui/layer/gpx/ImportAudioAction.java

    r11366 r11452  
    166166
    167167        // (a) try explicit timestamped waypoints - unless suppressed
    168         if (Main.pref.getBoolean("marker.audiofromexplicitwaypoints", true) && hasWaypoints) {
     168        if (hasWaypoints && Main.pref.getBoolean("marker.audiofromexplicitwaypoints", true)) {
    169169            for (WayPoint w : layer.data.waypoints) {
    170170                if (w.time > firstTime) {
     
    177177
    178178        // (b) try explicit waypoints without timestamps - unless suppressed
    179         if (Main.pref.getBoolean("marker.audiofromuntimedwaypoints", true) && hasWaypoints) {
     179        if (hasWaypoints && Main.pref.getBoolean("marker.audiofromuntimedwaypoints", true)) {
    180180            for (WayPoint w : layer.data.waypoints) {
    181181                if (waypoints.contains(w)) {
     
    197197
    198198        // (c) use explicitly named track points, again unless suppressed
    199         if ((Main.pref.getBoolean("marker.audiofromnamedtrackpoints", false)) && layer.data.tracks != null
     199        if (layer.data.tracks != null && Main.pref.getBoolean("marker.audiofromnamedtrackpoints", false)
    200200                && !layer.data.tracks.isEmpty()) {
    201201            for (GpxTrack track : layer.data.tracks) {
     
    211211
    212212        // (d) use timestamp of file as location on track
    213         if ((Main.pref.getBoolean("marker.audiofromwavtimestamps", false)) && hasTracks) {
     213        if (hasTracks && Main.pref.getBoolean("marker.audiofromwavtimestamps", false)) {
    214214            double lastModified = wavFile.lastModified() / 1000.0; // lastModified is in
    215215            // milliseconds
  • trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/BoxTextElement.java

    r10600 r11452  
    282282        if (!super.equals(obj)) return false;
    283283        BoxTextElement that = (BoxTextElement) obj;
    284         return Objects.equals(text, that.text) &&
    285                 Objects.equals(boxProvider, that.boxProvider) &&
    286                 Objects.equals(box, that.box) &&
    287                 hAlign == that.hAlign &&
    288                 vAlign == that.vAlign;
     284        return hAlign == that.hAlign &&
     285               vAlign == that.vAlign &&
     286               Objects.equals(text, that.text) &&
     287               Objects.equals(boxProvider, that.boxProvider) &&
     288               Objects.equals(box, that.box);
    289289    }
    290290
  • trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/LineElement.java

    r11090 r11452  
    160160            return false;
    161161        final LineElement other = (LineElement) obj;
    162         return Objects.equals(line, other.line) &&
    163             Objects.equals(color, other.color) &&
    164             Objects.equals(dashesLine, other.dashesLine) &&
    165             Objects.equals(dashesBackground, other.dashesBackground) &&
    166             offset == other.offset &&
    167             realWidth == other.realWidth &&
    168             wayDirectionArrows == other.wayDirectionArrows;
     162        return offset == other.offset &&
     163               realWidth == other.realWidth &&
     164               wayDirectionArrows == other.wayDirectionArrows &&
     165               Objects.equals(line, other.line) &&
     166               Objects.equals(color, other.color) &&
     167               Objects.equals(dashesLine, other.dashesLine) &&
     168               Objects.equals(dashesBackground, other.dashesBackground);
    169169    }
    170170
  • trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/RepeatImageElement.java

    r11148 r11452  
    9696        if (!super.equals(obj)) return false;
    9797        RepeatImageElement that = (RepeatImageElement) obj;
    98         return Float.compare(that.offset, offset) == 0 &&
    99                 Float.compare(that.spacing, spacing) == 0 &&
    100                 Float.compare(that.phase, phase) == 0 &&
    101                 Objects.equals(pattern, that.pattern) &&
    102                 align == that.align;
     98        return align == that.align &&
     99               Float.compare(that.offset, offset) == 0 &&
     100               Float.compare(that.spacing, spacing) == 0 &&
     101               Float.compare(that.phase, phase) == 0 &&
     102               Objects.equals(pattern, that.pattern);
    103103    }
    104104
  • trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/StyleElement.java

    r10238 r11452  
    199199        if (o == null || getClass() != o.getClass()) return false;
    200200        StyleElement that = (StyleElement) o;
    201         return Float.compare(that.majorZIndex, majorZIndex) == 0 &&
    202                 Float.compare(that.zIndex, zIndex) == 0 &&
    203                 Float.compare(that.objectZIndex, objectZIndex) == 0 &&
    204                 isModifier == that.isModifier;
     201        return isModifier == that.isModifier &&
     202               Float.compare(that.majorZIndex, majorZIndex) == 0 &&
     203               Float.compare(that.zIndex, zIndex) == 0 &&
     204               Float.compare(that.objectZIndex, objectZIndex) == 0;
    205205    }
    206206
  • trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletionManager.java

    r11384 r11452  
    9494            }
    9595            final UserInputTag other = (UserInputTag) obj;
    96             return Objects.equals(this.key, other.key)
    97                 && Objects.equals(this.value, other.value)
    98                 && this.defaultKey == other.defaultKey;
     96            return this.defaultKey == other.defaultKey
     97                && Objects.equals(this.key, other.key)
     98                && Objects.equals(this.value, other.value);
    9999        }
    100100    }
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/Check.java

    r9665 r11452  
    9292    public void addCommands(List<Tag> changedTags) {
    9393        // if the user hasn't changed anything, don't create a command.
    94         if (check.getState() == initialState && def == null) return;
     94        if (def == null && check.getState() == initialState) return;
    9595
    9696        // otherwise change things according to the selected value.
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/Combo.java

    r11017 r11452  
    8585            // all items were unset (and so is default)
    8686            originalValue = lhm.get("");
    87             if ("force".equals(use_last_as_default) && LAST_VALUES.containsKey(key) && !presetInitiallyMatches) {
     87            if (!presetInitiallyMatches && "force".equals(use_last_as_default) && LAST_VALUES.containsKey(key)) {
    8888                combobox.setSelectedItem(lhm.get(LAST_VALUES.get(key)));
    8989            } else {
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/ComboMultiSelect.java

    r11381 r11452  
    492492        }
    493493
    494         if (Main.pref.getBoolean("taggingpreset.sortvalues", true) && values_sort) {
     494        if (values_sort && Main.pref.getBoolean("taggingpreset.sortvalues", true)) {
    495495            Collections.sort(entries);
    496496        }
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/Text.java

    r11017 r11452  
    8888            } else if (!usage.hadKeys() || PROP_FILL_DEFAULT.get() || "force".equals(use_last_as_default)) {
    8989                // selected osm primitives are untagged or filling default values feature is enabled
    90                 if (!"false".equals(use_last_as_default) && LAST_VALUES.containsKey(key) && !presetInitiallyMatches) {
     90                if (!presetInitiallyMatches && !"false".equals(use_last_as_default) && LAST_VALUES.containsKey(key)) {
    9191                    textField.setText(LAST_VALUES.get(key));
    9292                } else {
  • trunk/src/org/openstreetmap/josm/gui/widgets/JMultilineLabel.java

    r9463 r11452  
    6666
    6767    /**
    68      * Tries to determine a suitable height for the given contents and return
    69      * that dimension.
     68     * Tries to determine a suitable height for the given contents and return that dimension.
    7069     */
    7170    @Override
    7271    public Dimension getPreferredSize() {
    73         // Without this check it will result in an infinite loop calling
    74         // getPreferredSize. Remember the old bounds and only recalculate if
    75         // the size actually changed.
    76         if (this.getBounds().equals(oldbounds) && oldPreferred != null) {
     72        // Without this check it will result in an infinite loop calling getPreferredSize.
     73        // Remember the old bounds and only recalculate if the size actually changed.
     74        if (oldPreferred != null && this.getBounds().equals(oldbounds)) {
    7775            return oldPreferred;
    7876        }
  • trunk/src/org/openstreetmap/josm/io/NameFinder.java

    r11016 r11452  
    197197                if ("searchresults".equals(qName)) {
    198198                    // do nothing
    199                 } else if ("named".equals(qName) && (depth == 2)) {
     199                } else if (depth == 2 && "named".equals(qName)) {
    200200                    currentResult = new SearchResult();
    201201                    currentResult.name = atts.getValue("name");
     
    208208                    currentResult.zoom = Integer.parseInt(atts.getValue("zoom"));
    209209                    data.add(currentResult);
    210                 } else if ("description".equals(qName) && (depth == 3)) {
     210                } else if (depth == 3 && "description".equals(qName)) {
    211211                    description = new StringBuilder();
    212                 } else if ("named".equals(qName) && (depth == 4)) {
     212                } else if (depth == 4 && "named".equals(qName)) {
    213213                    // this is a "named" place in the nearest places list.
    214214                    String info = atts.getValue("info");
     
    252252        @Override
    253253        public void endElement(String namespaceURI, String localName, String qName) throws SAXException {
    254             if ("description".equals(qName) && description != null) {
     254            if (description != null && "description".equals(qName)) {
    255255                currentResult.description = description.toString();
    256256                description = null;
  • trunk/src/org/openstreetmap/josm/io/imagery/ImageryReader.java

    r11386 r11452  
    291291                break;
    292292            case MIRROR:
    293                 if ("mirror".equals(qName) && mirrorEntry != null) {
     293                if (mirrorEntry != null && "mirror".equals(qName)) {
    294294                    entry.addMirror(mirrorEntry);
    295295                    mirrorEntry = null;
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/AddTagsDialog.java

    r11366 r11452  
    251251    protected void buttonAction(int buttonIndex, ActionEvent evt) {
    252252        // if layer all layers were closed, ignore all actions
    253         if (Main.getLayerManager().getEditDataSet() != null && buttonIndex != 2) {
     253        if (buttonIndex != 2 && Main.getLayerManager().getEditDataSet() != null) {
    254254            TableModel tm = propertyTable.getModel();
    255255            for (int i = 0; i < tm.getRowCount(); i++) {
Note: See TracChangeset for help on using the changeset viewer.