Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/DataSet.java
r7013 r7073 55 55 * Dataset is threadsafe - accessing Dataset simultaneously from different threads should never 56 56 * lead to data corruption or ConccurentModificationException. However when for example one thread 57 * removes primitive and other thread try to add another primitive ref fering to the removed primitive,57 * removes primitive and other thread try to add another primitive referring to the removed primitive, 58 58 * DataIntegrityException will occur. 59 59 * -
trunk/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagChecker.java
r7069 r7073 48 48 import org.openstreetmap.josm.io.UTFInputStreamReader; 49 49 import org.openstreetmap.josm.tools.CheckParameterUtil; 50 import org.openstreetmap.josm.tools.MultiMap;51 50 import org.openstreetmap.josm.tools.Predicate; 52 51 import org.openstreetmap.josm.tools.Utils; … … 192 191 removeMetaRules(source); 193 192 // group rules with common declaration block 194 M ultiMap<MapCSSRule.Declaration, MapCSSRule> rules = new MultiMap<>();193 Map<Declaration, List<Selector>> g = new LinkedHashMap<>(); 195 194 for (MapCSSRule rule : source.rules) { 196 rules.put(rule.declaration, rule); 195 if (!g.containsKey(rule.declaration)) { 196 List<Selector> sels = new ArrayList<>(); 197 sels.add(rule.selector); 198 g.put(rule.declaration, sels); 199 } else { 200 g.get(rule.declaration).add(rule.selector); 201 } 197 202 } 198 203 List<TagCheck> result = new ArrayList<>(); 199 for (Collection<MapCSSRule> rulesCommonDecl : rules.values()) { 200 List<Selector> selectors = new ArrayList<>(); 201 for (MapCSSRule rule : rulesCommonDecl) { 202 selectors.add(rule.selector); 203 } 204 if (!rulesCommonDecl.isEmpty()) { 205 result.add(TagCheck.ofMapCSSRule( 206 new GroupedMapCSSRule(selectors, rulesCommonDecl.iterator().next().declaration))); 207 } 204 for (Map.Entry<Declaration, List<Selector>> map : g.entrySet()) { 205 result.add(TagCheck.ofMapCSSRule( 206 new GroupedMapCSSRule(map.getValue(), map.getKey()))); 208 207 } 209 208 return result; -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/MapCSSTagCheckerTest.java
r7068 r7073 64 64 n2.put("natural", "wood"); 65 65 assertFalse(check.evaluate(n2)); 66 assertThat(MapCSSTagChecker.TagCheck.insertArguments(check.rule.selector , "The key is {0.key} and the value is {0.value}"),66 assertThat(MapCSSTagChecker.TagCheck.insertArguments(check.rule.selectors.get(0), "The key is {0.key} and the value is {0.value}"), 67 67 is("The key is natural and the value is marsh")); 68 68 } … … 88 88 if (isError != i.getValue()) { 89 89 final String error = MessageFormat.format("Expecting test ''{0}'' (i.e., {1}) to {2} {3} (i.e., {4})", 90 check.getMessage(p), check.rule.selector , i.getValue() ? "match" : "not match", i.getKey(), p.getKeys());90 check.getMessage(p), check.rule.selectors, i.getValue() ? "match" : "not match", i.getKey(), p.getKeys()); 91 91 System.err.println(error); 92 92 assertionErrors.add(error);
Note:
See TracChangeset
for help on using the changeset viewer.