- Timestamp:
- 2018-12-08T22:01:44+01:00 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/validation/tests/NameMismatch.java
r11191 r14525 5 5 import static org.openstreetmap.josm.tools.I18n.tr; 6 6 7 import java.util.HashSet; 7 import java.util.Arrays; 8 import java.util.List; 9 import java.util.Map.Entry; 8 10 import java.util.Set; 9 11 import java.util.regex.Pattern; 12 import java.util.stream.Collectors; 10 13 11 14 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 34 37 protected static final int NAME_TRANSLATION_MISSING = 1502; 35 38 private static final Pattern NAME_SPLIT_PATTERN = Pattern.compile(" - "); 39 40 private static final List<String> EXCLUSIONS = Arrays.asList( 41 "name:botanical", 42 "name:etymology:wikidata", 43 "name:full", 44 "name:genitive", 45 "name:left", 46 "name:prefix", 47 "name:right", 48 "name:source" 49 ); 36 50 37 51 /** … … 64 78 @Override 65 79 public void check(OsmPrimitive p) { 66 Set<String> names = new HashSet<>(); 67 68 p.getKeys().forEach((key, n) -> { 69 if (n != null && key.startsWith("name:") && !"name:etymology:wikidata".equals(key)) { 70 names.add(n); 71 } 72 }); 80 Set<String> names = p.getKeys().entrySet().stream() 81 .filter(e -> e.getValue() != null && e.getKey().startsWith("name:") && !EXCLUSIONS.contains(e.getKey())) 82 .map(Entry::getValue) 83 .collect(Collectors.toSet()); 73 84 74 85 if (names.isEmpty()) return;
Note:
See TracChangeset
for help on using the changeset viewer.