- Timestamp:
- 2016-01-19T10:52:33+01:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 2 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 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/SearchBasedRowFilter.java
r9231 r9536 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.gui.dialogs.properties; 3 4 import java.util.Collection;5 import java.util.Collections;6 import java.util.Map;7 3 8 4 import javax.swing.RowFilter; … … 10 6 11 7 import org.openstreetmap.josm.actions.search.SearchCompiler; 12 import org.openstreetmap.josm.data.osm.Tag ged;8 import org.openstreetmap.josm.data.osm.Tag; 13 9 14 10 /** … … 34 30 final String key = entry.getStringValue(0); 35 31 final String value = entry.getStringValue(1); 36 return filter.match(new OneKeyValue(key, value));32 return filter.match(new Tag(key, value)); 37 33 } 38 34 39 static class OneKeyValue implements Tagged {40 private final String key;41 private final String value;42 43 OneKeyValue(String key, String value) {44 this.key = key;45 this.value = value;46 }47 48 @Override49 public void setKeys(Map<String, String> keys) {50 throw new UnsupportedOperationException();51 }52 53 @Override54 public Map<String, String> getKeys() {55 return Collections.singletonMap(key, value);56 }57 58 @Override59 public void put(String key, String value) {60 throw new UnsupportedOperationException();61 }62 63 @Override64 public String get(String k) {65 return key.equals(k) ? value : null;66 }67 68 @Override69 public void remove(String key) {70 throw new UnsupportedOperationException();71 }72 73 @Override74 public boolean hasKeys() {75 return true;76 }77 78 @Override79 public Collection<String> keySet() {80 return Collections.singleton(key);81 }82 83 @Override84 public void removeAll() {85 throw new UnsupportedOperationException();86 }87 }88 35 }
Note:
See TracChangeset
for help on using the changeset viewer.