Changeset 18052 in josm for trunk/src/org


Ignore:
Timestamp:
2021-07-17T18:19:24+02:00 (3 years ago)
Author:
Don-vip
Message:

fix PMD violations

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

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/vector/VectorDataSet.java

    r17867 r18052  
    11// License: GPL. For details, see LICENSE file.
    22package org.openstreetmap.josm.data.vector;
    3 
    4 import org.openstreetmap.josm.data.DataSource;
    5 import org.openstreetmap.josm.data.imagery.vectortile.mapbox.MVTTile;
    6 import org.openstreetmap.josm.data.osm.BBox;
    7 import org.openstreetmap.josm.data.osm.DataSelectionListener;
    8 import org.openstreetmap.josm.data.osm.DownloadPolicy;
    9 import org.openstreetmap.josm.data.osm.HighlightUpdateListener;
    10 import org.openstreetmap.josm.data.osm.IPrimitive;
    11 import org.openstreetmap.josm.data.osm.OsmData;
    12 import org.openstreetmap.josm.data.osm.PrimitiveId;
    13 import org.openstreetmap.josm.data.osm.Storage;
    14 import org.openstreetmap.josm.data.osm.UploadPolicy;
    15 import org.openstreetmap.josm.data.osm.WaySegment;
    16 import org.openstreetmap.josm.data.osm.event.IDataSelectionEventSource;
    17 import org.openstreetmap.josm.data.osm.event.IDataSelectionListener;
    18 import org.openstreetmap.josm.gui.mappaint.ElemStyles;
    19 import org.openstreetmap.josm.tools.ListenerList;
    20 import org.openstreetmap.josm.tools.Logging;
    21 import org.openstreetmap.josm.tools.SubclassFilteredCollection;
    223
    234import java.util.ArrayList;
     
    4122import java.util.stream.Stream;
    4223
     24import org.openstreetmap.josm.data.DataSource;
     25import org.openstreetmap.josm.data.imagery.vectortile.mapbox.MVTTile;
     26import org.openstreetmap.josm.data.osm.BBox;
     27import org.openstreetmap.josm.data.osm.DataSelectionListener;
     28import org.openstreetmap.josm.data.osm.DownloadPolicy;
     29import org.openstreetmap.josm.data.osm.HighlightUpdateListener;
     30import org.openstreetmap.josm.data.osm.IPrimitive;
     31import org.openstreetmap.josm.data.osm.OsmData;
     32import org.openstreetmap.josm.data.osm.PrimitiveId;
     33import org.openstreetmap.josm.data.osm.Storage;
     34import org.openstreetmap.josm.data.osm.UploadPolicy;
     35import org.openstreetmap.josm.data.osm.WaySegment;
     36import org.openstreetmap.josm.data.osm.event.IDataSelectionEventSource;
     37import org.openstreetmap.josm.data.osm.event.IDataSelectionListener;
     38import org.openstreetmap.josm.gui.mappaint.ElemStyles;
     39import org.openstreetmap.josm.tools.ListenerList;
     40import org.openstreetmap.josm.tools.Logging;
     41import org.openstreetmap.josm.tools.SubclassFilteredCollection;
     42
    4343/**
    4444 * A data class for Vector Data
     
    243243    public Stream<VectorPrimitive> getPrimitivesById(PrimitiveId... primitiveIds) {
    244244        final Storage<MVTTile> dataStore = this.getBestZoomDataStore().orElse(null);
    245         final Stream<VectorDataStore> dataStoreStream = dataStore != null ? dataStore.stream().map(MVTTile::getData) : Stream.empty();
    246         return Stream.concat(dataStoreStream, Stream.of(this.customDataStore)).map(VectorDataStore::getPrimitivesMap)
     245        return Stream.concat(dataStore != null ? dataStore.stream().map(MVTTile::getData) : Stream.empty(),
     246                Stream.of(this.customDataStore)).map(VectorDataStore::getPrimitivesMap)
    247247                .flatMap(m -> Stream.of(primitiveIds).map(m::get)).filter(Objects::nonNull);
    248248    }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/layer/LayerVisibilityAction.java

    r18018 r18052  
    7878     * The real content, just to add a border
    7979     */
    80     protected final JPanel content = new JPanel();
    81     protected final List<VisibilityMenuEntry> sliders = new ArrayList<>();
     80    final JPanel content = new JPanel();
     81    final List<VisibilityMenuEntry> sliders = new ArrayList<>();
    8282
    8383    /**
  • trunk/src/org/openstreetmap/josm/gui/mappaint/StyleCache.java

    r17809 r18052  
    4646
    4747        if (selected) {
    48             s.selectedStyle = (s.selectedStyle == null ? new DividedScale<StyleElementList>() : s.selectedStyle).put(o, r);
     48            s.selectedStyle = scale(s.selectedStyle).put(o, r);
    4949        } else {
    50             s.plainStyle = (s.plainStyle == null ? new DividedScale<StyleElementList>() : s.plainStyle).put(o, r);
     50            s.plainStyle = scale(s.plainStyle).put(o, r);
    5151        }
    5252        return s.intern();
     53    }
     54
     55    private static DividedScale<StyleElementList> scale(DividedScale<StyleElementList> scale) {
     56        return scale == null ? new DividedScale<>() : scale;
    5357    }
    5458
Note: See TracChangeset for help on using the changeset viewer.