Changeset 6629 in josm for trunk/src/org/openstreetmap/josm/data
- Timestamp:
- 2014-01-05T12:03:37+01:00 (11 years ago)
- 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 671 671 672 672 /** 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 primitive676 * @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 key680 // but we can at least check if both arrays are null or of the same size before creating681 // 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 /**687 673 * What to do, when the tags have changed by one of the tag-changing methods. 688 674 */ -
trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java
r6491 r6629 10 10 import java.util.Collections; 11 11 import java.util.Date; 12 import java.util.HashMap; 12 13 import java.util.HashSet; 13 14 import java.util.LinkedHashSet; … … 726 727 } 727 728 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 728 745 private static volatile Match directionKeys = null; 729 746 private static volatile Match reversedDirectionKeys = null; … … 1115 1132 1116 1133 /** 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 /** 1117 1149 * Replies true if this primitive and other are equal with respect to their 1118 1150 * semantic attributes. … … 1133 1165 // can't do an equals check on the internal keys array because it is not ordered 1134 1166 // 1135 return hasSameTags(other); 1167 return hasSameInterestingTags(other); 1136 1168 } 1137 1169 -
trunk/src/org/openstreetmap/josm/data/validation/OsmValidator.java
r6613 r6629 36 36 import org.openstreetmap.josm.data.validation.tests.MultipolygonTest; 37 37 import org.openstreetmap.josm.data.validation.tests.NameMismatch; 38 import org.openstreetmap.josm.data.validation.tests.NodesDuplicatingWayTags;39 38 import org.openstreetmap.josm.data.validation.tests.OpeningHourTest; 40 39 import org.openstreetmap.josm.data.validation.tests.OverlappingWays; … … 110 109 DuplicateRelation.class, // ID 1901 .. 1999 111 110 WayConnectedToArea.class, // ID 2301 .. 2399 112 NodesDuplicatingWayTags.class, // ID 2401 .. 2499113 111 PowerLines.class, // ID 2501 .. 2599 114 112 Addresses.class, // ID 2601 .. 2699
Note:
See TracChangeset
for help on using the changeset viewer.