Changeset 3398 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2010-07-31T17:12:26+02:00 (14 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java
r3348 r3398 1511 1511 builder.append("D"); 1512 1512 } 1513 if (isFiltered()) {1514 builder.append("f");1515 }1516 1513 if (isDisabled()) { 1517 builder.append("d"); 1514 if (isDisabledAndHidden()) { 1515 builder.append("h"); 1516 } else { 1517 builder.append("d"); 1518 } 1518 1519 } 1519 1520 if (isTagged()) { -
trunk/src/org/openstreetmap/josm/data/osm/Storage.java
r3207 r3398 88 88 public class Storage<T> extends AbstractSet<T> { 89 89 private final Hash<? super T,? super T> hash; 90 private Object[] data;90 private T[] data; 91 91 private int mask; 92 92 private int size; … … 111 111 this.hash = ha; 112 112 int cap = 1 << (int)(Math.ceil(Math.log(capacity/loadFactor) / Math.log(2))); 113 data = new Object[cap];113 data = (T[]) new Object[cap]; 114 114 mask = data.length - 1; 115 115 this.safeIterator = safeIterator; … … 118 118 private void copyArray() { 119 119 if (arrayCopyNecessary) { 120 Object[] newData =new Object[data.length];120 T[] newData = (T[]) new Object[data.length]; 121 121 System.arraycopy(data, 0, newData, 0, data.length); 122 122 data = newData; … … 141 141 } 142 142 143 public synchronized @Override boolean contains(Object o) { 143 @Override 144 public synchronized boolean contains(Object o) { 144 145 int bucket = getBucket(hash, (T)o); 145 146 return bucket >= 0; 146 147 } 147 148 148 public synchronized @Override boolean add(T t) { 149 @Override 150 public synchronized boolean add(T t) { 149 151 T orig = putUnique(t); 150 152 return orig == t; 151 153 } 152 154 153 public synchronized @Override boolean remove(Object o) { 155 @Override 156 public synchronized boolean remove(Object o) { 154 157 T orig = removeElem((T)o); 155 158 return orig != null; 156 159 } 157 158 public synchronized @Override void clear() { 160 161 @Override 162 public synchronized void clear() { 159 163 copyArray(); 160 164 modCount++; … … 165 169 } 166 170 167 public synchronized @Override int hashCode() { 171 @Override 172 public synchronized int hashCode() { 168 173 int h = 0; 169 174 for (T t : this) { … … 187 192 } 188 193 189 T old = (T)data[bucket];194 T old = data[bucket]; 190 195 data[bucket] = t; 191 196 … … 195 200 public synchronized T get(T t) { 196 201 int bucket = getBucket(hash, t); 197 return bucket < 0 ? null : (T)data[bucket];202 return bucket < 0 ? null : data[bucket]; 198 203 } 199 204 … … 211 216 } 212 217 213 return (T)data[bucket];218 return data[bucket]; 214 219 } 215 220 … … 222 227 223 228 public <K> Map<K,T> foreignKey(Hash<K,? super T> h) { 224 return new FMap (h);229 return new FMap<K>(h); 225 230 } 226 231 … … 246 251 int hcode = rehash(ha.getHashCode(key)); 247 252 int bucket = hcode & mask; 248 while ((entry = (T)data[bucket]) != null) {253 while ((entry = data[bucket]) != null) { 249 254 if (ha.equals(key, entry)) 250 255 return bucket; … … 255 260 256 261 private T doRemove(int slot) { 257 T t = (T)data[slot];262 T t = data[slot]; 258 263 assert t != null; 259 264 … … 267 272 T entry; 268 273 269 while ((entry = (T)data[bucket]) != null) {274 while ((entry = data[bucket]) != null) { 270 275 int right = rehash(hash.getHashCode(entry)) & mask; 271 276 // if the entry should be in <hole+1,bucket-1> (circular-wise) … … 287 292 private void ensureSpace() { 288 293 if (size > data.length*loadFactor) { // rehash 289 Object[] big =new Object[data.length * 2];294 T[] big = (T[]) new Object[data.length * 2]; 290 295 int nMask = big.length - 1; 291 296 292 for ( Objecto : data) {297 for (T o : data) { 293 298 if (o == null) { 294 299 continue; 295 300 } 296 int bucket = rehash(hash.getHashCode( (T)o)) & nMask;301 int bucket = rehash(hash.getHashCode(o)) & nMask; 297 302 while (big[bucket] != null) { 298 303 bucket = (bucket+1) & nMask; … … 361 366 public T get(Object key) { 362 367 int bucket = getBucket(fHash, (K)key); 363 return bucket < 0 ? null : (T)data[bucket];368 return bucket < 0 ? null : data[bucket]; 364 369 } 365 370 … … 404 409 405 410 private final class SafeReadonlyIter implements Iterator<T> { 406 final Object[] data;411 final T[] data; 407 412 int slot = 0; 408 413 409 SafeReadonlyIter( Object[] data) {414 SafeReadonlyIter(T[] data) { 410 415 this.data = data; 411 416 } … … 418 423 public T next() { 419 424 if (!hasNext()) throw new NoSuchElementException(); 420 return (T)data[slot++];425 return data[slot++]; 421 426 } 422 427 … … 450 455 if (!hasNext()) throw new NoSuchElementException(); 451 456 removeSlot = slot; 452 return (T)data[slot++];457 return data[slot++]; 453 458 } 454 459 -
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/MapPainter.java
r3291 r3398 310 310 GeneralPath path = new GeneralPath(); 311 311 for (Way osm: ways){ 312 if (osm.isUsable() && !osm.is Filtered() && !osm.isDisabled()) {312 if (osm.isUsable() && !osm.isDisabled()) { 313 313 visitVirtual(path, osm); 314 314 } -
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/SimplePaintVisitor.java
r3243 r3398 155 155 //profilerN = 0; 156 156 for (final OsmPrimitive osm: data.searchRelations(bbox)) { 157 if (!osm.isDeleted() && !ds.isSelected(osm) && !osm.is Filtered()) {157 if (!osm.isDeleted() && !ds.isSelected(osm) && !osm.isDisabledAndHidden()) { 158 158 osm.visit(this); 159 159 // profilerN++; … … 169 169 //profilerN = 0; 170 170 for (final OsmPrimitive osm:data.searchWays(bbox)){ 171 if (!osm.isDeleted() && !ds.isSelected(osm) && !osm.is Filtered() && osm.isTagged()) {171 if (!osm.isDeleted() && !ds.isSelected(osm) && !osm.isDisabledAndHidden() && osm.isTagged()) { 172 172 osm.visit(this); 173 173 // profilerN++; … … 177 177 178 178 for (final OsmPrimitive osm:data.searchWays(bbox)){ 179 if (!osm.isDeleted() && !ds.isSelected(osm) && !osm.is Filtered() && !osm.isTagged()) {179 if (!osm.isDeleted() && !ds.isSelected(osm) && !osm.isDisabledAndHidden() && !osm.isTagged()) { 180 180 osm.visit(this); 181 181 // profilerN++; … … 207 207 //profilerN = 0; 208 208 for (final OsmPrimitive osm: data.searchNodes(bbox)) { 209 if (!osm.isDeleted() && !ds.isSelected(osm) && !osm.is Filtered())209 if (!osm.isDeleted() && !ds.isSelected(osm) && !osm.isDisabledAndHidden()) 210 210 { 211 211 osm.visit(this); … … 295 295 GeneralPath path = new GeneralPath(); 296 296 for (Way osm: ways){ 297 if (osm.isUsable() && !osm.is Filtered() && !osm.isDisabled()) {297 if (osm.isUsable() && !osm.isDisabledAndHidden() && !osm.isDisabled()) { 298 298 visitVirtual(path, osm); 299 299 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/InspectPrimitiveDialog.java
r3262 r3398 149 149 s.append("; modified"); 150 150 } 151 if (o.is Filtered()) {151 if (o.isDisabledAndHidden()) { 152 152 s.append("; filtered/hidden"); 153 153 }
Note:
See TracChangeset
for help on using the changeset viewer.