Ignore:
Timestamp:
2017-02-25T03:14:20+01:00 (7 years ago)
Author:
Don-vip
Message:

fix #14402 - add blacklist for leisure area values to avoid false positives - improve globally the detection of keys/tags

File:
1 edited

Legend:

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

    r11587 r11608  
    706706     * Replies true, if the map of key/value pairs of this primitive is not empty.
    707707     *
    708      * @return true, if the map of key/value pairs of this primitive is not empty; false
    709      *   otherwise
     708     * @return true, if the map of key/value pairs of this primitive is not empty; false otherwise
    710709     */
    711710    @Override
     
    718717     *
    719718     * @param key the key
    720      * @return true, if his primitive has a tag with key <code>key</code>
    721      */
     719     * @return true, if this primitive has a tag with key <code>key</code>
     720     */
     721    @Override
    722722    public boolean hasKey(String key) {
    723723        return key != null && indexOfKey(keys, key) >= 0;
     
    728728     *
    729729     * @param keys the keys
    730      * @return true, if his primitive has a tag with any of the <code>keys</code>
     730     * @return true, if this primitive has a tag with any of the <code>keys</code>
    731731     * @since 11587
    732732     */
     
    758758
    759759    /**
    760      * Tests whether this primitive contains a tag consisting of {@code key} and {@code values}.
     760     * Tests whether this primitive contains a tag consisting of {@code key} and {@code value}.
    761761     * @param key the key forming the tag.
    762762     * @param value value forming the tag.
    763      * @return true iff primitive contains a tag consisting of {@code key} and {@code value}.
     763     * @return true if primitive contains a tag consisting of {@code key} and {@code value}.
    764764     */
    765765    public boolean hasTag(String key, String value) {
     
    781781     * @param key the key forming the tag.
    782782     * @param values one or many values forming the tag.
    783      * @return true iff primitive contains a tag consisting of {@code key} and any of {@code values}.
     783     * @return true if primitive contains a tag consisting of {@code key} and any of {@code values}.
    784784     */
    785785    public boolean hasTag(String key, Collection<String> values) {
    786786        return values.contains(get(key));
    787787    }
     788
     789    /**
     790     * Tests whether this primitive contains a tag consisting of {@code key} and a value different from {@code value}.
     791     * @param key the key forming the tag.
     792     * @param value value not forming the tag.
     793     * @return true if primitive contains a tag consisting of {@code key} and a value different from {@code value}.
     794     * @since 11608
     795     */
     796    public boolean hasTagDifferent(String key, String value) {
     797        String v = get(key);
     798        return v != null && !v.equals(value);
     799    }
     800
     801    /**
     802     * Tests whether this primitive contains a tag consisting of {@code key} and none of {@code values}.
     803     * @param key the key forming the tag.
     804     * @param values one or many values forming the tag.
     805     * @return true if primitive contains a tag consisting of {@code key} and none of {@code values}.
     806     * @since 11608
     807     */
     808    public boolean hasTagDifferent(String key, String... values) {
     809        return hasTagDifferent(key, Arrays.asList(values));
     810    }
     811
     812    /**
     813     * Tests whether this primitive contains a tag consisting of {@code key} and none of {@code values}.
     814     * @param key the key forming the tag.
     815     * @param values one or many values forming the tag.
     816     * @return true if primitive contains a tag consisting of {@code key} and none of {@code values}.
     817     * @since 11608
     818     */
     819    public boolean hasTagDifferent(String key, Collection<String> values) {
     820        String v = get(key);
     821        return v != null && !values.contains(v);
     822    }
    788823}
Note: See TracChangeset for help on using the changeset viewer.