Changeset 7751 in josm
- Timestamp:
- 2014-11-26T23:32:32+01:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/conflict/tags/MultiValueResolutionDecision.java
r7743 r7751 29 29 /** the selected value if {@link #type} is {@link MultiValueDecisionType#KEEP_ONE} */ 30 30 private String value; 31 32 private static final String[] SUMMABLE_KEYS = new String[] { 33 "capacity(:.+)?", "step_count" 34 }; 31 35 32 36 /** … … 197 201 */ 198 202 public boolean canSumAllNumeric() { 199 return "capacity".equals(getKey()) && canKeepAll(); 203 if (!canKeepAll()) { 204 return false; 205 } 206 for (String key : SUMMABLE_KEYS) { 207 if (getKey().matches(key)) { 208 return true; 209 } 210 } 211 return false; 200 212 } 201 213 … … 225 237 * 226 238 */ 227 public void applyTo(OsmPrimitive primitive) throws IllegalStateException{239 public void applyTo(OsmPrimitive primitive) { 228 240 if (primitive == null) return; 229 241 if (!isDecided()) 230 242 throw new IllegalStateException(tr("Not decided yet.")); 231 243 String key = tags.getKeys().iterator().next(); 232 String value = getChosenValue();233 244 if (type.equals(MultiValueDecisionType.KEEP_NONE)) { 234 245 primitive.remove(key); 235 246 } else { 236 primitive.put(key, value);247 primitive.put(key, getChosenValue()); 237 248 } 238 249 } … … 244 255 * @throws IllegalStateException thrown if this resolution is not resolved yet 245 256 */ 246 public void applyTo(Collection<? extends OsmPrimitive> primitives) throws IllegalStateException{257 public void applyTo(Collection<? extends OsmPrimitive> primitives) { 247 258 if (primitives == null) return; 248 259 for (OsmPrimitive primitive: primitives) { … … 262 273 * @throws IllegalStateException thrown if this resolution is not resolved yet 263 274 */ 264 public Command buildChangeCommand(OsmPrimitive primitive) throws IllegalArgumentException, IllegalStateException{275 public Command buildChangeCommand(OsmPrimitive primitive) { 265 276 CheckParameterUtil.ensureParameterNotNull(primitive, "primitive"); 266 277 if (!isDecided())
Note:
See TracChangeset
for help on using the changeset viewer.