Changeset 9980 in josm for trunk/src/org/openstreetmap/josm/data/osm/Storage.java
- Timestamp:
- 2016-03-13T16:31:38+01:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/Storage.java
r9975 r9980 144 144 this.hash = ha; 145 145 int cap = 1 << (int) (Math.ceil(Math.log(capacity/LOAD_FACTOR) / Math.log(2))); 146 @SuppressWarnings("unchecked") T[] newData = (T[]) new Object[cap]; 146 @SuppressWarnings("unchecked") 147 T[] newData = (T[]) new Object[cap]; 147 148 data = newData; 148 149 mask = data.length - 1; … … 175 176 @Override 176 177 public synchronized boolean contains(Object o) { 177 @SuppressWarnings("unchecked") T t = (T) o; 178 @SuppressWarnings("unchecked") 179 T t = (T) o; 178 180 int bucket = getBucket(hash, t); 179 181 return bucket >= 0; … … 188 190 @Override 189 191 public synchronized boolean remove(Object o) { 190 @SuppressWarnings("unchecked") T t = (T) o; 192 @SuppressWarnings("unchecked") 193 T t = (T) o; 191 194 T tOrig = removeElem(t); 192 195 return tOrig != null; … … 329 332 private void ensureSpace() { 330 333 if (size > data.length*LOAD_FACTOR) { // rehash 331 @SuppressWarnings("unchecked") T[] big = (T[]) new Object[data.length * 2]; 334 @SuppressWarnings("unchecked") 335 T[] big = (T[]) new Object[data.length * 2]; 332 336 int nMask = big.length - 1; 333 337 … … 387 391 @Override 388 392 public boolean containsKey(Object o) { 389 @SuppressWarnings("unchecked") K key = (K) o; 393 @SuppressWarnings("unchecked") 394 K key = (K) o; 390 395 int bucket = getBucket(fHash, key); 391 396 return bucket >= 0; … … 399 404 @Override 400 405 public T get(Object o) { 401 @SuppressWarnings("unchecked") K key = (K) o; 406 @SuppressWarnings("unchecked") 407 K key = (K) o; 402 408 int bucket = getBucket(fHash, key); 403 409 return bucket < 0 ? null : data[bucket]; … … 414 420 synchronized (Storage.this) { 415 421 modCount++; 416 @SuppressWarnings("unchecked") K key = (K) o; 422 @SuppressWarnings("unchecked") 423 K key = (K) o; 417 424 int bucket = getBucket(fHash, key); 418 425
Note:
See TracChangeset
for help on using the changeset viewer.