- Timestamp:
- 2020-01-27T19:59:00+01:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/validation/tests/TagChecker.java
r15682 r15788 17 17 import java.util.HashMap; 18 18 import java.util.HashSet; 19 import java.util.LinkedHashMap; 20 import java.util.LinkedHashSet; 19 21 import java.util.List; 20 22 import java.util.Locale; … … 79 81 /** often used tags which are not in presets */ 80 82 private static volatile MultiMap<String, String> oftenUsedTags = new MultiMap<>(); 83 private static final Map<TaggingPreset, List<TaggingPresetItem>> presetIndex = new LinkedHashMap<>(); 81 84 82 85 private static final Pattern UNWANTED_NON_PRINTING_CONTROL_CHARACTERS = Pattern.compile( … … 244 247 ignoreForLevenshtein.clear(); 245 248 oftenUsedTags.clear(); 249 presetIndex.clear(); 246 250 247 251 StringBuilder errorSources = new StringBuilder(); … … 365 369 initAdditionalPresetsValueData(); 366 370 for (TaggingPreset p : presets) { 371 List<TaggingPresetItem> minData = new ArrayList<>(); 367 372 for (TaggingPresetItem i : p.data) { 368 373 if (i instanceof KeyedItem) { 374 if (!"none".equals(((KeyedItem) i).match)) 375 minData.add(i); 369 376 addPresetValue((KeyedItem) i); 370 377 } else if (i instanceof CheckGroup) { … … 373 380 } 374 381 } 382 } 383 if (!minData.isEmpty()) { 384 presetIndex .put(p, minData); 375 385 } 376 386 } … … 622 632 TaggingPresetType presetType = TaggingPresetType.forPrimitive(p); 623 633 EnumSet<TaggingPresetType> presetTypes = EnumSet.of(presetType); 624 Collection<TaggingPreset> matchingPresets = TaggingPresets.getMatchingPresets(null, tags, false); 634 635 Collection<TaggingPreset> matchingPresets = new LinkedHashSet<>(); 636 for (Entry<TaggingPreset, List<TaggingPresetItem>> e : presetIndex.entrySet()) { 637 if (TaggingPresetItem.matches(e.getValue(), tags)) { 638 matchingPresets.add(e.getKey()); 639 } 640 } 625 641 Collection<TaggingPreset> matchingPresetsOK = matchingPresets.stream().filter( 626 642 tp -> tp.typeMatches(presetTypes)).collect(Collectors.toList());
Note:
See TracChangeset
for help on using the changeset viewer.