Ticket #24075: 24075.KeyedItem_match.patch
| File 24075.KeyedItem_match.patch, 4.3 KB (added by , 15 months ago) |
|---|
-
src/org/openstreetmap/josm/data/validation/tests/TagChecker.java
Subject: [PATCH] #24075: KeyedItem precalculated match enum --- IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 diff --git a/src/org/openstreetmap/josm/data/validation/tests/TagChecker.java b/src/org/openstreetmap/josm/data/validation/tests/TagChecker.java
a b 420 420 List<TaggingPresetItem> minData = new ArrayList<>(); 421 421 for (TaggingPresetItem i : p.data) { 422 422 if (i instanceof KeyedItem) { 423 if (!"none".equals(((KeyedItem) i).match ))423 if (!"none".equals(((KeyedItem) i).match())) 424 424 minData.add(i); 425 425 addPresetValue((KeyedItem) i); 426 426 } else if (i instanceof CheckGroup) { 427 427 for (Check c : ((CheckGroup) i).checks) { 428 if (!"none".equals(c.match ))428 if (!"none".equals(c.match())) 429 429 minData.add(c); 430 430 addPresetValue(c); 431 431 } -
src/org/openstreetmap/josm/gui/tagging/presets/items/KeyedItem.java
IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 diff --git a/src/org/openstreetmap/josm/gui/tagging/presets/items/KeyedItem.java b/src/org/openstreetmap/josm/gui/tagging/presets/items/KeyedItem.java
a b 51 51 * Note that for a match, at least one positive and no negative is required. 52 52 * Default is "keyvalue!" for {@link Key} and "none" for {@link Text}, {@link Combo}, {@link MultiSelect} and {@link Check}. 53 53 */ 54 p ublic String match = getDefaultMatch().getValue(); // NOSONAR54 protected MatchType match = getDefaultMatch(); // NOSONAR 55 55 56 56 /** 57 57 * List of regions the preset is applicable for. … … 181 181 } 182 182 } 183 183 184 /** 185 * Allows to change the matching process, i.e., determining whether the tags of an OSM object fit into this preset. 186 * If a preset fits then it is linked in the Tags/Membership dialog.<ul> 187 * <li>none: neutral, i.e., do not consider this item for matching</li> 188 * <li>key: positive if key matches, neutral otherwise</li> 189 * <li>key!: positive if key matches, negative otherwise</li> 190 * <li>keyvalue: positive if key and value matches, neutral otherwise</li> 191 * <li>keyvalue!: positive if key and value matches, negative otherwise</li></ul> 192 * Note that for a match, at least one positive and no negative is required. 193 * Default is "keyvalue!" for {@link Key} and "none" for {@link Text}, {@link Combo}, {@link MultiSelect} and {@link Check}. 194 * @param match The match type. One of <code>none</code>, <code>key</code>, <code>key!</code>, <code>keyvalue</code>, 195 * or <code>keyvalue!</code>. 196 * @since xxx 197 */ 198 public void setMatch(String match) { 199 this.match = MatchType.ofString(match); 200 } 201 202 /** 203 * Get the match type for this item 204 * @return The match type 205 * @since xxx 206 */ 207 public String match() { 208 return this.match.getValue(); 209 } 210 184 211 /** 185 212 * Computes the tag usage for the given key from the given primitives 186 213 * @param sel the primitives … … 221 248 * @return whether key or key+value are required 222 249 */ 223 250 public boolean isKeyRequired() { 224 final MatchType type = MatchType.ofString(match);251 final MatchType type = this.match; 225 252 return MatchType.KEY_REQUIRED == type || MatchType.KEY_VALUE_REQUIRED == type; 226 253 } 227 254 … … 243 270 244 271 @Override 245 272 public Boolean matches(Map<String, String> tags) { 246 switch ( MatchType.ofString(match)) {273 switch (this.match) { 247 274 case NONE: 248 275 return null; // NOSONAR 249 276 case KEY:
