Ignore:
Timestamp:
2018-04-23T22:28:34+02:00 (6 years ago)
Author:
Don-vip
Message:

move a few methods from AbstractPrimitive to Tagged

File:
1 edited

Legend:

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

    r13637 r13668  
    1212import java.util.Map;
    1313import java.util.Map.Entry;
    14 import java.util.Objects;
    1514import java.util.Set;
    1615import java.util.concurrent.TimeUnit;
     
    467466    }
    468467
    469     /**
    470      * Calls the visitor for every key/value pair of this primitive.
    471      *
    472      * @param visitor The visitor to call.
    473      * @see #getKeys()
    474      * @since 8742
    475      */
     468    @Override
    476469    public void visitKeys(KeyValueVisitor visitor) {
    477470        final String[] keys = this.keys;
     
    769762        return getName();
    770763    }
    771 
    772     /**
    773      * Tests whether this primitive contains a tag consisting of {@code key} and {@code value}.
    774      * @param key the key forming the tag.
    775      * @param value value forming the tag.
    776      * @return true if primitive contains a tag consisting of {@code key} and {@code value}.
    777      */
    778     public boolean hasTag(String key, String value) {
    779         return Objects.equals(value, get(key));
    780     }
    781 
    782     /**
    783      * Tests whether this primitive contains a tag consisting of {@code key} and any of {@code values}.
    784      * @param key the key forming the tag.
    785      * @param values one or many values forming the tag.
    786      * @return true if primitive contains a tag consisting of {@code key} and any of {@code values}.
    787      */
    788     public boolean hasTag(String key, String... values) {
    789         return hasTag(key, Arrays.asList(values));
    790     }
    791 
    792     /**
    793      * Tests whether this primitive contains a tag consisting of {@code key} and any of {@code values}.
    794      * @param key the key forming the tag.
    795      * @param values one or many values forming the tag.
    796      * @return true if primitive contains a tag consisting of {@code key} and any of {@code values}.
    797      */
    798     public boolean hasTag(String key, Collection<String> values) {
    799         return values.contains(get(key));
    800     }
    801 
    802     /**
    803      * Tests whether this primitive contains a tag consisting of {@code key} and a value different from {@code value}.
    804      * @param key the key forming the tag.
    805      * @param value value not forming the tag.
    806      * @return true if primitive contains a tag consisting of {@code key} and a value different from {@code value}.
    807      * @since 11608
    808      */
    809     public boolean hasTagDifferent(String key, String value) {
    810         String v = get(key);
    811         return v != null && !v.equals(value);
    812     }
    813 
    814     /**
    815      * Tests whether this primitive contains a tag consisting of {@code key} and none of {@code values}.
    816      * @param key the key forming the tag.
    817      * @param values one or many values forming the tag.
    818      * @return true if primitive contains a tag consisting of {@code key} and none of {@code values}.
    819      * @since 11608
    820      */
    821     public boolean hasTagDifferent(String key, String... values) {
    822         return hasTagDifferent(key, Arrays.asList(values));
    823     }
    824 
    825     /**
    826      * Tests whether this primitive contains a tag consisting of {@code key} and none of {@code values}.
    827      * @param key the key forming the tag.
    828      * @param values one or many values forming the tag.
    829      * @return true if primitive contains a tag consisting of {@code key} and none of {@code values}.
    830      * @since 11608
    831      */
    832     public boolean hasTagDifferent(String key, Collection<String> values) {
    833         String v = get(key);
    834         return v != null && !values.contains(v);
    835     }
    836764}
Note: See TracChangeset for help on using the changeset viewer.