Changeset 7005 in josm for trunk/src/org/openstreetmap/josm/data/validation
- Timestamp:
- 2014-04-26T17:39:23+02:00 (10 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/data/validation
- Files:
-
- 30 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/validation/OsmValidator.java
r6995 r7005 77 77 public static double griddetail; 78 78 79 public static final Collection<String> ignoredErrors = new TreeSet< String>();79 public static final Collection<String> ignoredErrors = new TreeSet<>(); 80 80 81 81 /** … … 124 124 private static Map<String, Test> allTestsMap; 125 125 static { 126 allTestsMap = new HashMap< String, Test>();126 allTestsMap = new HashMap<>(); 127 127 for (Class<Test> testClass : allAvailableTests) { 128 128 try { … … 226 226 applyPrefs(allTestsMap, false); 227 227 applyPrefs(allTestsMap, true); 228 return new TreeMap< String, Test>(allTestsMap);228 return new TreeMap<>(allTestsMap); 229 229 } 230 230 … … 263 263 public static Collection<Test> getEnabledTests(boolean beforeUpload) { 264 264 Collection<Test> enabledTests = getTests(); 265 for (Test t : new ArrayList< Test>(enabledTests)) {265 for (Test t : new ArrayList<>(enabledTests)) { 266 266 if (beforeUpload ? t.testBeforeUpload : t.enabled) { 267 267 continue; -
trunk/src/org/openstreetmap/josm/data/validation/PaintVisitor.java
r6009 r7005 34 34 private boolean selected; 35 35 36 private final Set<PaintedPoint> paintedPoints = new HashSet< PaintedPoint>();37 private final Set<PaintedSegment> paintedSegments = new HashSet< PaintedSegment>();36 private final Set<PaintedPoint> paintedPoints = new HashSet<>(); 37 private final Set<PaintedSegment> paintedSegments = new HashSet<>(); 38 38 39 39 /** -
trunk/src/org/openstreetmap/josm/data/validation/Test.java
r6990 r7005 58 58 59 59 /** The list of errors */ 60 protected List<TestError> errors = new ArrayList< TestError>(30);60 protected List<TestError> errors = new ArrayList<>(30); 61 61 62 62 /** Whether the test is run on a partial selection data */ … … 152 152 this.progressMonitor.beginTask(startMessage); 153 153 Main.debug(startMessage); 154 this.errors = new ArrayList< TestError>(30);154 this.errors = new ArrayList<>(30); 155 155 this.startTime = System.currentTimeMillis(); 156 156 } … … 307 307 */ 308 308 protected final Command deletePrimitivesIfNeeded(Collection<? extends OsmPrimitive> primitives) { 309 Collection<OsmPrimitive> primitivesToDelete = new ArrayList< OsmPrimitive>();309 Collection<OsmPrimitive> primitivesToDelete = new ArrayList<>(); 310 310 for (OsmPrimitive p : primitives) { 311 311 if (!p.isDeleted()) { -
trunk/src/org/openstreetmap/josm/data/validation/TestError.java
r6804 r7005 133 133 */ 134 134 public Collection<? extends OsmPrimitive> getSelectablePrimitives() { 135 List<OsmPrimitive> selectablePrimitives = new ArrayList< OsmPrimitive>(primitives.size());135 List<OsmPrimitive> selectablePrimitives = new ArrayList<>(primitives.size()); 136 136 for (OsmPrimitive o : primitives) { 137 137 if (o.isSelectable()) { … … 170 170 */ 171 171 public String getIgnoreState() { 172 Collection<String> strings = new TreeSet< String>();172 Collection<String> strings = new TreeSet<>(); 173 173 StringBuilder ignorestring = new StringBuilder(getIgnoreSubGroup()); 174 174 for (OsmPrimitive o : primitives) { -
trunk/src/org/openstreetmap/josm/data/validation/tests/Addresses.java
r6826 r7005 117 117 if (r.hasTag("type", ASSOCIATED_STREET)) { 118 118 // Used to count occurences of each house number in order to find duplicates 119 Map<String, List<OsmPrimitive>> map = new HashMap< String, List<OsmPrimitive>>();119 Map<String, List<OsmPrimitive>> map = new HashMap<>(); 120 120 // Used to detect different street names 121 121 String relationName = r.get("name"); 122 Set<OsmPrimitive> wrongStreetNames = new HashSet< OsmPrimitive>();122 Set<OsmPrimitive> wrongStreetNames = new HashSet<>(); 123 123 // Used to check distance 124 Set<OsmPrimitive> houses = new HashSet< OsmPrimitive>();125 Set<Way> street = new HashSet< Way>();124 Set<OsmPrimitive> houses = new HashSet<>(); 125 Set<Way> street = new HashSet<>(); 126 126 for (RelationMember m : r.getMembers()) { 127 127 String role = m.getRole(); … … 134 134 List<OsmPrimitive> list = map.get(number); 135 135 if (list == null) { 136 map.put(number, list = new ArrayList< OsmPrimitive>());136 map.put(number, list = new ArrayList<>()); 137 137 } 138 138 list.add(p); -
trunk/src/org/openstreetmap/josm/data/validation/tests/Coastlines.java
r6475 r7005 59 59 } 60 60 61 coastlines = new LinkedList< Way>();61 coastlines = new LinkedList<>(); 62 62 } 63 63 … … 145 145 } 146 146 147 List<OsmPrimitive> primitives = new ArrayList< OsmPrimitive>();147 List<OsmPrimitive> primitives = new ArrayList<>(); 148 148 primitives.add(c1); 149 149 150 150 if (headWays == 0 || tailWays == 0) { 151 List<OsmPrimitive> highlight = new ArrayList< OsmPrimitive>();151 List<OsmPrimitive> highlight = new ArrayList<>(); 152 152 153 153 if (headWays == 0 && head.getCoor().isIn(downloadedArea)) { … … 178 178 179 179 if (unordered) { 180 List<OsmPrimitive> highlight = new ArrayList< OsmPrimitive>();180 List<OsmPrimitive> highlight = new ArrayList<>(); 181 181 182 182 if (headWays > 1 || headUnordered || headReversed || reversed) { -
trunk/src/org/openstreetmap/josm/data/validation/tests/ConditionalKeys.java
r6625 r7005 23 23 24 24 final OpeningHourTest openingHourTest = new OpeningHourTest(); 25 static final Set<String> RESTRICTION_TYPES = new HashSet< String>(Arrays.asList("oneway", "toll", "noexit", "maxspeed", "minspeed",25 static final Set<String> RESTRICTION_TYPES = new HashSet<>(Arrays.asList("oneway", "toll", "noexit", "maxspeed", "minspeed", 26 26 "maxweight", "maxaxleload", "maxheight", "maxwidth", "maxlength", "overtaking", "maxgcweight", "maxgcweightrating", "fee")); 27 static final Set<String> RESTRICTION_VALUES = new HashSet< String>(Arrays.asList("yes", "official", "designated", "destination",27 static final Set<String> RESTRICTION_VALUES = new HashSet<>(Arrays.asList("yes", "official", "designated", "destination", 28 28 "delivery", "permissive", "private", "agricultural", "forestry", "no")); 29 static final Set<String> TRANSPORT_MODES = new HashSet< String>(Arrays.asList("access", "foot", "ski", "inline_skates", "ice_skates",29 static final Set<String> TRANSPORT_MODES = new HashSet<>(Arrays.asList("access", "foot", "ski", "inline_skates", "ice_skates", 30 30 "horse", "vehicle", "bicycle", "carriage", "trailer", "caravan", "motor_vehicle", "motorcycle", "moped", "mofa", 31 31 "motorcar", "motorhome", "psv", "bus", "taxi", "tourist_bus", "goods", "hgv", "agricultural", "atv", "snowmobile" 32 32 /*,"hov","emergency","hazmat","disabled"*/)); 33 33 34 /** 35 * Constructs a new {@code ConditionalKeys}. 36 */ 34 37 public ConditionalKeys() { 35 38 super(tr("Conditional Keys"), tr("Tests for the correct usage of ''*:conditional'' tags.")); … … 94 97 public static List<ConditionalValue> parse(String value) throws ConditionalParsingException { 95 98 // <restriction-value> @ <condition>[;<restriction-value> @ <condition>] 96 final List<ConditionalValue> r = new ArrayList< ConditionalValue>();99 final List<ConditionalValue> r = new ArrayList<>(); 97 100 final Pattern part = Pattern.compile("([^@\\p{Space}][^@]*?)" + "\\s*@\\s*" + "(\\([^)\\p{Space}][^)]+?\\)|[^();\\p{Space}][^();]*?)\\s*"); 98 101 final Matcher m = Pattern.compile("(" + part + ")(;\\s*" + part + ")*").matcher(value); … … 137 140 138 141 public List<TestError> validatePrimitive(OsmPrimitive p) { 139 final List<TestError> errors = new ArrayList< TestError>();142 final List<TestError> errors = new ArrayList<>(); 140 143 for (final String key : Utils.filter(p.keySet(), Predicates.stringMatchesPattern(Pattern.compile(".*:conditional$")))) { 141 144 if (!isKeyValid(key)) { -
trunk/src/org/openstreetmap/josm/data/validation/tests/CrossingWays.java
r6869 r7005 185 185 public void startTest(ProgressMonitor monitor) { 186 186 super.startTest(monitor); 187 cellSegments = new HashMap< Point2D,List<WaySegment>>(1000);188 errorSegments = new HashSet< WaySegment>();189 seenWays = new HashMap< List<Way>, List<WaySegment>>(50);187 cellSegments = new HashMap<>(1000); 188 errorSegments = new HashSet<>(); 189 seenWays = new HashMap<>(50); 190 190 } 191 191 … … 247 247 prims = Arrays.asList(es1.way, es2.way); 248 248 if ((highlight = seenWays.get(prims)) == null) { 249 highlight = new ArrayList< WaySegment>();249 highlight = new ArrayList<>(); 250 250 highlight.add(es1); 251 251 highlight.add(es2); … … 278 278 public List<List<WaySegment>> getSegments(EastNorth n1, EastNorth n2) { 279 279 280 List<List<WaySegment>> cells = new ArrayList< List<WaySegment>>();280 List<List<WaySegment>> cells = new ArrayList<>(); 281 281 for (Point2D cell : ValUtil.getSegmentCells(n1, n2, OsmValidator.griddetail)) { 282 282 List<WaySegment> segments = cellSegments.get(cell); 283 283 if (segments == null) { 284 segments = new ArrayList< WaySegment>();284 segments = new ArrayList<>(); 285 285 cellSegments.put(cell, segments); 286 286 } -
trunk/src/org/openstreetmap/josm/data/validation/tests/DuplicateNode.java
r6883 r7005 118 118 public void startTest(ProgressMonitor monitor) { 119 119 super.startTest(monitor); 120 potentialDuplicates = new Storage< Object>(new NodeHash());120 potentialDuplicates = new Storage<>(new NodeHash()); 121 121 } 122 122 … … 133 133 // multiple nodes at the same position -> check if all nodes have a distinct elevation 134 134 List<Node> nodes = (List<Node>) v; 135 Set<String> eles = new HashSet< String>();135 Set<String> eles = new HashSet<>(); 136 136 for (Node n : nodes) { 137 137 String ele = n.get("ele"); … … 161 161 */ 162 162 public List<TestError> buildTestErrors(Test parentTest, List<Node> nodes) { 163 List<TestError> errors = new ArrayList< TestError>();164 165 MultiMap<Map<String,String>, OsmPrimitive> mm = new MultiMap< Map<String,String>, OsmPrimitive>();163 List<TestError> errors = new ArrayList<>(); 164 165 MultiMap<Map<String,String>, OsmPrimitive> mm = new MultiMap<>(); 166 166 for (Node n: nodes) { 167 167 mm.put(n.getKeys(), n); 168 168 } 169 169 170 Map<String,Boolean> typeMap=new HashMap< String,Boolean>();170 Map<String,Boolean> typeMap=new HashMap<>(); 171 171 String[] types = {"none", "highway", "railway", "waterway", "boundary", "power", "natural", "landuse", "building"}; 172 172 … … 334 334 // 335 335 if (!mm.isEmpty()) { 336 List<OsmPrimitive> duplicates = new ArrayList< OsmPrimitive>();336 List<OsmPrimitive> duplicates = new ArrayList<>(); 337 337 for (Set<OsmPrimitive> l: mm.values()) { 338 338 duplicates.addAll(l); … … 365 365 // 366 366 Node n1 = (Node)potentialDuplicates.get(n); 367 List<Node> nodes = new ArrayList< Node>(2);367 List<Node> nodes = new ArrayList<>(2); 368 368 nodes.add(n1); 369 369 nodes.add(n); … … 385 385 public Command fixError(TestError testError) { 386 386 if (!isFixable(testError)) return null; 387 Collection<OsmPrimitive> sel = new LinkedList< OsmPrimitive>(testError.getPrimitives());388 LinkedHashSet<Node> nodes = new LinkedHashSet< Node>(OsmPrimitive.getFilteredList(sel, Node.class));387 Collection<OsmPrimitive> sel = new LinkedList<>(testError.getPrimitives()); 388 LinkedHashSet<Node> nodes = new LinkedHashSet<>(OsmPrimitive.getFilteredList(sel, Node.class)); 389 389 390 390 // Filter nodes that have already been deleted (see #5764 and #5773) -
trunk/src/org/openstreetmap/josm/data/validation/tests/DuplicateRelation.java
r6494 r7005 72 72 type = src.getType(); 73 73 relId = 0; 74 coor = new ArrayList< LatLon>();74 coor = new ArrayList<>(); 75 75 76 76 if (src.isNode()) { 77 77 Node r = src.getNode(); 78 78 tags = r.getKeys(); 79 coor = new ArrayList< LatLon>(1);79 coor = new ArrayList<>(1); 80 80 coor.add(r.getCoor()); 81 81 } … … 84 84 tags = r.getKeys(); 85 85 List<Node> wNodes = r.getNodes(); 86 coor = new ArrayList< LatLon>(wNodes.size());86 coor = new ArrayList<>(wNodes.size()); 87 87 for (Node wNode : wNodes) { 88 88 coor.add(wNode.getCoor()); … … 93 93 tags = r.getKeys(); 94 94 relId = r.getId(); 95 coor = new ArrayList< LatLon>();95 coor = new ArrayList<>(); 96 96 } 97 97 } … … 109 109 */ 110 110 public RelationMembers(List<RelationMember> members) { 111 this.members = new ArrayList< RelMember>(members.size());111 this.members = new ArrayList<>(members.size()); 112 112 for (RelationMember member : members) { 113 113 this.members.add(new RelMember(member)); … … 172 172 173 173 /** List of keys without useful information */ 174 private final Set<String> ignoreKeys = new HashSet< String>(OsmPrimitive.getUninterestingKeys());174 private final Set<String> ignoreKeys = new HashSet<>(OsmPrimitive.getUninterestingKeys()); 175 175 176 176 /** … … 185 185 public void startTest(ProgressMonitor monitor) { 186 186 super.startTest(monitor); 187 relations = new MultiMap< RelationPair, OsmPrimitive>(1000);188 relations_nokeys = new MultiMap< List<RelationMember>, OsmPrimitive>(1000);187 relations = new MultiMap<>(1000); 188 relations_nokeys = new MultiMap<>(1000); 189 189 } 190 190 … … 229 229 if (testError.getCode() == SAME_RELATION) return null; 230 230 Collection<? extends OsmPrimitive> sel = testError.getPrimitives(); 231 HashSet<Relation> relFix = new HashSet< Relation>();231 HashSet<Relation> relFix = new HashSet<>(); 232 232 233 233 for (OsmPrimitive osm : sel) … … 263 263 } 264 264 265 Collection<Command> commands = new LinkedList< Command>();265 Collection<Command> commands = new LinkedList<>(); 266 266 267 267 // Fix relations. … … 292 292 // We fix it only if there is no more than one relation that is relation member. 293 293 Collection<? extends OsmPrimitive> sel = testError.getPrimitives(); 294 HashSet<Relation> relations = new HashSet< Relation>();294 HashSet<Relation> relations = new HashSet<>(); 295 295 296 296 for (OsmPrimitive osm : sel) -
trunk/src/org/openstreetmap/josm/data/validation/tests/DuplicateWay.java
r6494 r7005 107 107 public void startTest(ProgressMonitor monitor) { 108 108 super.startTest(monitor); 109 ways = new MultiMap< WayPair, OsmPrimitive>(1000);110 waysNoTags = new MultiMap< WayPairNoTags, OsmPrimitive>(1000);111 knownHashCodes = new HashSet< Integer>(1000);109 ways = new MultiMap<>(1000); 110 waysNoTags = new MultiMap<>(1000); 111 knownHashCodes = new HashSet<>(1000); 112 112 } 113 113 … … 168 168 return; 169 169 List<Node> wNodes = w.getNodes(); // The original list of nodes for this way 170 List<Node> wNodesToUse = new ArrayList< Node>(wNodes.size()); // The list that will be considered for this test170 List<Node> wNodesToUse = new ArrayList<>(wNodes.size()); // The list that will be considered for this test 171 171 if (w.isClosed()) { 172 172 // In case of a closed way, build the list of lat/lon starting from the node with the lowest id … … 192 192 } 193 193 // Build the list of lat/lon 194 List<LatLon> wLat = new ArrayList< LatLon>(wNodesToUse.size());194 List<LatLon> wLat = new ArrayList<>(wNodesToUse.size()); 195 195 for (Node node : wNodesToUse) { 196 196 wLat.add(node.getCoor()); … … 200 200 int hash = wLat.hashCode(); 201 201 if (!knownHashCodes.contains(hash)) { 202 List<LatLon> reversedwLat = new ArrayList< LatLon>(wLat);202 List<LatLon> reversedwLat = new ArrayList<>(wLat); 203 203 Collections.reverse(reversedwLat); 204 204 int reverseHash = reversedwLat.hashCode(); … … 226 226 public Command fixError(TestError testError) { 227 227 Collection<? extends OsmPrimitive> sel = testError.getPrimitives(); 228 HashSet<Way> ways = new HashSet< Way>();228 HashSet<Way> ways = new HashSet<>(); 229 229 230 230 for (OsmPrimitive osm : sel) { … … 261 261 } 262 262 263 Collection<Command> commands = new LinkedList< Command>();263 Collection<Command> commands = new LinkedList<>(); 264 264 265 265 // Fix relations. … … 294 294 // We fix it only if there is no more than one way that is relation member. 295 295 Collection<? extends OsmPrimitive> sel = testError.getPrimitives(); 296 HashSet<Way> ways = new HashSet< Way>();296 HashSet<Way> ways = new HashSet<>(); 297 297 298 298 for (OsmPrimitive osm : sel) { -
trunk/src/org/openstreetmap/josm/data/validation/tests/Highways.java
r6937 r7005 111 111 112 112 private void testWrongRoundabout(Way w) { 113 Map<String, List<Way>> map = new HashMap< String, List<Way>>();113 Map<String, List<Way>> map = new HashMap<>(); 114 114 // Count all highways (per type) connected to this roundabout, except links 115 115 // As roundabouts are closed ways, take care of not processing the first/last node twice 116 for (Node n : new HashSet< Node>(w.getNodes())) {116 for (Node n : new HashSet<>(w.getNodes())) { 117 117 for (Way h : Utils.filteredCollection(n.getReferrers(), Way.class)) { 118 118 String value = h.get("highway"); … … 120 120 List<Way> list = map.get(value); 121 121 if (list == null) { 122 map.put(value, list = new ArrayList< Way>());122 map.put(value, list = new ArrayList<>()); 123 123 } 124 124 list.add(h); … … 150 150 } 151 151 152 final HashSet<OsmPrimitive> referrers = new HashSet< OsmPrimitive>();152 final HashSet<OsmPrimitive> referrers = new HashSet<>(); 153 153 referrers.addAll(way.firstNode().getReferrers()); 154 154 referrers.addAll(way.lastNode().getReferrers()); -
trunk/src/org/openstreetmap/josm/data/validation/tests/Lanes.java
r6834 r7005 41 41 return; 42 42 } 43 final Set<Integer> lanesCount = new HashSet< Integer>(Utils.transform(keysForPattern, new Utils.Function<String, Integer>() {43 final Set<Integer> lanesCount = new HashSet<>(Utils.transform(keysForPattern, new Utils.Function<String, Integer>() { 44 44 @Override 45 45 public Integer apply(String key) { -
trunk/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagChecker.java
r6986 r7005 69 69 } 70 70 71 final List<TagCheck> checks = new ArrayList< TagCheck>();71 final List<TagCheck> checks = new ArrayList<>(); 72 72 73 73 static class TagCheck implements Predicate<OsmPrimitive> { 74 74 protected final MapCSSRule rule; 75 protected final List<PrimitiveToTag> change = new ArrayList< PrimitiveToTag>();76 protected final Map<String, String> keyChange = new LinkedHashMap< String, String>();77 protected final List<String> alternatives = new ArrayList< String>();78 protected final Map<Instruction.AssignmentInstruction, Severity> errors = new HashMap< Instruction.AssignmentInstruction, Severity>();79 protected final Map<String, Boolean> assertions = new HashMap< String, Boolean>();75 protected final List<PrimitiveToTag> change = new ArrayList<>(); 76 protected final Map<String, String> keyChange = new LinkedHashMap<>(); 77 protected final List<String> alternatives = new ArrayList<>(); 78 protected final Map<Instruction.AssignmentInstruction, Severity> errors = new HashMap<>(); 79 protected final Map<String, Boolean> assertions = new HashMap<>(); 80 80 81 81 TagCheck(MapCSSRule rule) { … … 180 180 // Ignore "meta" rule(s) from external rules of JOSM wiki 181 181 removeMetaRules(source); 182 return new ArrayList< TagCheck>(Utils.transform(source.rules, new Utils.Function<MapCSSRule, TagCheck>() {182 return new ArrayList<>(Utils.transform(source.rules, new Utils.Function<MapCSSRule, TagCheck>() { 183 183 @Override 184 184 public TagCheck apply(MapCSSRule x) { … … 297 297 } 298 298 final Selector matchingSelector = whichSelectorMatchesPrimitive(p); 299 Collection<Command> cmds = new LinkedList< Command>();299 Collection<Command> cmds = new LinkedList<>(); 300 300 for (PrimitiveToTag toTag : change) { 301 301 final Tag tag = toTag.apply(p); … … 416 416 */ 417 417 public Collection<TestError> getErrorsForPrimitive(OsmPrimitive p, boolean includeOtherSeverity) { 418 final ArrayList<TestError> r = new ArrayList< TestError>();418 final ArrayList<TestError> r = new ArrayList<>(); 419 419 final Environment env = new Environment(p, new MultiCascade(), Environment.DEFAULT_LAYER, null); 420 420 for (TagCheck check : checks) { -
trunk/src/org/openstreetmap/josm/data/validation/tests/MultipolygonTest.java
r6731 r7005 57 57 private static ElemStyles styles; 58 58 59 private final List<List<Node>> nonClosedWays = new ArrayList< List<Node>>();60 private final Set<String> keysCheckedByAnotherTest = new HashSet< String>();59 private final List<List<Node>> nonClosedWays = new ArrayList<>(); 60 private final Set<String> keysCheckedByAnotherTest = new HashSet<>(); 61 61 62 62 /** … … 92 92 93 93 private List<List<Node>> joinWays(Collection<Way> ways) { 94 List<List<Node>> result = new ArrayList< List<Node>>();95 List<Way> waysToJoin = new ArrayList< Way>();94 List<List<Node>> result = new ArrayList<>(); 95 List<Way> waysToJoin = new ArrayList<>(); 96 96 for (Way way : ways) { 97 97 if (way.isClosed()) { … … 123 123 124 124 private List<GeneralPath> createPolygons(List<List<Node>> joinedWays) { 125 List<GeneralPath> result = new ArrayList< GeneralPath>();125 List<GeneralPath> result = new ArrayList<>(); 126 126 for (List<Node> way : joinedWays) { 127 127 result.add(createPath(way)); … … 229 229 230 230 if (areaInner != null && area.equals(areaInner)) { 231 List<OsmPrimitive> l = new ArrayList< OsmPrimitive>();231 List<OsmPrimitive> l = new ArrayList<>(); 232 232 l.add(r); 233 233 l.add(wInner); … … 240 240 AreaElemStyle areaOuter = ElemStyles.getAreaElemStyle(wOuter, false); 241 241 if (areaOuter != null && !area.equals(areaOuter)) { 242 List<OsmPrimitive> l = new ArrayList< OsmPrimitive>();242 List<OsmPrimitive> l = new ArrayList<>(); 243 243 l.add(r); 244 244 l.add(wOuter); … … 251 251 } 252 252 253 List<Node> openNodes = new LinkedList< Node>();253 List<Node> openNodes = new LinkedList<>(); 254 254 for (List<Node> w : nonClosedWays) { 255 255 if (w.size()<1) continue; … … 258 258 } 259 259 if (!openNodes.isEmpty()) { 260 List<OsmPrimitive> primitives = new LinkedList< OsmPrimitive>();260 List<OsmPrimitive> primitives = new LinkedList<>(); 261 261 primitives.add(r); 262 262 primitives.addAll(openNodes); … … 282 282 } 283 283 if (outside || crossing) { 284 List<List<Node>> highlights = new ArrayList< List<Node>>();284 List<List<Node>> highlights = new ArrayList<>(); 285 285 highlights.add(pdInner); 286 286 if (outside) { … … 319 319 } 320 320 } 321 List<OsmPrimitive> newPrimitives = new ArrayList< OsmPrimitive>(primitives);321 List<OsmPrimitive> newPrimitives = new ArrayList<>(primitives); 322 322 newPrimitives.add(0, r); 323 323 error.setPrimitives(newPrimitives); -
trunk/src/org/openstreetmap/josm/data/validation/tests/NameMismatch.java
r6823 r7005 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 5 6 import java.util.Collection;7 6 import java.util.HashSet; 8 7 import java.util.Map.Entry; … … 61 60 @Override 62 61 public void check(OsmPrimitive p) { 63 HashSet<String> names = new HashSet< String>();62 HashSet<String> names = new HashSet<>(); 64 63 65 64 for (Entry<String, String> entry : p.getKeys().entrySet()) { -
trunk/src/org/openstreetmap/josm/data/validation/tests/OpeningHourTest.java
r7004 r7005 191 191 return Collections.emptyList(); 192 192 } 193 final List<OpeningHoursTestError> errors = new ArrayList< OpeningHoursTestError>();193 final List<OpeningHoursTestError> errors = new ArrayList<>(); 194 194 try { 195 195 final Object r = parse(value, mode); -
trunk/src/org/openstreetmap/josm/data/validation/tests/OverlappingWays.java
r6940 r7005 64 64 public void startTest(ProgressMonitor monitor) { 65 65 super.startTest(monitor); 66 nodePairs = new MultiMap< Pair<Node,Node>, WaySegment>(1000);66 nodePairs = new MultiMap<>(1000); 67 67 } 68 68 … … 78 78 @Override 79 79 public void endTest() { 80 Map<List<Way>, Set<WaySegment>> seenWays = new HashMap< List<Way>, Set<WaySegment>>(500);81 82 Collection<TestError> preliminaryErrors = new ArrayList< TestError>();80 Map<List<Way>, Set<WaySegment>> seenWays = new HashMap<>(500); 81 82 Collection<TestError> preliminaryErrors = new ArrayList<>(); 83 83 for (Set<WaySegment> duplicated : nodePairs.values()) { 84 84 int ways = duplicated.size(); 85 85 86 86 if (ways > 1) { 87 List<OsmPrimitive> prims = new ArrayList< OsmPrimitive>();88 List<Way> currentWays = new ArrayList< Way>();87 List<OsmPrimitive> prims = new ArrayList<>(); 88 List<Way> currentWays = new ArrayList<>(); 89 89 Collection<WaySegment> highlight; 90 90 int highway = 0; … … 178 178 protected static Set<WaySegment> checkDuplicateWaySegment(Way w) { 179 179 // test for ticket #4959 180 Set<WaySegment> segments = new TreeSet< WaySegment>(new Comparator<WaySegment>() {180 Set<WaySegment> segments = new TreeSet<>(new Comparator<WaySegment>() { 181 181 @Override 182 182 public int compare(WaySegment o1, WaySegment o2) { … … 190 190 } 191 191 }); 192 final Set<WaySegment> duplicateWaySegments = new HashSet< WaySegment>();192 final Set<WaySegment> duplicateWaySegments = new HashSet<>(); 193 193 194 194 for (int i = 0; i < w.getNodesCount() - 1; i++) { … … 224 224 continue; 225 225 } 226 nodePairs.put(Pair.sort(new Pair< Node,Node>(lastN, n)),226 nodePairs.put(Pair.sort(new Pair<>(lastN, n)), 227 227 new WaySegment(w, i)); 228 228 lastN = n; -
trunk/src/org/openstreetmap/josm/data/validation/tests/PowerLines.java
r6903 r7005 45 45 public static final Collection<String> POWER_ALLOWED_TAGS = Arrays.asList("switch", "transformer", "busbar", "generator"); 46 46 47 private final Map<Way, String> towerPoleTagMap = new HashMap< Way, String>();48 49 private final List<PowerLineError> potentialErrors = new ArrayList< PowerLineError>();50 51 private final List<OsmPrimitive> powerStations = new ArrayList< OsmPrimitive>();47 private final Map<Way, String> towerPoleTagMap = new HashMap<>(); 48 49 private final List<PowerLineError> potentialErrors = new ArrayList<>(); 50 51 private final List<OsmPrimitive> powerStations = new ArrayList<>(); 52 52 53 53 /** … … 118 118 protected final boolean isInPowerStation(Node n) { 119 119 for (OsmPrimitive station : powerStations) { 120 List<List<Node>> nodesLists = new ArrayList< List<Node>>();120 List<List<Node>> nodesLists = new ArrayList<>(); 121 121 if (station instanceof Way) { 122 122 nodesLists.add(((Way)station).getNodes()); -
trunk/src/org/openstreetmap/josm/data/validation/tests/RelationChecker.java
r6863 r7005 65 65 } 66 66 67 private static Collection<TaggingPreset> relationpresets = new LinkedList< TaggingPreset>();67 private static Collection<TaggingPreset> relationpresets = new LinkedList<>(); 68 68 69 69 /** … … 87 87 private static class RoleInfo { 88 88 private int total = 0; 89 private Collection<Node> nodes = new LinkedList< Node>();90 private Collection<Way> ways = new LinkedList< Way>();91 private Collection<Way> openways = new LinkedList< Way>();92 private Collection<Relation> relations = new LinkedList< Relation>();89 private Collection<Node> nodes = new LinkedList<>(); 90 private Collection<Way> ways = new LinkedList<>(); 91 private Collection<Way> openways = new LinkedList<>(); 92 private Collection<Relation> relations = new LinkedList<>(); 93 93 } 94 94 … … 96 96 @Override 97 97 public void visit(Relation n) { 98 LinkedList<Role> allroles = new LinkedList< Role>();98 LinkedList<Role> allroles = new LinkedList<>(); 99 99 for (TaggingPreset p : relationpresets) { 100 100 boolean matches = true; … … 124 124 RELATION_UNKNOWN, n) ); 125 125 } else { 126 HashMap<String,RoleInfo> map = new HashMap< String, RoleInfo>();126 HashMap<String,RoleInfo> map = new HashMap<>(); 127 127 for (RelationMember m : n.getMembers()) { 128 128 String s = ""; … … 152 152 RELATION_EMPTY, n) ); 153 153 } else { 154 LinkedList<String> done = new LinkedList< String>();154 LinkedList<String> done = new LinkedList<>(); 155 155 for (Role r : allroles) { 156 156 done.add(r.key); … … 180 180 if (ri != null) { 181 181 if (r.types != null) { 182 Set<OsmPrimitive> wrongTypes = new HashSet< OsmPrimitive>();182 Set<OsmPrimitive> wrongTypes = new HashSet<>(); 183 183 if (!r.types.contains(TaggingPresetType.WAY)) { 184 184 wrongTypes.addAll(r.types.contains(TaggingPresetType.CLOSEDWAY) ? ri.openways : ri.ways); … … 192 192 if (!wrongTypes.isEmpty()) { 193 193 String s = marktr("Member for role {0} of wrong type"); 194 LinkedList<OsmPrimitive> highlight = new LinkedList< OsmPrimitive>(wrongTypes);194 LinkedList<OsmPrimitive> highlight = new LinkedList<>(wrongTypes); 195 195 highlight.addFirst(n); 196 196 errors.add(new TestError(this, Severity.WARNING, ROLE_VERIF_PROBLEM_MSG, … … 200 200 } 201 201 if (r.memberExpression != null) { 202 Set<OsmPrimitive> notMatching = new HashSet< OsmPrimitive>();202 Set<OsmPrimitive> notMatching = new HashSet<>(); 203 203 for (Collection<OsmPrimitive> c : Arrays.asList(new Collection[]{ri.nodes, ri.ways, ri.relations})) { 204 204 for (OsmPrimitive p : c) { … … 210 210 if (!notMatching.isEmpty()) { 211 211 String s = marktr("Member for role ''{0}'' does not match ''{1}''"); 212 LinkedList<OsmPrimitive> highlight = new LinkedList< OsmPrimitive>(notMatching);212 LinkedList<OsmPrimitive> highlight = new LinkedList<>(notMatching); 213 213 highlight.addFirst(n); 214 214 errors.add(new TestError(this, Severity.WARNING, ROLE_VERIF_PROBLEM_MSG, -
trunk/src/org/openstreetmap/josm/data/validation/tests/SelfIntersectingWay.java
r6241 r7005 30 30 31 31 @Override public void visit(Way w) { 32 HashSet<Node> nodes = new HashSet< Node>();32 HashSet<Node> nodes = new HashSet<>(); 33 33 34 34 for (int i = 1; i < w.getNodesCount() - 1; i++) { -
trunk/src/org/openstreetmap/josm/data/validation/tests/SimilarNamedWays.java
r6240 r7005 46 46 public void startTest(ProgressMonitor monitor) { 47 47 super.startTest(monitor); 48 cellWays = new HashMap< Point2D,List<Way>>(1000);49 errorWays = new MultiMap< Way, Way>();48 cellWays = new HashMap<>(1000); 49 errorWays = new MultiMap<>(); 50 50 } 51 51 … … 80 80 int levenshteinDistance = getLevenshteinDistance(name, name2); 81 81 if (0 < levenshteinDistance && levenshteinDistance <= 2) { 82 List<OsmPrimitive> primitives = new ArrayList< OsmPrimitive>(2);82 List<OsmPrimitive> primitives = new ArrayList<>(2); 83 83 primitives.add(w); 84 84 primitives.add(w2); -
trunk/src/org/openstreetmap/josm/data/validation/tests/TagChecker.java
r7004 r7005 75 75 protected static MultiMap<String, String> presetsValueData; 76 76 /** The TagChecker data */ 77 protected static final List<CheckerData> checkerData = new ArrayList< CheckerData>();78 protected static final List<String> ignoreDataStartsWith = new ArrayList< String>();79 protected static final List<String> ignoreDataEquals = new ArrayList< String>();80 protected static final List<String> ignoreDataEndsWith = new ArrayList< String>();81 protected static final List<IgnoreKeyPair> ignoreDataKeyPair = new ArrayList< IgnoreKeyPair>();77 protected static final List<CheckerData> checkerData = new ArrayList<>(); 78 protected static final List<String> ignoreDataStartsWith = new ArrayList<>(); 79 protected static final List<String> ignoreDataEquals = new ArrayList<>(); 80 protected static final List<String> ignoreDataEndsWith = new ArrayList<>(); 81 protected static final List<IgnoreKeyPair> ignoreDataKeyPair = new ArrayList<>(); 82 82 83 83 /** The preferences prefix */ … … 161 161 ignoreDataKeyPair.clear(); 162 162 163 spellCheckKeyData = new HashMap< String, String>();163 spellCheckKeyData = new HashMap<>(); 164 164 165 165 String errorSources = ""; … … 258 258 Collection<TaggingPreset> presets = TaggingPresetPreference.taggingPresets; 259 259 if (presets != null) { 260 presetsValueData = new MultiMap< String, String>();260 presetsValueData = new MultiMap<>(); 261 261 for (String a : OsmPrimitive.getUninterestingKeys()) { 262 262 presetsValueData.putVoid(a); … … 316 316 public void check(OsmPrimitive p) { 317 317 // Just a collection to know if a primitive has been already marked with error 318 MultiMap<OsmPrimitive, String> withErrors = new MultiMap< OsmPrimitive, String>();318 MultiMap<OsmPrimitive, String> withErrors = new MultiMap<>(); 319 319 320 320 if (checkComplex) { … … 550 550 @Override 551 551 public Command fixError(TestError testError) { 552 List<Command> commands = new ArrayList< Command>(50);552 List<Command> commands = new ArrayList<>(50); 553 553 554 554 Collection<? extends OsmPrimitive> primitives = testError.getPrimitives(); … … 607 607 protected static class CheckerData { 608 608 private String description; 609 protected List<CheckerElement> data = new ArrayList< CheckerElement>();609 protected List<CheckerElement> data = new ArrayList<>(); 610 610 private OsmPrimitiveType type; 611 611 private int code; -
trunk/src/org/openstreetmap/josm/data/validation/tests/TurnrestrictionTest.java
r6316 r7005 54 54 Way fromWay = null; 55 55 Way toWay = null; 56 List<OsmPrimitive> via = new ArrayList< OsmPrimitive>();56 List<OsmPrimitive> via = new ArrayList<>(); 57 57 58 58 boolean morefrom = false; … … 66 66 return; 67 67 68 List<OsmPrimitive> l = new ArrayList< OsmPrimitive>();68 List<OsmPrimitive> l = new ArrayList<>(); 69 69 l.add(r); 70 70 l.add(m.getMember()); -
trunk/src/org/openstreetmap/josm/data/validation/tests/UnclosedWays.java
r6916 r7005 156 156 */ 157 157 public Set<String> getCheckedKeys() { 158 Set<String> keys = new HashSet< String>();158 Set<String> keys = new HashSet<>(); 159 159 for (UnclosedWaysCheck c : checks) { 160 160 keys.add(c.key); -
trunk/src/org/openstreetmap/josm/data/validation/tests/UnconnectedWays.java
r6830 r7005 157 157 public void startTest(ProgressMonitor monitor) { 158 158 super.startTest(monitor); 159 ways = new HashSet< MyWaySegment>();160 endnodes = new QuadBuckets< Node>();161 endnodes_highway = new QuadBuckets< Node>();162 middlenodes = new QuadBuckets< Node>();163 othernodes = new HashSet< Node>();159 ways = new HashSet<>(); 160 endnodes = new QuadBuckets<>(); 161 endnodes_highway = new QuadBuckets<>(); 162 middlenodes = new QuadBuckets<>(); 163 othernodes = new HashSet<>(); 164 164 mindist = Main.pref.getDouble(PREFIX + ".node_way_distance", 10.0); 165 165 minmiddledist = Main.pref.getDouble(PREFIX + ".way_way_distance", 0.0); … … 168 168 169 169 protected Map<Node, Way> getWayEndNodesNearOtherHighway() { 170 Map<Node, Way> map = new HashMap< Node, Way>();170 Map<Node, Way> map = new HashMap<>(); 171 171 for (int iter = 0; iter < 1; iter++) { 172 172 for (MyWaySegment s : ways) { … … 199 199 200 200 protected Map<Node, Way> getWayEndNodesNearOtherWay() { 201 Map<Node, Way> map = new HashMap< Node, Way>();201 Map<Node, Way> map = new HashMap<>(); 202 202 for (MyWaySegment s : ways) { 203 203 if (isCanceled()) { … … 220 220 221 221 protected Map<Node, Way> getWayNodesNearOtherWay() { 222 Map<Node, Way> map = new HashMap< Node, Way>();222 Map<Node, Way> map = new HashMap<>(); 223 223 for (MyWaySegment s : ways) { 224 224 if (isCanceled()) { … … 240 240 241 241 protected Map<Node, Way> getConnectedWayEndNodesNearOtherWay() { 242 Map<Node, Way> map = new HashMap< Node, Way>();242 Map<Node, Way> map = new HashMap<>(); 243 243 for (MyWaySegment s : ways) { 244 244 if (isCanceled()) { … … 348 348 LatLon topLeft = new LatLon(y2+fudge, x1-fudge); 349 349 LatLon botRight = new LatLon(y1-fudge, x2+fudge); 350 List<LatLon> ret = new ArrayList< LatLon>(2);350 List<LatLon> ret = new ArrayList<>(2); 351 351 ret.add(topLeft); 352 352 ret.add(botRight); … … 368 368 // the nodes that are not in the smaller 369 369 // area, but keep the old larger cache. 370 Set<Node> trimmed = new HashSet< Node>(nearbyNodeCache);371 Set<Node> initial = new HashSet< Node>(nearbyNodeCache);370 Set<Node> trimmed = new HashSet<>(nearbyNodeCache); 371 Set<Node> initial = new HashSet<>(nearbyNodeCache); 372 372 for (Node n : initial) { 373 373 if (!nearby(n, dist)) { … … 400 400 // allocating the hash set 401 401 if (nearbyNodeCache == null) { 402 nearbyNodeCache = new HashSet< Node>();402 nearbyNodeCache = new HashSet<>(); 403 403 } 404 404 nearbyNodeCache.add(n); … … 413 413 414 414 List<MyWaySegment> getWaySegments(Way w) { 415 List<MyWaySegment> ret = new ArrayList< MyWaySegment>();415 List<MyWaySegment> ret = new ArrayList<>(); 416 416 if (!w.isUsable() 417 417 || w.hasKey("barrier") -
trunk/src/org/openstreetmap/josm/data/validation/tests/UntaggedWay.java
r6494 r7005 42 42 43 43 /** Ways that must have a name */ 44 public static final Set<String> NAMED_WAYS = new HashSet< String>();44 public static final Set<String> NAMED_WAYS = new HashSet<>(); 45 45 static { 46 46 NAMED_WAYS.add( "motorway" ); … … 54 54 55 55 /** Whitelist of roles allowed to reference an untagged way */ 56 public static final Set<String> WHITELIST = new HashSet< String>();56 public static final Set<String> WHITELIST = new HashSet<>(); 57 57 static { 58 58 WHITELIST.add( "outer" ); … … 119 119 public void startTest(ProgressMonitor monitor) { 120 120 super.startTest(monitor); 121 waysUsedInRelations = new HashSet< Way>();121 waysUsedInRelations = new HashSet<>(); 122 122 for (Relation r : Main.main.getCurrentDataSet().getRelations()) { 123 123 if (r.isUsable()) { -
trunk/src/org/openstreetmap/josm/data/validation/util/AggregatePrimitivesVisitor.java
r6010 r7005 21 21 public class AggregatePrimitivesVisitor extends AbstractVisitor { 22 22 /** Aggregated data */ 23 final Collection<OsmPrimitive> aggregatedData = new HashSet< OsmPrimitive>();23 final Collection<OsmPrimitive> aggregatedData = new HashSet<>(); 24 24 25 25 /** -
trunk/src/org/openstreetmap/josm/data/validation/util/Entities.java
r6920 r7005 386 386 if(mapNameToValue == null) 387 387 { 388 mapNameToValue = new HashMap< String, String>();388 mapNameToValue = new HashMap<>(); 389 389 for (String[] pair : ARRAY) 390 390 mapNameToValue.put(pair[0], pair[1]); -
trunk/src/org/openstreetmap/josm/data/validation/util/ValUtil.java
r6869 r7005 40 40 Node n2 = w.getNode(w.getNodesCount() - 1); 41 41 42 List<List<Way>> cells = new ArrayList< List<Way>>(2);43 Set<Point2D> cellNodes = new HashSet< Point2D>();42 List<List<Way>> cells = new ArrayList<>(2); 43 Set<Point2D> cellNodes = new HashSet<>(); 44 44 Point2D cell; 45 45 … … 55 55 List<Way> ways = cellWays.get(cell); 56 56 if (ways == null) { 57 ways = new ArrayList< Way>();57 ways = new ArrayList<>(); 58 58 cellWays.put(cell, ways); 59 59 } … … 66 66 ways = cellWays.get( cell ); 67 67 if (ways == null) { 68 ways = new ArrayList< Way>();68 ways = new ArrayList<>(); 69 69 cellWays.put(cell, ways); 70 70 } … … 84 84 ways = cellWays.get(cell); 85 85 if (ways == null) { 86 ways = new ArrayList< Way>();86 ways = new ArrayList<>(); 87 87 cellWays.put(cell, ways); 88 88 } … … 96 96 ways = cellWays.get(cell); 97 97 if (ways == null) { 98 ways = new ArrayList< Way>();98 ways = new ArrayList<>(); 99 99 cellWays.put(cell, ways); 100 100 } … … 134 134 CheckParameterUtil.ensureParameterNotNull(en1, "en1"); 135 135 CheckParameterUtil.ensureParameterNotNull(en2, "en2"); 136 List<Point2D> cells = new ArrayList< Point2D>();136 List<Point2D> cells = new ArrayList<>(); 137 137 double x0 = en1.east() * gridDetail; 138 138 double x1 = en2.east() * gridDetail;
Note:
See TracChangeset
for help on using the changeset viewer.