Changeset 3158 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2010-03-27T17:53:47+01:00 (15 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/data
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/coor/QuadTiling.java
r3145 r3158 69 69 { 70 70 //return Math.round((lon + 180.0) * QuadBuckets.WORLD_PARTS / 360.0)-1; 71 long ret = (long) Math.floor((lon + 180.0) * WORLD_PARTS / 360.0);71 long ret = (long)((lon + 180.0) * WORLD_PARTS / 360.0); 72 72 if (ret == WORLD_PARTS) { 73 73 ret--; … … 78 78 { 79 79 //return Math.round((lat + 90.0) * QuadBuckets.WORLD_PARTS / 180.0)-1; 80 long ret = (long) Math.floor((lat + 90.0) * WORLD_PARTS / 180.0);80 long ret = (long)((lat + 90.0) * WORLD_PARTS / 180.0); 81 81 if (ret == WORLD_PARTS) { 82 82 ret--; -
trunk/src/org/openstreetmap/josm/data/osm/Storage.java
r3083 r3158 82 82 * assert things.get(new Thing(3)) == fk.get(3); 83 83 * </pre></li> 84 *84 * 85 85 * 86 86 * @author nenik … … 114 114 115 115 // --------------- Collection implementation ------------------------ 116 @Override 116 117 public int size() { 117 118 return size; 118 119 } 119 120 121 @Override 120 122 public Iterator<T> iterator() { 121 123 return new Iter(); … … 129 131 public @Override boolean add(T t) { 130 132 T orig = putUnique(t); 131 return orig != t;133 return orig == t; 132 134 } 133 135 … … 140 142 modCount++; 141 143 size = 0; 142 for (int i = 0; i<data.length; i++) data[i] = null; 144 for (int i = 0; i<data.length; i++) { 145 data[i] = null; 146 } 143 147 } 144 148 145 149 public @Override int hashCode() { 146 150 int h = 0; 147 for (T t : this) h += hash.getHashCode(t); 151 for (T t : this) { 152 h += hash.getHashCode(t); 153 } 148 154 return h; 149 155 } … … 220 226 int bucket = hcode & mask; 221 227 while ((entry = (T)data[bucket]) != null) { 222 if (ha.equals(key, entry)) {228 if (ha.equals(key, entry)) 223 229 return bucket; 224 }225 230 bucket = (bucket+1) & mask; 226 231 } … … 265 270 266 271 for (Object o : data) { 267 if (o == null) continue; 272 if (o == null) { 273 continue; 274 } 268 275 int bucket = rehash(hash.getHashCode((T)o)) & nMask; 269 while (big[bucket] != null) bucket = (bucket+1) & nMask; 276 while (big[bucket] != null) { 277 bucket = (bucket+1) & nMask; 278 } 270 279 big[bucket] = o; 271 280 } … … 292 301 }; 293 302 } 294 /*303 /* 295 304 public static <O> Hash<O,O> identityHash() { 296 305 return new Hash<O,O>() { … … 303 312 }; 304 313 } 305 */314 */ 306 315 307 316 private class FMap<K> implements Map<K,T> { … … 350 359 Storage.this.addAll(((Storage.FMap)m).values()); 351 360 } else { 352 for (Map.Entry<? extends K, ? extends T> e : m.entrySet()) 361 for (Map.Entry<? extends K, ? extends T> e : m.entrySet()) { 353 362 put(e.getKey(), e.getValue()); 363 } 354 364 } 355 365 } … … 402 412 private void align() { 403 413 if (mods != modCount) throw new ConcurrentModificationException(); 404 while (slot < data.length && data[slot] == null) slot++; 414 while (slot < data.length && data[slot] == null) { 415 slot++; 416 } 405 417 } 406 418 }
Note:
See TracChangeset
for help on using the changeset viewer.