Changeset 9649 in josm
- Timestamp:
- 2016-01-27T17:02:17+01:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/data/osm
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/AbstractPrimitive.java
r9460 r9649 9 9 import java.util.Collections; 10 10 import java.util.Date; 11 import java.util.HashMap;12 11 import java.util.HashSet; 13 12 import java.util.Map; … … 391 390 */ 392 391 @Override 393 public Map<String, String> getKeys() { 394 String[] keys = this.keys; 395 final Map<String, String> result = new HashMap<>( 396 Utils.hashMapInitialCapacity(keys == null ? 0 : keys.length / 2)); 397 if (keys != null) { 398 for (int i = 0; i < keys.length; i += 2) { 399 result.put(keys[i], keys[i + 1]); 400 } 401 } 402 return result; 392 public TagMap getKeys() { 393 return new TagMap(keys); 403 394 } 404 395 … … 444 435 } 445 436 this.keys = newKeys; 437 keysChangedImpl(originalKeys); 438 } 439 440 /** 441 * Copy the keys from a TagMap. 442 * @param keys The new key map. 443 */ 444 public void setKeys(TagMap keys) { 445 Map<String, String> originalKeys = getKeys(); 446 String[] arr = keys.getTagsArray(); 447 if (arr.length == 0) { 448 this.keys = null; 449 } else { 450 this.keys = arr; 451 } 446 452 keysChangedImpl(originalKeys); 447 453 } -
trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java
r9552 r9649 919 919 920 920 @Override 921 public final void setKeys(TagMap keys) { 922 boolean locked = writeLock(); 923 try { 924 super.setKeys(keys); 925 } finally { 926 writeUnlock(locked); 927 } 928 } 929 930 @Override 921 931 public final void setKeys(Map<String, String> keys) { 922 932 boolean locked = writeLock(); -
trunk/src/org/openstreetmap/josm/data/osm/Tag.java
r9545 r9649 5 5 import java.util.Collections; 6 6 import java.util.Map; 7 import java.util.Map.Entry; 7 8 import java.util.Objects; 8 9 … … 18 19 * the modifying methods throw an {@link UnsupportedOperationException}. 19 20 */ 20 public class Tag implements Tagged {21 public class Tag implements Tagged, Entry<String, String> { 21 22 22 23 private final String key; … … 66 67 * @return the key of the tag 67 68 */ 69 @Override 68 70 public String getKey() { 69 71 return key; … … 75 77 * @return the value of the tag 76 78 */ 79 @Override 77 80 public String getValue() { 78 81 return value; 82 } 83 84 /** 85 * This is not supported by this implementation. 86 * @param value ignored 87 * @return (Does not return) 88 * @throws UnsupportedOperationException always 89 */ 90 @Override 91 public String setValue(String value) { 92 throw new UnsupportedOperationException(); 79 93 } 80 94
Note:
See TracChangeset
for help on using the changeset viewer.