[2512] | 1 | // License: GPL. For details, see LICENSE file.
|
---|
| 2 | package org.openstreetmap.josm.data.osm;
|
---|
| 3 |
|
---|
| 4 | import java.util.Collection;
|
---|
| 5 | import java.util.Map;
|
---|
| 6 | /**
|
---|
| 7 | * Objects implement Tagged if they provide a map of key/value pairs.
|
---|
| 8 | *
|
---|
| 9 | *
|
---|
| 10 | */
|
---|
| 11 | // FIXME: better naming? setTags(), getTags(), getKeys() instead of keySet() ?
|
---|
| 12 | //
|
---|
| 13 | public interface Tagged {
|
---|
| 14 | /**
|
---|
| 15 | * Sets the map of key/value pairs
|
---|
| 16 | *
|
---|
| 17 | * @param keys the map of key value pairs. If null, reset to the empty map.
|
---|
| 18 | */
|
---|
| 19 | void setKeys(Map<String,String> keys);
|
---|
| 20 |
|
---|
| 21 | /**
|
---|
| 22 | * Replies the map of key/value pairs. Never null, but may be the empty map.
|
---|
| 23 | *
|
---|
| 24 | * @return the map of key/value pairs
|
---|
| 25 | */
|
---|
| 26 | Map<String,String> getKeys();
|
---|
| 27 |
|
---|
| 28 | /**
|
---|
| 29 | * Sets a key/value pairs
|
---|
| 30 | *
|
---|
| 31 | * @param key the key
|
---|
| 32 | * @param value the value. If null, removes the key/value pair.
|
---|
| 33 | */
|
---|
| 34 | void put(String key, String value);
|
---|
| 35 |
|
---|
| 36 | /**
|
---|
| 37 | * Replies the value of the given key; null, if there is no value for this key
|
---|
| 38 | *
|
---|
| 39 | * @param key the key
|
---|
| 40 | * @return the value
|
---|
| 41 | */
|
---|
| 42 | String get(String key);
|
---|
| 43 |
|
---|
| 44 | /**
|
---|
| 45 | * Removes a given key/value pair
|
---|
| 46 | *
|
---|
| 47 | * @param key the key
|
---|
| 48 | */
|
---|
| 49 | void remove(String key);
|
---|
| 50 |
|
---|
| 51 | /**
|
---|
| 52 | * Replies true, if there is at least one key/value pair; false, otherwise
|
---|
| 53 | *
|
---|
| 54 | * @return true, if there is at least one key/value pair; false, otherwise
|
---|
| 55 | */
|
---|
| 56 | boolean hasKeys();
|
---|
| 57 |
|
---|
| 58 | /**
|
---|
| 59 | * Replies the set of keys
|
---|
| 60 | *
|
---|
| 61 | * @return the set of keys
|
---|
| 62 | */
|
---|
| 63 | Collection<String> keySet();
|
---|
| 64 |
|
---|
| 65 | /**
|
---|
| 66 | * Removes all tags
|
---|
| 67 | */
|
---|
| 68 | void removeAll();
|
---|
| 69 | }
|
---|