- Timestamp:
- 2021-03-21T15:45:26+01:00 (4 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/data/validation/tests
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagChecker.java
r17620 r17621 21 21 import java.util.Set; 22 22 import java.util.function.Consumer; 23 import java.util.function.Predicate; 23 24 import java.util.stream.Stream; 24 25 … … 386 387 @Override 387 388 public void visit(Collection<OsmPrimitive> selection) { 388 if (progressMonitor != null) { 389 visit(selection, null); 390 } 391 392 /** 393 * Execute the rules from the URLs matching the given predicate. 394 * @param selection collection of primitives 395 * @param urlPredicate a predicate deciding whether the rules from the given URL shall be executed 396 */ 397 void visit(Collection<OsmPrimitive> selection, Predicate<String> urlPredicate) { 398 if (urlPredicate == null && progressMonitor != null) { 389 399 progressMonitor.setTicksCount(selection.size() * checks.size()); 390 400 } … … 396 406 if (isCanceled()) { 397 407 break; 408 } 409 if (urlPredicate != null && !urlPredicate.test(entry.getKey())) { 410 continue; 398 411 } 399 412 visit(entry.getKey(), entry.getValue(), selection, surrounding); … … 480 493 } 481 494 482 /**483 * Execute only the rules for the rules matching the given file name. See #19180484 * @param ruleFile the name of the mapcss file, e.g. deprecated.mapcss485 * @param selection collection of primitives486 * @since 16784487 */488 public void runOnly(String ruleFile, Collection<OsmPrimitive> selection) {489 mpAreaCache.clear();490 491 Set<OsmPrimitive> surrounding = new HashSet<>();492 for (Entry<String, Set<MapCSSTagCheckerRule>> entry : checks.entrySet()) {493 if (isCanceled()) {494 break;495 }496 if (entry.getKey().endsWith(ruleFile)) {497 visit(entry.getKey(), entry.getValue(), selection, surrounding);498 }499 }500 501 }502 495 } -
trunk/src/org/openstreetmap/josm/data/validation/tests/TagChecker.java
r17584 r17621 1043 1043 return 0; 1044 1044 deprecatedChecker.getErrors().clear(); 1045 deprecatedChecker. runOnly("deprecated.mapcss", Collections.singleton(p));1045 deprecatedChecker.visit(Collections.singleton(p), url -> url.endsWith("deprecated.mapcss")); 1046 1046 return deprecatedChecker.getErrors().size(); 1047 1047 }
Note:
See TracChangeset
for help on using the changeset viewer.