- Timestamp:
- 2009-08-08T14:00:59+02:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java
r1924 r1932 104 104 105 105 /** 106 * 106 * Sets whether this primitive is selected or not. 107 * 108 * @param selected true, if this primitive is selected; false, otherwise 107 109 * @since 1899 108 110 */ … … 111 113 } 112 114 /** 113 * 115 * Replies true, if this primitive is selected. 116 * 117 * @return true, if this primitive is selected 114 118 * @since 1899 115 119 */ … … 242 246 243 247 /** 244 * 248 * Replies the map of key/value pairs. Never replies null. The map can be empty, though. 249 * 245 250 * @return Keys of this primitive. Changes made in returned map are not mapped 246 251 * back to the primitive, use setKeys() to modify the keys … … 249 254 public Map<String, String> getKeys() { 250 255 // TODO More effective map 251 return new HashMap<String, String>(keys); 252 } 253 254 /** 255 * 256 // fix for #3218 257 if (keys == null) 258 return new HashMap<String, String>(); 259 else 260 return new HashMap<String, String>(keys); 261 } 262 263 /** 264 * Sets the keys of this primitives to the key/value pairs in <code>keys</code>. 265 * If <code>keys</code> is null removes all existing key/value pairs. 266 * 267 * @param keys the key/value pairs to set. If null, removes all existing key/value pairs. 256 268 * @since 1924 257 269 */ … … 265 277 266 278 /** 267 * Set the given value to the given key 268 * @param key The key, for which the value is to be set. 269 * @param value The value for the key. 279 * Set the given value to the given key. If key is null, does nothing. If value is null, 280 * removes the key and behaves like {@see #remove(String)}. 281 * 282 * @param key The key, for which the value is to be set. Can be null, does nothing in this case. 283 * @param value The value for the key. If null, removes the respective key/value pair. 284 * 285 * @see #remove(String) 270 286 */ 271 287 public final void put(String key, String value) { 272 if (value == null) { 288 if (key == null) 289 return; 290 else if (value == null) { 273 291 remove(key); 274 292 } else { … … 281 299 } 282 300 /** 283 * Remove the given key from the list. 301 * Remove the given key from the list 302 * 303 * @param key the key to be removed. Ignored, if key is null. 284 304 */ 285 305 public final void remove(String key) { … … 294 314 295 315 /** 296 * 316 * Removes all keys from this primitive. 317 * 297 318 * @since 1843 298 319 */ … … 302 323 } 303 324 325 /** 326 * Replies the value for key <code>key</code>. Replies null, if <code>key</code> is null. 327 * Replies null, if there is no value for the given key. 328 * 329 * @param key the key. Can be null, replies null in this case. 330 * @return the value for key <code>key</code>. 331 */ 304 332 public final String get(String key) { 333 if (key == null) return null; 305 334 return keys == null ? null : keys.get(key); 306 335 } … … 319 348 320 349 /** 321 * 350 * Replies true, if the map of key/value pairs of this primitive is not empty. 351 * 352 * @return true, if the map of key/value pairs of this primitive is not empty; false 353 * otherwise 354 * 322 355 * @since 1843 323 356 */
Note:
See TracChangeset
for help on using the changeset viewer.