Ignore:
Timestamp:
2014-01-05T12:03:37+01:00 (11 years ago)
Author:
simon04
Message:

Replace NodesDuplicatingWayTags test by a corresponding MapCSS test

Location:
trunk/src/org/openstreetmap/josm/data
Files:
1 deleted
3 edited

Legend:

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

    r6610 r6629  
    671671
    672672    /**
    673      * Replies true if other isn't null and has the same tags (key/value-pairs) as this.
    674      *
    675      * @param other the other object primitive
    676      * @return true if other isn't null and has the same tags (key/value-pairs) as this.
    677      */
    678     public boolean hasSameTags(OsmPrimitive other) {
    679         // We cannot directly use Arrays.equals(keys, other.keys) as keys is not ordered by key
    680         // but we can at least check if both arrays are null or of the same size before creating
    681         // and comparing the key maps (costly operation, see #7159)
    682         return (keys == null && other.keys == null)
    683             || (keys != null && other.keys != null && keys.length == other.keys.length && (keys.length == 0 || getKeys().equals(other.getKeys())));
    684     }
    685 
    686     /**
    687673     * What to do, when the tags have changed by one of the tag-changing methods.
    688674     */
  • trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java

    r6491 r6629  
    1010import java.util.Collections;
    1111import java.util.Date;
     12import java.util.HashMap;
    1213import java.util.HashSet;
    1314import java.util.LinkedHashSet;
     
    726727    }
    727728
     729    /**
     730     * Returns {@link #getKeys()} for which {@code key} does not fulfill {@link #isUninterestingKey}.
     731     */
     732    public Map<String, String> getInterestingTags() {
     733        Map<String, String> result = new HashMap<String, String>();
     734        String[] keys = this.keys;
     735        if (keys != null) {
     736            for (int i = 0; i < keys.length; i += 2) {
     737                if (!isUninterestingKey(keys[i])) {
     738                    result.put(keys[i], keys[i + 1]);
     739                }
     740            }
     741        }
     742        return result;
     743    }
     744
    728745    private static volatile Match directionKeys = null;
    729746    private static volatile Match reversedDirectionKeys = null;
     
    11151132
    11161133    /**
     1134     * Replies true if other isn't null and has the same interesting tags (key/value-pairs) as this.
     1135     *
     1136     * @param other the other object primitive
     1137     * @return true if other isn't null and has the same interesting tags (key/value-pairs) as this.
     1138     */
     1139    public boolean hasSameInterestingTags(OsmPrimitive other) {
     1140        // We cannot directly use Arrays.equals(keys, other.keys) as keys is not ordered by key
     1141        // but we can at least check if both arrays are null or of the same size before creating
     1142        // and comparing the key maps (costly operation, see #7159)
     1143        return (keys == null && other.keys == null)
     1144                || (keys != null && other.keys != null && keys.length == other.keys.length
     1145                        && (keys.length == 0 || getInterestingTags().equals(other.getInterestingTags())));
     1146    }
     1147
     1148    /**
    11171149     * Replies true if this primitive and other are equal with respect to their
    11181150     * semantic attributes.
     
    11331165        // can't do an equals check on the internal keys array because it is not ordered
    11341166        //
    1135         return hasSameTags(other);
     1167        return hasSameInterestingTags(other);
    11361168    }
    11371169
  • trunk/src/org/openstreetmap/josm/data/validation/OsmValidator.java

    r6613 r6629  
    3636import org.openstreetmap.josm.data.validation.tests.MultipolygonTest;
    3737import org.openstreetmap.josm.data.validation.tests.NameMismatch;
    38 import org.openstreetmap.josm.data.validation.tests.NodesDuplicatingWayTags;
    3938import org.openstreetmap.josm.data.validation.tests.OpeningHourTest;
    4039import org.openstreetmap.josm.data.validation.tests.OverlappingWays;
     
    110109        DuplicateRelation.class, // ID 1901 .. 1999
    111110        WayConnectedToArea.class, // ID 2301 .. 2399
    112         NodesDuplicatingWayTags.class, // ID 2401 .. 2499
    113111        PowerLines.class, // ID 2501 .. 2599
    114112        Addresses.class, // ID 2601 .. 2699
Note: See TracChangeset for help on using the changeset viewer.