Changeset 2906 in josm
- Timestamp:
- 2010-01-29T22:26:58+01:00 (15 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/JoinAreasAction.java
r2842 r2906 250 250 ways.add(b); 251 251 252 // This is mostly copied and pasted from CombineWayAction.java and one day should be moved into tools 252 // FIXME: This is mostly copied and pasted from CombineWayAction.java and one day should be moved into tools 253 253 Map<String, Set<String>> props = new TreeMap<String, Set<String>>(); 254 254 for (Way w : ways) { 255 for ( Entry<String,String> e : w.entrySet()) {256 if (!props.containsKey( e.getKey())) {257 props.put( e.getKey(), new TreeSet<String>());258 } 259 props.get( e.getKey()).add(e.getValue());255 for (String key: w.keySet()) { 256 if (!props.containsKey(key)) { 257 props.put(key, new TreeSet<String>()); 258 } 259 props.get(key).add(w.get(key)); 260 260 } 261 261 } -
trunk/src/org/openstreetmap/josm/actions/search/SearchCompiler.java
r2863 r2906 7 7 import java.io.PushbackReader; 8 8 import java.io.StringReader; 9 import java.util.Map.Entry;10 9 import java.util.regex.Matcher; 11 10 import java.util.regex.Pattern; … … 194 193 */ 195 194 196 for (Entry<String, String> e : osm.entrySet()) { 197 String k = e.getKey(); 198 String v = e.getValue(); 195 for (String k: osm.keySet()) { 196 String v = osm.get(k); 199 197 200 198 Matcher matcherKey = keyPattern.matcher(k); … … 330 328 case ANY_VALUE_REGEXP: 331 329 case EXACT_REGEXP: 332 for ( Entry<String, String> entry:osm.entrySet()) {333 if (keyPattern.matcher( entry.getKey()).matches()) {330 for (String key: osm.keySet()) { 331 if (keyPattern.matcher(key).matches()) { 334 332 if (mode == Mode.ANY_VALUE_REGEXP 335 || valuePattern.matcher( entry.getValue()).matches())333 || valuePattern.matcher(osm.get(key)).matches()) 336 334 return true; 337 335 } … … 384 382 // is not Java 1.5 385 383 //search = java.text.Normalizer.normalize(search, java.text.Normalizer.Form.NFC); 386 for (Entry<String, String> e : osm.entrySet()) { 384 for (String key: osm.keySet()) { 385 String value = osm.get(key); 387 386 if (searchRegex != null) { 388 String key = e.getKey();389 String value = e.getValue();390 387 391 388 // is not Java 1.5 … … 401 398 return true; 402 399 } else { 403 String key = caseSensitive ? e.getKey() : e.getKey().toLowerCase(); 404 String value = caseSensitive ? e.getValue() : e.getValue().toLowerCase(); 400 if (caseSensitive) { 401 key = key.toLowerCase(); 402 value = value.toLowerCase(); 403 } 405 404 406 405 // is not Java 1.5 -
trunk/src/org/openstreetmap/josm/actions/upload/ApiPreconditionCheckerHook.java
r2641 r2906 5 5 import java.util.Collection; 6 6 import java.util.Collections; 7 import java.util.Map.Entry;8 7 9 8 import javax.swing.JOptionPane; … … 50 49 private boolean checkMaxNodes(Collection<OsmPrimitive> primitives, long maxNodes) { 51 50 for (OsmPrimitive osmPrimitive : primitives) { 52 for (Entry<String,String> e : osmPrimitive.entrySet()) { 53 if(e.getValue().length() > 255) { 51 for (String key: osmPrimitive.keySet()) { 52 String value = osmPrimitive.get(key); 53 if(key.length() > 255) { 54 54 if (osmPrimitive.isDeleted()) { 55 55 // if OsmPrimitive is going to be deleted we automatically shorten the … … 57 57 System.out.println( 58 58 tr("Warning: automatically truncating value of tag ''{0}'' on deleted object {1}", 59 e.getKey(),59 key, 60 60 Long.toString(osmPrimitive.getId()) 61 61 ) 62 62 ); 63 osmPrimitive.put( e.getKey(), e.getValue().substring(0, 255));63 osmPrimitive.put(key, value.substring(0, 255)); 64 64 continue; 65 65 } 66 66 JOptionPane.showMessageDialog(Main.parent, 67 67 tr("Length of value for tag ''{0}'' on object {1} exceeds the max. allowed length {2}. Values length is {3}.", 68 e.getKey(), Long.toString(osmPrimitive.getId()), 255,e.getValue().length()68 key, Long.toString(osmPrimitive.getId()), 255, value.length() 69 69 ), 70 70 tr("Precondition Violation"), -
trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java
r2903 r2906 47 47 } 48 48 49 private static class KeysEntry implements Entry<String, String>{50 51 private final String key;52 private final String value;53 54 private KeysEntry(String key, String value) {55 this.key = key;56 this.value = value;57 }58 59 public String getKey() {60 return key;61 }62 63 public String getValue() {64 return value;65 }66 67 public String setValue(String value) {68 throw new UnsupportedOperationException();69 }70 71 @Override72 public int hashCode() {73 final int prime = 31;74 int result = 1;75 result = prime * result + ((key == null) ? 0 : key.hashCode());76 result = prime * result + ((value == null) ? 0 : value.hashCode());77 return result;78 }79 80 @Override81 public boolean equals(Object obj) {82 if (this == obj)83 return true;84 if (obj == null)85 return false;86 if (getClass() != obj.getClass())87 return false;88 KeysEntry other = (KeysEntry) obj;89 if (key == null) {90 if (other.key != null)91 return false;92 } else if (!key.equals(other.key))93 return false;94 if (value == null) {95 if (other.value != null)96 return false;97 } else if (!value.equals(other.value))98 return false;99 return true;100 }101 }102 103 49 private static final int FLAG_MODIFIED = 1 << 0; 104 50 private static final int FLAG_VISIBLE = 1 << 1; … … 556 502 // FIXME: incline=\"-*\" search pattern does not work. 557 503 String reversedDirectionDefault = "oneway=\"-1\" | incline=down | incline=\"-*\""; 558 504 559 505 String directionDefault = "oneway? | incline=* | aerialway=* | "+ 560 561 562 506 "waterway=stream | waterway=river | waterway=canal | waterway=drain | waterway=rapids | "+ 507 "\"piste:type\"=downhill | \"piste:type\"=sled | man_made=\"piste:halfpipe\" | "+ 508 "junction=roundabout"; 563 509 564 510 try { … … 846 792 } 847 793 848 // FIXME: why replying a collection of entries? Should be replaced by849 // a method Map<String,String> getTags()850 //851 public final Collection<Entry<String, String>> entrySet() {852 if (keys == null || keys.length ==0)853 return Collections.emptySet();854 Set<Entry<String, String>> result = new HashSet<Entry<String,String>>();855 for (int i=0; i<keys.length; i+=2) {856 result.add(new KeysEntry(keys[i], keys[i+1]));857 }858 return result;859 }860 861 794 public final Collection<String> keySet() { 862 795 if (keys == null || keys.length == 0) … … 910 843 */ 911 844 public boolean hasSameTags(OsmPrimitive other) { 912 return entrySet().equals(other.entrySet());845 return keySet().equals(other.keySet()); 913 846 } 914 847 -
trunk/src/org/openstreetmap/josm/gui/MapStatus.java
r2871 r2906 29 29 import java.util.ConcurrentModificationException; 30 30 import java.util.List; 31 import java.util.Map.Entry;32 31 33 32 import javax.swing.BorderFactory; … … 436 435 } 437 436 438 for ( Entry<String, String> e1: osm.entrySet()) {439 text.append("<br>" + e1.getKey()+ "=" +e1.getValue());437 for (String key : osm.keySet()) { 438 text.append("<br>" + key + "=" + osm.get(key)); 440 439 } 441 440 -
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/ListOfUsedTags.java
r2711 r2906 70 70 71 71 private void addPrimitive(OsmPrimitive primitive) { 72 for ( Entry<String, String> entry: primitive.entrySet()) {73 addKey( entry.getKey(), entry.getValue());72 for (String key: primitive.keySet()) { 73 addKey(key, primitive.get(key)); 74 74 } 75 75 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java
r2869 r2906 729 729 ++ways; 730 730 } 731 for (Entry<String, String> e : osm.entrySet()) { 732 keyCount.put(e.getKey(), keyCount.containsKey(e.getKey()) ? keyCount.get(e.getKey())+1 : 1); 733 if (valueCount.containsKey(e.getKey())) { 734 Map<String, Integer> v = valueCount.get(e.getKey()); 735 v.put(e.getValue(), v.containsKey(e.getValue())? v.get(e.getValue())+1 : 1 ); 731 for (String key: osm.keySet()) { 732 String value = osm.get(key); 733 keyCount.put(key, keyCount.containsKey(key) ? keyCount.get(key) + 1 : 1); 734 if (valueCount.containsKey(key)) { 735 Map<String, Integer> v = valueCount.get(key); 736 v.put(value, v.containsKey(value)? v.get(value) + 1 : 1 ); 736 737 } else { 737 738 TreeMap<String,Integer> v = new TreeMap<String, Integer>(); 738 v.put( e.getValue(), 1);739 valueCount.put( e.getKey(), v);739 v.put(value, 1); 740 valueCount.put(key, v); 740 741 } 741 742 } -
trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyles.java
r2626 r2906 7 7 import java.util.LinkedList; 8 8 import java.util.List; 9 import java.util.Map.Entry;10 9 11 10 import org.openstreetmap.josm.Main; … … 40 39 { 41 40 IconElemStyle ret = null; 42 for (Entry<String, String> entry:primitive.entrySet()) { 43 String key = entry.getKey(); 44 String val = entry.getValue(); 41 for (String key: primitive.keySet()) { 42 String val = primitive.get(key); 45 43 IconElemStyle style; 46 44 if((style = icons.get("n" + key + "=" + val)) != null) … … 77 75 String linestring = null; 78 76 HashMap<String, LineElemStyle> over = new HashMap<String, LineElemStyle>(); 79 for (Entry<String, String> entry:primitive.entrySet()) { 80 String key = entry.getKey(); 81 String val = entry.getValue(); 77 for (String key: primitive.keySet()) { 78 String val = primitive.get(key); 82 79 AreaElemStyle styleArea; 83 80 LineElemStyle styleLine;
Note:
See TracChangeset
for help on using the changeset viewer.