Changeset 9536 in josm for trunk/src/org/openstreetmap/josm/data/osm
- Timestamp:
- 2016-01-19T10:52:33+01:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/Tag.java
r9371 r9536 2 2 package org.openstreetmap.josm.data.osm; 3 3 4 import java.util.Collection; 5 import java.util.Collections; 6 import java.util.Map; 4 7 import java.util.Objects; 5 8 … … 11 14 * be empty, but not null. 12 15 * 16 * <p/> 17 * It implements the {@link Tagged} interface. However, since instances of this class are immutable, 18 * the modifying methods throw an {@link UnsupportedOperationException}. 13 19 */ 14 public class Tag {20 public class Tag implements Tagged { 15 21 16 private String key;17 private String value;22 private final String key; 23 private final String value; 18 24 19 25 /** … … 131 137 return Utils.strip(s).replaceAll("\\s+", " "); 132 138 } 139 140 /** 141 * Unsupported. 142 * @param keys ignored 143 * @throws UnsupportedOperationException 144 */ 145 @Override 146 public void setKeys(Map<String, String> keys) { 147 throw new UnsupportedOperationException(); 148 } 149 150 @Override 151 public Map<String, String> getKeys() { 152 return Collections.singletonMap(key, value); 153 } 154 155 /** 156 * Unsupported. 157 * @param key ignored 158 * @param value ignored 159 * @throws UnsupportedOperationException 160 */ 161 @Override 162 public void put(String key, String value) { 163 throw new UnsupportedOperationException(); 164 } 165 166 @Override 167 public String get(String k) { 168 return key.equals(k) ? value : null; 169 } 170 171 /** 172 * Unsupported. 173 * @param key ignored 174 * @throws UnsupportedOperationException 175 */ 176 @Override 177 public void remove(String key) { 178 throw new UnsupportedOperationException(); 179 } 180 181 @Override 182 public boolean hasKeys() { 183 return true; 184 } 185 186 @Override 187 public Collection<String> keySet() { 188 return Collections.singleton(key); 189 } 190 191 /** 192 * Unsupported. 193 * @throws UnsupportedOperationException 194 */ 195 @Override 196 public void removeAll() { 197 throw new UnsupportedOperationException(); 198 } 133 199 }
Note:
See TracChangeset
for help on using the changeset viewer.