Changeset 13974 in josm for trunk


Ignore:
Timestamp:
2018-06-24T19:57:43+02:00 (6 years ago)
Author:
Don-vip
Message:

fix recent minor issues

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

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/validation/tests/Addresses.java

    r13970 r13974  
    6565    // CHECKSTYLE.ON: SingleSpaceSeparator
    6666
    67     private Map<String, Collection<OsmPrimitive>> addresses;
     67    private Map<String, Collection<OsmPrimitive>> knownAddresses;
    6868    private Set<String> ignoredAddresses;
    6969
     
    124124    }
    125125
    126     private boolean hasAddress(OsmPrimitive p) {
     126    static boolean hasAddress(OsmPrimitive p) {
    127127        return p.hasKey(ADDR_HOUSE_NUMBER) && p.hasKey(ADDR_STREET, ADDR_PLACE);
    128128    }
     
    136136            String simplifiedAddress = getSimplifiedAddress(p);
    137137            if (!ignoredAddresses.contains(simplifiedAddress)) {
    138                 addresses.computeIfAbsent(simplifiedAddress, x -> new ArrayList<>()).add(p);
     138                knownAddresses.computeIfAbsent(simplifiedAddress, x -> new ArrayList<>()).add(p);
    139139            }
    140140        }
     
    142142
    143143    protected void initAddressMap(OsmPrimitive primitive) {
    144         addresses = new HashMap<>();
     144        knownAddresses = new HashMap<>();
    145145        ignoredAddresses = new HashSet<>();
    146146        for (OsmPrimitive p : primitive.getDataSet().allNonDeletedPrimitives()) {
     
    153153                        if (!ignoredAddresses.contains(simplifiedAddress)) {
    154154                            ignoredAddresses.add(simplifiedAddress);
    155                         } else if (addresses.containsKey(simplifiedAddress)) {
    156                             addresses.remove(simplifiedAddress);
     155                        } else if (knownAddresses.containsKey(simplifiedAddress)) {
     156                            knownAddresses.remove(simplifiedAddress);
    157157                        }
    158158                    }
     
    167167    @Override
    168168    public void endTest() {
    169         addresses = null;
     169        knownAddresses = null;
    170170        ignoredAddresses = null;
    171171        super.endTest();
     
    173173
    174174    protected void checkForDuplicate(OsmPrimitive p) {
    175         if (addresses == null) {
     175        if (knownAddresses == null) {
    176176            initAddressMap(p);
    177177        }
     
    181181                return;
    182182            }
    183             if (addresses.containsKey(simplifiedAddress)) {
     183            if (knownAddresses.containsKey(simplifiedAddress)) {
    184184                double maxDistance = MAX_DUPLICATE_DISTANCE.get();
    185                 for (OsmPrimitive p2 : addresses.get(simplifiedAddress)) {
     185                for (OsmPrimitive p2 : knownAddresses.get(simplifiedAddress)) {
    186186                    if (p == p2) {
    187187                        continue;
    188188                    }
    189                     Severity severityLevel = Severity.WARNING;
     189                    Severity severityLevel;
    190190                    String city1 = p.get(ADDR_CITY);
    191191                    String city2 = p2.get(ADDR_CITY);
     
    227227                            .primitives(Arrays.asList(p, p2)).build());
    228228                }
    229                 addresses.get(simplifiedAddress).remove(p); // otherwise we would get every warning two times
     229                knownAddresses.get(simplifiedAddress).remove(p); // otherwise we would get every warning two times
    230230            }
    231231        }
  • trunk/src/org/openstreetmap/josm/gui/history/HistoryBrowserDialogManager.java

    r13948 r13974  
    198198     * Adds a new {@code HistoryHook}.
    199199     * @param hook hook to add
    200      * @return <tt>true</tt> (as specified by {@link Collection#add})
     200     * @return {@code true} (as specified by {@link Collection#add})
    201201     * @since 13947
    202202     */
     
    208208     * Removes an existing {@code HistoryHook}.
    209209     * @param hook hook to remove
    210      * @return <tt>true</tt> if this list contained the specified element
     210     * @return {@code true} if this list contained the specified element
    211211     * @since 13947
    212212     */
  • trunk/src/org/openstreetmap/josm/gui/widgets/TextContextualPopupMenu.java

    r13965 r13974  
    5050    private static ImageIcon loadIcon(String iconName) {
    5151        return iconCache.computeIfAbsent(iconName,
    52                 x -> new ImageProvider(iconName).setOptional(true).setSize(ImageProvider.ImageSizes.SMALLICON).get());
     52                x -> new ImageProvider(x).setOptional(true).setSize(ImageProvider.ImageSizes.SMALLICON).get());
    5353    }
    5454
Note: See TracChangeset for help on using the changeset viewer.