Changeset 5783 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2013-03-19T02:09:12+01:00 (12 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/WaySegment.java
r4327 r5783 5 5 * A segment consisting of 2 consecutive nodes out of a way. 6 6 */ 7 public final class WaySegment {7 public final class WaySegment implements Comparable<WaySegment> { 8 8 /** 9 9 * The way. … … 50 50 return way.hashCode() ^ lowerIndex; 51 51 } 52 53 @Override 54 public int compareTo(WaySegment o) { 55 return equals(o) ? 0 : toWay().compareTo(o.toWay()); 56 } 52 57 } -
trunk/src/org/openstreetmap/josm/data/validation/TestError.java
r5671 r5783 14 14 import org.openstreetmap.josm.data.osm.Way; 15 15 import org.openstreetmap.josm.data.osm.WaySegment; 16 import org.openstreetmap.josm.data.validation.util.MultipleNameVisitor; 16 17 17 18 /** … … 19 20 * @author frsantos 20 21 */ 21 public class TestError {22 public class TestError implements Comparable<TestError> { 22 23 /** is this error on the ignore list */ 23 24 private Boolean ignored = false; … … 277 278 return highlighted; 278 279 } 280 281 @Override 282 public int compareTo(TestError o) { 283 if (equals(o)) return 0; 284 285 MultipleNameVisitor v1 = new MultipleNameVisitor(); 286 MultipleNameVisitor v2 = new MultipleNameVisitor(); 287 288 v1.visit(getPrimitives()); 289 v2.visit(o.getPrimitives()); 290 return v1.toString().compareToIgnoreCase(v2.toString()); 291 } 279 292 } -
trunk/src/org/openstreetmap/josm/data/validation/tests/DuplicateRelation.java
r5667 r5783 7 7 import java.util.Collection; 8 8 import java.util.HashSet; 9 import java.util.LinkedHashSet;10 9 import java.util.LinkedList; 11 10 import java.util.List; 12 11 import java.util.Map; 12 import java.util.Set; 13 13 14 14 import org.openstreetmap.josm.command.ChangeCommand; … … 192 192 public void endTest() { 193 193 super.endTest(); 194 for (LinkedHashSet<OsmPrimitive> duplicated : relations.values()) {194 for (Set<OsmPrimitive> duplicated : relations.values()) { 195 195 if (duplicated.size() > 1) { 196 196 TestError testError = new TestError(this, Severity.ERROR, tr("Duplicated relations"), DUPLICATE_RELATION, duplicated); … … 199 199 } 200 200 relations = null; 201 for (LinkedHashSet<OsmPrimitive> duplicated : relations_nokeys.values()) {201 for (Set<OsmPrimitive> duplicated : relations_nokeys.values()) { 202 202 if (duplicated.size() > 1) { 203 203 TestError testError = new TestError(this, Severity.WARNING, tr("Relations with same members"), SAME_RELATION, duplicated); -
trunk/src/org/openstreetmap/josm/data/validation/tests/OverlappingWays.java
r4869 r5783 7 7 import java.util.Collection; 8 8 import java.util.HashMap; 9 import java.util.LinkedHashSet;10 9 import java.util.List; 11 10 import java.util.Map; 11 import java.util.Set; 12 12 13 13 import org.openstreetmap.josm.data.osm.Node; … … 56 56 @Override 57 57 public void endTest() { 58 Map<List<Way>, LinkedHashSet<WaySegment>> ways_seen = new HashMap<List<Way>, LinkedHashSet<WaySegment>>(500);58 Map<List<Way>, Set<WaySegment>> ways_seen = new HashMap<List<Way>, Set<WaySegment>>(500); 59 59 60 for ( LinkedHashSet<WaySegment> duplicated : nodePairs.values()) {60 for (Set<WaySegment> duplicated : nodePairs.values()) { 61 61 int ways = duplicated.size(); 62 62 -
trunk/src/org/openstreetmap/josm/gui/dialogs/validator/ValidatorTreePanel.java
r5672 r5783 9 9 import java.util.HashMap; 10 10 import java.util.HashSet; 11 import java.util.LinkedHashSet;12 11 import java.util.List; 13 12 import java.util.Map; … … 206 205 } 207 206 208 for (Entry<String, LinkedHashSet<TestError>> msgErrors : severityErrors.entrySet()) {207 for (Entry<String, Set<TestError>> msgErrors : severityErrors.entrySet()) { 209 208 // Message node 210 209 Set<TestError> errs = msgErrors.getValue(); … … 236 235 } 237 236 238 for (Entry<String, LinkedHashSet<TestError>> msgErrors : errorlist.entrySet()) {237 for (Entry<String, Set<TestError>> msgErrors : errorlist.entrySet()) { 239 238 // Message node 240 239 Set<TestError> errs = msgErrors.getValue(); -
trunk/src/org/openstreetmap/josm/tools/MultiMap.java
r4685 r5783 5 5 import java.util.Collection; 6 6 import java.util.HashMap; 7 import java.util.LinkedHashSet;8 7 import java.util.List; 9 8 import java.util.Map; 10 9 import java.util.Map.Entry; 11 10 import java.util.Set; 11 import java.util.TreeSet; 12 12 13 13 /** … … 20 20 public class MultiMap<A, B> { 21 21 22 private final Map<A, LinkedHashSet<B>> map;22 private final Map<A, Set<B>> map; 23 23 24 24 public MultiMap() { 25 map = new HashMap<A, LinkedHashSet<B>>();25 map = new HashMap<A, Set<B>>(); 26 26 } 27 27 28 28 public MultiMap(int capacity) { 29 map = new HashMap<A, LinkedHashSet<B>>(capacity);29 map = new HashMap<A, Set<B>>(capacity); 30 30 } 31 31 … … 36 36 */ 37 37 public void put(A key, B value) { 38 LinkedHashSet<B> vals = map.get(key);38 Set<B> vals = map.get(key); 39 39 if (vals == null) { 40 vals = new LinkedHashSet<B>();40 vals = new TreeSet<B>(); 41 41 map.put(key, vals); 42 42 } … … 53 53 if (map.containsKey(key)) 54 54 return; 55 map.put(key, new LinkedHashSet<B>());55 map.put(key, new TreeSet<B>()); 56 56 } 57 57 … … 62 62 */ 63 63 public void putAll(A key, Collection<B> values) { 64 LinkedHashSet<B> vals = map.get(key);64 Set<B> vals = map.get(key); 65 65 if (vals == null) { 66 vals = new LinkedHashSet<B>(values);66 vals = new TreeSet<B>(values); 67 67 map.put(key, vals); 68 68 } … … 91 91 * Like get, but returns an empty Set if nothing has been mapped to the key. 92 92 */ 93 public LinkedHashSet<B> getValues(A key) {93 public Set<B> getValues(A key) { 94 94 if (!map.containsKey(key)) 95 return new LinkedHashSet<B>();95 return new TreeSet<B>(); 96 96 return map.get(key); 97 97 } … … 121 121 } 122 122 123 public Set<Entry<A, LinkedHashSet<B>>> entrySet() {123 public Set<Entry<A, Set<B>>> entrySet() { 124 124 return map.entrySet(); 125 125 } … … 135 135 * Returns a collection of all value sets. 136 136 */ 137 public Collection< LinkedHashSet<B>> values() {137 public Collection<Set<B>> values() { 138 138 return map.values(); 139 139 } … … 155 155 * Removes all mappings for a certain key. 156 156 */ 157 public LinkedHashSet<B> remove(A key) {157 public Set<B> remove(A key) { 158 158 return map.remove(key); 159 159 } 160 160 161 @Override 161 162 public String toString() { 162 163 List<String> entries = new ArrayList<String>(map.size());
Note:
See TracChangeset
for help on using the changeset viewer.