Ignore:
Timestamp:
2010-01-29T22:26:58+01:00 (14 years ago)
Author:
mjulius
Message:

remove OsmPrimitive.entrySet()
using keySet()/get() or getKeys() instead

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java

    r2903 r2906  
    4747    }
    4848
    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         @Override
    72         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         @Override
    81         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 
    10349    private static final int FLAG_MODIFIED = 1 << 0;
    10450    private static final int FLAG_VISIBLE  = 1 << 1;
     
    556502        // FIXME: incline=\"-*\" search pattern does not work.
    557503        String reversedDirectionDefault = "oneway=\"-1\" | incline=down | incline=\"-*\"";
    558        
     504
    559505        String directionDefault = "oneway? | incline=* | aerialway=* | "+
    560                                   "waterway=stream | waterway=river | waterway=canal | waterway=drain | waterway=rapids | "+
    561                                   "\"piste:type\"=downhill | \"piste:type\"=sled | man_made=\"piste:halfpipe\" | "+
    562                                   "junction=roundabout";
     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";
    563509
    564510        try {
     
    846792    }
    847793
    848     // FIXME: why replying a collection of entries? Should be replaced by
    849     // 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 
    861794    public final Collection<String> keySet() {
    862795        if (keys == null || keys.length == 0)
     
    910843     */
    911844    public boolean hasSameTags(OsmPrimitive other) {
    912         return entrySet().equals(other.entrySet());
     845        return keySet().equals(other.keySet());
    913846    }
    914847
Note: See TracChangeset for help on using the changeset viewer.