Changeset 13430 in josm for trunk/src/org/openstreetmap


Ignore:
Timestamp:
2018-02-17T15:40:42+01:00 (6 years ago)
Author:
Don-vip
Message:

fix #15943 - allow to search empty values

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

Legend:

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

    r13414 r13430  
    7676    /**
    7777     * Replies true if there is a tag with key <code>key</code>.
     78     * The value could however be empty. See {@link #hasTag(String)} to check for non-empty tags.
    7879     *
    7980     * @param key the key
    8081     * @return true, if there is a tag with key <code>key</code>
     82     * @see #hasTag(String)
    8183     * @since 11608
    8284     */
    8385    default boolean hasKey(String key) {
    8486        return get(key) != null;
     87    }
     88
     89    /**
     90     * Replies true if there is a non-empty tag with key <code>key</code>.
     91     *
     92     * @param key the key
     93     * @return true, if there is a non-empty tag with key <code>key</code>
     94     * @see Tagged#hasKey(String)
     95     * @since 13430
     96     */
     97    default boolean hasTag(String key) {
     98        String v = get(key);
     99        return v != null && !v.isEmpty();
    85100    }
    86101
  • trunk/src/org/openstreetmap/josm/data/osm/search/SearchCompiler.java

    r13317 r13430  
    836836                return false;
    837837            case MISSING_KEY:
    838                 return osm.get(key) == null;
     838                return !osm.hasTag(key);
    839839            case ANY:
    840840                return true;
    841841            case ANY_VALUE:
    842                 return osm.get(key) != null;
     842                return osm.hasTag(key);
    843843            case ANY_KEY:
    844844                for (String v:osm.getKeys().values()) {
Note: See TracChangeset for help on using the changeset viewer.