001 // License: GPL. For details, see LICENSE file.
002 package org.openstreetmap.josm.data.osm;
003
004 import java.util.Collection;
005 import java.util.Map;
006 /**
007 * Objects implement Tagged if they provide a map of key/value pairs.
008 *
009 *
010 */
011 // FIXME: better naming? setTags(), getTags(), getKeys() instead of keySet() ?
012 //
013 public interface Tagged {
014 /**
015 * Sets the map of key/value pairs
016 *
017 * @param keys the map of key value pairs. If null, reset to the empty map.
018 */
019 void setKeys(Map<String,String> keys);
020
021 /**
022 * Replies the map of key/value pairs. Never null, but may be the empty map.
023 *
024 * @return the map of key/value pairs
025 */
026 Map<String,String> getKeys();
027
028 /**
029 * Sets a key/value pairs
030 *
031 * @param key the key
032 * @param value the value. If null, removes the key/value pair.
033 */
034 void put(String key, String value);
035
036 /**
037 * Replies the value of the given key; null, if there is no value for this key
038 *
039 * @param key the key
040 * @return the value
041 */
042 String get(String key);
043
044 /**
045 * Removes a given key/value pair
046 *
047 * @param key the key
048 */
049 void remove(String key);
050
051 /**
052 * Replies true, if there is at least one key/value pair; false, otherwise
053 *
054 * @return true, if there is at least one key/value pair; false, otherwise
055 */
056 boolean hasKeys();
057
058 /**
059 * Replies the set of keys
060 *
061 * @return the set of keys
062 */
063 Collection<String> keySet();
064
065 /**
066 * Removes all tags
067 */
068 void removeAll();
069 }