Changeset 30737 in osm for applications/editors/josm/plugins/imagerycache/src/org
- Timestamp:
- 2014-10-18T23:07:52+02:00 (10 years ago)
- Location:
- applications/editors/josm/plugins/imagerycache/src/org
- Files:
-
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/imagerycache/src/org/mapdb/AsyncWriteEngine.java
r30532 r30737 36 36 protected final long threadNum = threadCounter.incrementAndGet(); 37 37 38 protected final BlockingQueue<Long> newRecids = new ArrayBlockingQueue< Long>(128);38 protected final BlockingQueue<Long> newRecids = new ArrayBlockingQueue<>(128); 39 39 40 40 protected volatile boolean closeInProgress = false; … … 266 266 */ 267 267 public void setParentEngineReference(Engine parentEngineReference) { 268 parentEngineWeakRef = new WeakReference< Engine>(parentEngineReference);268 parentEngineWeakRef = new WeakReference<>(parentEngineReference); 269 269 } 270 270 -
applications/editors/josm/plugins/imagerycache/src/org/mapdb/Atomic.java
r29363 r30737 213 213 long recid = db.getEngine().put(initVal, serializer); 214 214 db.getNameDir().put(name, recid); 215 return new Var< E>(db.getEngine(), recid, serializer);215 return new Var<>(db.getEngine(), recid, serializer); 216 216 } 217 217 … … 230 230 return recid == null ? 231 231 createVar(db, name, null, serializer) : 232 new Var< E>(db.getEngine(),recid, serializer);232 new Var<>(db.getEngine(),recid, serializer); 233 233 } 234 234 -
applications/editors/josm/plugins/imagerycache/src/org/mapdb/BTreeMap.java
r30532 r30737 114 114 115 115 /** holds node level locks*/ 116 protected final LongConcurrentHashMap<Thread> nodeLocks = new LongConcurrentHashMap< Thread>();116 protected final LongConcurrentHashMap<Thread> nodeLocks = new LongConcurrentHashMap<>(); 117 117 118 118 /** maximal node size allowed in this BTree*/ … … 963 963 protected Entry<K, V> makeEntry(Object key, Object value) { 964 964 if(value instanceof ValRef) throw new InternalError(); 965 return new SimpleImmutableEntry< K, V>((K)key, (V)value);965 return new SimpleImmutableEntry<>((K)key, (V)value); 966 966 } 967 967 … … 1336 1336 if (fromKey == null || toKey == null) 1337 1337 throw new NullPointerException(); 1338 return new SubMap< K,V>1338 return new SubMap<> 1339 1339 ( this, fromKey, fromInclusive, toKey, toInclusive); 1340 1340 } … … 1345 1345 if (toKey == null) 1346 1346 throw new NullPointerException(); 1347 return new SubMap< K,V>1347 return new SubMap<> 1348 1348 (this, null, false, toKey, inclusive); 1349 1349 } … … 1354 1354 if (fromKey == null) 1355 1355 throw new NullPointerException(); 1356 return new SubMap< K,V>1356 return new SubMap<> 1357 1357 (this, fromKey, inclusive, null, false); 1358 1358 } … … 1421 1421 static final <E> List<E> toList(Collection<E> c) { 1422 1422 // Using size() here would be a pessimization. 1423 List<E> list = new ArrayList< E>();1423 List<E> list = new ArrayList<>(); 1424 1424 for (E e : c){ 1425 1425 list.add(e); … … 1506 1506 E toElement, 1507 1507 boolean toInclusive) { 1508 return new KeySet< E>(m.subMap(fromElement, fromInclusive,1508 return new KeySet<>(m.subMap(fromElement, fromInclusive, 1509 1509 toElement, toInclusive),hasValues); 1510 1510 } 1511 1511 @Override 1512 1512 public NavigableSet<E> headSet(E toElement, boolean inclusive) { 1513 return new KeySet< E>(m.headMap(toElement, inclusive),hasValues);1513 return new KeySet<>(m.headMap(toElement, inclusive),hasValues); 1514 1514 } 1515 1515 @Override 1516 1516 public NavigableSet<E> tailSet(E fromElement, boolean inclusive) { 1517 return new KeySet< E>(m.tailMap(fromElement, inclusive),hasValues);1517 return new KeySet<>(m.tailMap(fromElement, inclusive),hasValues); 1518 1518 } 1519 1519 @Override … … 1937 1937 } 1938 1938 } 1939 return new SubMap< K,V>(m, fromKey, fromInclusive,1939 return new SubMap<>(m, fromKey, fromInclusive, 1940 1940 toKey, toInclusive); 1941 1941 } … … 1989 1989 @Override 1990 1990 public NavigableSet<K> navigableKeySet() { 1991 return new KeySet< K>((ConcurrentNavigableMap<K,Object>) this,m.hasValues);1991 return new KeySet<>((ConcurrentNavigableMap<K,Object>) this,m.hasValues); 1992 1992 } 1993 1993 … … 2032 2032 @Override 2033 2033 public NavigableSet<K> keySet() { 2034 return new KeySet< K>((ConcurrentNavigableMap<K,Object>) this, m.hasValues);2034 return new KeySet<>((ConcurrentNavigableMap<K,Object>) this, m.hasValues); 2035 2035 } 2036 2036 … … 2044 2044 @Override 2045 2045 public Set<Entry<K, V>> entrySet() { 2046 return new EntrySet< K, V>(this);2046 return new EntrySet<>(this); 2047 2047 } 2048 2048 … … 2123 2123 Engine snapshot = SnapshotEngine.createSnapshotFor(engine); 2124 2124 2125 return new BTreeMap< K, V>(snapshot,treeRecid, defaultSerializer);2125 return new BTreeMap<>(snapshot,treeRecid, defaultSerializer); 2126 2126 } 2127 2127 -
applications/editors/josm/plugins/imagerycache/src/org/mapdb/CacheHardRef.java
r29363 r30737 31 31 32 32 public CacheHardRef(Engine engine, int initialCapacity) { 33 super(engine, new LongConcurrentHashMap< Object>(initialCapacity));33 super(engine, new LongConcurrentHashMap<>(initialCapacity)); 34 34 } 35 35 -
applications/editors/josm/plugins/imagerycache/src/org/mapdb/CacheLRU.java
r30532 r30737 16 16 17 17 public CacheLRU(Engine engine, int cacheSize) { 18 this(engine, new LongConcurrentLRUMap< Object>(cacheSize, (int) (cacheSize*0.8)));18 this(engine, new LongConcurrentLRUMap<>(cacheSize, (int) (cacheSize*0.8))); 19 19 } 20 20 -
applications/editors/josm/plugins/imagerycache/src/org/mapdb/CacheWeakSoftRef.java
r29484 r30737 79 79 80 80 81 protected LongConcurrentHashMap<CacheItem> items = new LongConcurrentHashMap< CacheItem>();81 protected LongConcurrentHashMap<CacheItem> items = new LongConcurrentHashMap<>(); 82 82 83 83 … … 157 157 ReferenceQueue<A> q = checkClosed(queue); 158 158 checkClosed(items).put(recid, useWeakRef? 159 new CacheWeakItem< A>(value, q, recid) :160 new CacheSoftItem< A>(value, q, recid));159 new CacheWeakItem<>(value, q, recid) : 160 new CacheSoftItem<>(value, q, recid)); 161 161 } 162 162 -
applications/editors/josm/plugins/imagerycache/src/org/mapdb/CompressLZF.java
r29484 r30737 346 346 */ 347 347 public static <E> Serializer<E> CompressionWrapper(Serializer<E> serializer) { 348 return new Serializer.CompressSerializerWrapper< E>(serializer);348 return new Serializer.CompressSerializerWrapper<>(serializer); 349 349 } 350 350 -
applications/editors/josm/plugins/imagerycache/src/org/mapdb/DB.java
r29484 r30737 32 32 protected Engine engine; 33 33 /** already loaded named collections. It is important to keep collections as singletons, because of 'in-memory' locking*/ 34 protected Map<String, WeakReference<?>> collections = new HashMap< String, WeakReference<?>>();34 protected Map<String, WeakReference<?>> collections = new HashMap<>(); 35 35 36 36 /** view over named records */ … … 79 79 if(recid!=null){ 80 80 //open existing map 81 ret = new HTreeMap< K,V>(engine, recid,defaultSerializer);81 ret = new HTreeMap<>(engine, recid,defaultSerializer); 82 82 if(!ret.hasValues) throw new ClassCastException("Collection is Set, not Map"); 83 83 }else{ 84 84 //create new map 85 ret = new HTreeMap< K,V>(engine,true,false,Utils.RANDOM.nextInt(), defaultSerializer,null, null);85 ret = new HTreeMap<>(engine,true,false,Utils.RANDOM.nextInt(), defaultSerializer,null, null); 86 86 nameDir.put(name, ret.rootRecid); 87 87 } … … 106 106 String name, boolean keepCounter, Serializer<K> keySerializer, Serializer<V> valueSerializer){ 107 107 checkNameNotExists(name); 108 HTreeMap<K,V> ret = new HTreeMap< K,V>(engine, true,keepCounter,Utils.RANDOM.nextInt(), defaultSerializer, keySerializer, valueSerializer);108 HTreeMap<K,V> ret = new HTreeMap<>(engine, true,keepCounter,Utils.RANDOM.nextInt(), defaultSerializer, keySerializer, valueSerializer); 109 109 nameDir.put(name, ret.rootRecid); 110 110 collections.put(name, new WeakReference<Object>(ret)); … … 126 126 if(recid!=null){ 127 127 //open existing map 128 HTreeMap<K,Object> m = new HTreeMap< K,Object>(engine, recid, defaultSerializer);128 HTreeMap<K,Object> m = new HTreeMap<>(engine, recid, defaultSerializer); 129 129 if(m.hasValues) throw new ClassCastException("Collection is Map, not Set"); 130 130 ret = m.keySet(); 131 131 }else{ 132 132 //create new map 133 HTreeMap<K,Object> m = new HTreeMap< K,Object>(engine, false,false, Utils.RANDOM.nextInt(), defaultSerializer, null, null);133 HTreeMap<K,Object> m = new HTreeMap<>(engine, false,false, Utils.RANDOM.nextInt(), defaultSerializer, null, null); 134 134 ret = m.keySet(); 135 135 nameDir.put(name, m.rootRecid); … … 151 151 synchronized public <K> Set<K> createHashSet(String name, boolean keepCounter, Serializer<K> serializer){ 152 152 checkNameNotExists(name); 153 HTreeMap<K,Object> ret = new HTreeMap< K,Object>(engine, false,keepCounter,Utils.RANDOM.nextInt(), defaultSerializer, serializer, null);153 HTreeMap<K,Object> ret = new HTreeMap<>(engine, false,keepCounter,Utils.RANDOM.nextInt(), defaultSerializer, serializer, null); 154 154 nameDir.put(name, ret.rootRecid); 155 155 Set<K> ret2 = ret.keySet(); … … 177 177 if(recid!=null){ 178 178 //open existing map 179 ret = new BTreeMap< K,V>(engine, recid,defaultSerializer);179 ret = new BTreeMap<>(engine, recid,defaultSerializer); 180 180 if(!ret.hasValues) throw new ClassCastException("Collection is Set, not Map"); 181 181 }else{ 182 182 //create new map 183 ret = new BTreeMap< K,V>(engine,BTreeMap.DEFAULT_MAX_NODE_SIZE, true, false,false, defaultSerializer, null, null, null);183 ret = new BTreeMap<>(engine,BTreeMap.DEFAULT_MAX_NODE_SIZE, true, false,false, defaultSerializer, null, null, null); 184 184 nameDir.put(name, ret.treeRecid); 185 185 } … … 206 206 BTreeKeySerializer<K> keySerializer, Serializer<V> valueSerializer, Comparator<K> comparator){ 207 207 checkNameNotExists(name); 208 BTreeMap<K,V> ret = new BTreeMap< K,V>(engine, nodeSize, true,valuesStoredOutsideNodes, keepCounter,defaultSerializer, keySerializer, valueSerializer, comparator);208 BTreeMap<K,V> ret = new BTreeMap<>(engine, nodeSize, true,valuesStoredOutsideNodes, keepCounter,defaultSerializer, keySerializer, valueSerializer, comparator); 209 209 nameDir.put(name, ret.treeRecid); 210 210 collections.put(name, new WeakReference<Object>(ret)); … … 236 236 if(recid!=null){ 237 237 //open existing map 238 BTreeMap<K,Object> m = new BTreeMap< K,Object>(engine, recid, defaultSerializer);238 BTreeMap<K,Object> m = new BTreeMap<>(engine, recid, defaultSerializer); 239 239 if(m.hasValues) throw new ClassCastException("Collection is Map, not Set"); 240 240 ret = m.keySet(); 241 241 }else{ 242 242 //create new map 243 BTreeMap<K,Object> m = new BTreeMap< K,Object>(engine,BTreeMap.DEFAULT_MAX_NODE_SIZE,243 BTreeMap<K,Object> m = new BTreeMap<>(engine,BTreeMap.DEFAULT_MAX_NODE_SIZE, 244 244 false, false,false, defaultSerializer, null, null, null); 245 245 nameDir.put(name, m.treeRecid); … … 264 264 synchronized public <K> NavigableSet<K> createTreeSet(String name,int nodeSize, boolean keepCounter, BTreeKeySerializer<K> serializer, Comparator<K> comparator){ 265 265 checkNameNotExists(name); 266 BTreeMap<K,Object> ret = new BTreeMap< K,Object>(engine, nodeSize, false, false, keepCounter, defaultSerializer, serializer, null, comparator);266 BTreeMap<K,Object> ret = new BTreeMap<>(engine, nodeSize, false, false, keepCounter, defaultSerializer, serializer, null, comparator); 267 267 nameDir.put(name, ret.treeRecid); 268 268 NavigableSet<K> ret2 = ret.keySet(); -
applications/editors/josm/plugins/imagerycache/src/org/mapdb/EngineWrapper.java
r30532 r30737 228 228 //TODO CAS 229 229 230 final Queue<Record> records = new ConcurrentLinkedQueue< Record>();230 final Queue<Record> records = new ConcurrentLinkedQueue<>(); 231 231 232 232 … … 337 337 if(item!=null) item.check(); 338 338 A ret = super.get(recid, serializer); 339 if(ret!=null) items.put(recid, new Item< A>(serializer,ret));339 if(ret!=null) items.put(recid, new Item<>(serializer,ret)); 340 340 return ret; 341 341 } … … 344 344 public <A> long put(A value, Serializer<A> serializer) { 345 345 long ret = super.put(value, serializer); 346 if(value!=null) items.put(ret, new Item< A>(serializer,value));346 if(value!=null) items.put(ret, new Item<>(serializer,value)); 347 347 return ret; 348 348 } … … 353 353 if(item!=null) item.check(); 354 354 super.update(recid, value, serializer); 355 if(value!=null) items.put(recid, new Item< A>(serializer,value));355 if(value!=null) items.put(recid, new Item<>(serializer,value)); 356 356 } 357 357 -
applications/editors/josm/plugins/imagerycache/src/org/mapdb/Fun.java
r29363 r30737 43 43 44 44 public static <A,B> Tuple2<A,B> t2(A a, B b) { 45 return new Tuple2< A, B>(a,b);45 return new Tuple2<>(a,b); 46 46 } 47 47 48 48 public static <A,B,C> Tuple3<A,B,C> t3(A a, B b, C c) { 49 return new Tuple3< A, B, C>((A)a, (B)b, (C)c);49 return new Tuple3<>((A)a, (B)b, (C)c); 50 50 } 51 51 52 52 public static <A,B,C,D> Tuple4<A,B,C,D> t4(A a, B b, C c, D d) { 53 return new Tuple4< A, B, C, D>(a,b,c,d);53 return new Tuple4<>(a,b,c,d); 54 54 } 55 55 -
applications/editors/josm/plugins/imagerycache/src/org/mapdb/HTreeMap.java
r29484 r30737 137 137 @Override 138 138 public LinkedNode<K,V> deserialize(DataInput in, int available) throws IOException { 139 return new LinkedNode< K, V>(139 return new LinkedNode<>( 140 140 Utils.unpackLong(in), 141 141 (K) keySerializer.deserialize(in,-1), … … 294 294 HashRoot r = engine.get(Engine.NAME_DIR_RECID, serializer); 295 295 if(r!=null) 296 return new HTreeMap< String, Long>(engine, Engine.NAME_DIR_RECID, Serializer.BASIC_SERIALIZER);296 return new HTreeMap<>(engine, Engine.NAME_DIR_RECID, Serializer.BASIC_SERIALIZER); 297 297 298 298 if(engine.isReadOnly()) … … 310 310 engine.update(Engine.NAME_DIR_RECID, r, serializer); 311 311 //and now load it 312 return new HTreeMap< String, Long>(engine, Engine.NAME_DIR_RECID, Serializer.BASIC_SERIALIZER);312 return new HTreeMap<>(engine, Engine.NAME_DIR_RECID, Serializer.BASIC_SERIALIZER); 313 313 314 314 } … … 482 482 //found, replace value at this node 483 483 V oldVal = ln.value; 484 ln = new LinkedNode< K, V>(ln.next, ln.key, value);484 ln = new LinkedNode<>(ln.next, ln.key, value); 485 485 engine.update(recid, ln, LN_SERIALIZER); 486 486 notify(key, oldVal, value); … … 503 503 int pos =(h >>>(7*(level-1) )) & 0x7F; 504 504 nextDir[pos/8] = new long[8]; 505 nextDir[pos/8][pos%8] = (engine.put(new LinkedNode< K, V>(0, key, value), LN_SERIALIZER) <<1) | 1;505 nextDir[pos/8][pos%8] = (engine.put(new LinkedNode<>(0, key, value), LN_SERIALIZER) <<1) | 1; 506 506 } 507 507 … … 514 514 int pos = (hash(n.key) >>>(7*(level -1) )) & 0x7F; 515 515 if(nextDir[pos/8]==null) nextDir[pos/8] = new long[8]; 516 n = new LinkedNode< K, V>(nextDir[pos/8][pos%8]>>>1, n.key, n.value);516 n = new LinkedNode<>(nextDir[pos/8][pos%8]>>>1, n.key, n.value); 517 517 nextDir[pos/8][pos%8] = (nodeRecid<<1) | 1; 518 518 engine.update(nodeRecid, n, LN_SERIALIZER); … … 530 530 // record does not exist in linked list, so create new one 531 531 recid = dir[slot/8][slot%8]>>>1; 532 long newRecid = engine.put(new LinkedNode< K, V>(recid, key, value), LN_SERIALIZER);532 long newRecid = engine.put(new LinkedNode<>(recid, key, value), LN_SERIALIZER); 533 533 dir[slot/8][slot%8] = (newRecid<<1) | 1; 534 534 engine.update(dirRecid, dir, DIR_SERIALIZER); … … 601 601 }else{ 602 602 //referenced from LinkedNode 603 prevLn = new LinkedNode< K, V>(ln.next, prevLn.key, prevLn.value);603 prevLn = new LinkedNode<>(ln.next, prevLn.key, prevLn.value); 604 604 engine.update(prevRecid, prevLn, LN_SERIALIZER); 605 605 } … … 1176 1176 public Map<K,V> snapshot(){ 1177 1177 Engine snapshot = SnapshotEngine.createSnapshotFor(engine); 1178 return new HTreeMap< K, V>(snapshot,rootRecid, defaultSerialzierForSnapshots);1178 return new HTreeMap<>(snapshot,rootRecid, defaultSerialzierForSnapshots); 1179 1179 } 1180 1180 -
applications/editors/josm/plugins/imagerycache/src/org/mapdb/LongConcurrentHashMap.java
r29363 r30737 386 386 oldValue = null; 387 387 ++modCount; 388 tab[index] = new HashEntry< V>(key, hash, first, value);388 tab[index] = new HashEntry<>(key, hash, first, value); 389 389 count = c; // write-volatile 390 390 } … … 448 448 int k = p.hash & sizeMask; 449 449 HashEntry<V> n = newTable[k]; 450 newTable[k] = new HashEntry< V>(p.key, p.hash,450 newTable[k] = new HashEntry<>(p.key, p.hash, 451 451 n, p.value); 452 452 } … … 482 482 HashEntry<V> newFirst = e.next; 483 483 for (HashEntry<V> p = first; p != e; p = p.next) 484 newFirst = new HashEntry< V>(p.key, p.hash,484 newFirst = new HashEntry<>(p.key, p.hash, 485 485 newFirst, p.value); 486 486 tab[index] = newFirst; … … 559 559 560 560 for (int i = 0; i < this.segments.length; ++i) 561 this.segments[i] = new Segment< V>(cap, loadFactor);561 this.segments[i] = new Segment<>(cap, loadFactor); 562 562 } 563 563 -
applications/editors/josm/plugins/imagerycache/src/org/mapdb/LongHashMap.java
r29363 r30737 379 379 380 380 Entry<V> createHashedEntry(long key, int index, int hash) { 381 Entry<V> entry = new Entry< V>(key,hash);381 Entry<V> entry = new Entry<>(key,hash); 382 382 entry.next = elementData[index]; 383 383 elementData[index] = entry; … … 466 466 @Override 467 467 public Iterator<V> valuesIterator() { 468 return new ValueIterator< V>(this);468 return new ValueIterator<>(this); 469 469 } 470 470 471 471 @Override 472 472 public LongMapIterator<V> longMapIterator() { 473 return new EntryIterator< V>(this);473 return new EntryIterator<>(this); 474 474 } 475 475 -
applications/editors/josm/plugins/imagerycache/src/org/mapdb/Queues.java
r30532 r30737 44 44 public Node<E> deserialize(DataInput in, int available) throws IOException { 45 45 if(available==0)return Node.EMPTY; 46 return new Node< E>(Utils.unpackLong(in), serializer.deserialize(in,-1));46 return new Node<>(Utils.unpackLong(in), serializer.deserialize(in,-1)); 47 47 } 48 48 } … … 56 56 if(headRecid == 0) headRecid = engine.put(0L, Serializer.LONG_SERIALIZER); 57 57 head = new Atomic.Long(engine,headRecid); 58 nodeSerializer = new NodeSerializer< E>(serializer);58 nodeSerializer = new NodeSerializer<>(serializer); 59 59 } 60 60 … … 246 246 public boolean add(E e) { 247 247 long head2 = head.get(); 248 Node<E> n = new Node< E>(head2, e);248 Node<E> n = new Node<>(head2, e); 249 249 long recid = engine.put(n, nodeSerializer); 250 250 while(!head.compareAndSet(head2, recid)){ 251 251 //failed to update head, so read new value and start over 252 252 head2 = head.get(); 253 n = new Node< E>(head2, e);253 n = new Node<>(head2, e); 254 254 engine.update(recid, n, nodeSerializer); 255 255 } … … 307 307 static <E> Stack<E> getStack(Engine engine, Serializer<Serializer> serializerSerializer, long rootRecid){ 308 308 StackRoot root = engine.get(rootRecid, new StackRootSerializer(serializerSerializer)); 309 return new Stack< E>(engine, root.serializer, root.headerRecid, root.useLocks);309 return new Stack<>(engine, root.serializer, root.headerRecid, root.useLocks); 310 310 } 311 311 … … 330 330 public boolean add(E item){ 331 331 final long nextTail = engine.put((Node<E>)Node.EMPTY, nodeSerializer); 332 Node<E> n = new Node< E>(nextTail, item);332 Node<E> n = new Node<>(nextTail, item); 333 333 long tail2 = tail.get(); 334 334 while(!engine.compareAndSwap(tail2, (Node<E>)Node.EMPTY, n, nodeSerializer)){ … … 435 435 static <E> Queue<E> getQueue(Engine engine, Serializer<Serializer> serializerSerializer, long rootRecid){ 436 436 QueueRoot root = engine.get(rootRecid, new QueueRootSerializer(serializerSerializer)); 437 return new Queue< E>(engine, root.serializer, root.headerRecid, root.nextTailRecid,root.sizeRecid);437 return new Queue<>(engine, root.serializer, root.headerRecid, root.nextTailRecid,root.sizeRecid); 438 438 } 439 439 … … 459 459 long nRecid = headInsert.get(); 460 460 Node<E> n = engine.get(nRecid, nodeSerializer); 461 n = new Node< E>(n.next, (E) o);461 n = new Node<>(n.next, (E) o); 462 462 engine.update(nRecid, n, nodeSerializer); 463 463 headInsert.set(n.next); … … 579 579 static <E> CircularQueue<E> getCircularQueue(Engine engine, Serializer<Serializer> serializerSerializer, long rootRecid){ 580 580 CircularQueueRoot root = engine.get(rootRecid, new CircularQueueRootSerializer(serializerSerializer)); 581 return new CircularQueue< E>(engine, root.serializer, root.headerRecid, root.headerInsertRecid,root.sizeRecid);581 return new CircularQueue<>(engine, root.serializer, root.headerRecid, root.headerInsertRecid,root.sizeRecid); 582 582 } 583 583 -
applications/editors/josm/plugins/imagerycache/src/org/mapdb/SerializerBase.java
r30532 r30737 1301 1301 private ArrayList<Object> deserializeArrayList(DataInput is, FastArrayList<Object> objectStack) throws IOException { 1302 1302 int size = Utils.unpackInt(is); 1303 ArrayList<Object> s = new ArrayList< Object>(size);1303 ArrayList<Object> s = new ArrayList<>(size); 1304 1304 objectStack.add(s); 1305 1305 for (int i = 0; i < size; i++) { … … 1314 1314 throw new EOFException(); 1315 1315 1316 ArrayList<Object> s = new ArrayList< Object>(size);1316 ArrayList<Object> s = new ArrayList<>(size); 1317 1317 for (int i = 0; i < size; i++) { 1318 1318 long l = Utils.unpackLong(is); … … 1338 1338 private Vector<Object> deserializeVector(DataInput is, FastArrayList<Object> objectStack) throws IOException { 1339 1339 int size = Utils.unpackInt(is); 1340 Vector<Object> s = new Vector< Object>(size);1340 Vector<Object> s = new Vector<>(size); 1341 1341 objectStack.add(s); 1342 1342 for (int i = 0; i < size; i++) … … 1348 1348 private HashSet<Object> deserializeHashSet(DataInput is, FastArrayList<Object> objectStack) throws IOException { 1349 1349 int size = Utils.unpackInt(is); 1350 HashSet<Object> s = new HashSet< Object>(size);1350 HashSet<Object> s = new HashSet<>(size); 1351 1351 objectStack.add(s); 1352 1352 for (int i = 0; i < size; i++) … … 1358 1358 private LinkedHashSet<Object> deserializeLinkedHashSet(DataInput is, FastArrayList<Object> objectStack) throws IOException { 1359 1359 int size = Utils.unpackInt(is); 1360 LinkedHashSet<Object> s = new LinkedHashSet< Object>(size);1360 LinkedHashSet<Object> s = new LinkedHashSet<>(size); 1361 1361 objectStack.add(s); 1362 1362 for (int i = 0; i < size; i++) … … 1368 1368 private TreeSet<Object> deserializeTreeSet(DataInput is, FastArrayList<Object> objectStack) throws IOException { 1369 1369 int size = Utils.unpackInt(is); 1370 TreeSet<Object> s = new TreeSet< Object>();1370 TreeSet<Object> s = new TreeSet<>(); 1371 1371 objectStack.add(s); 1372 1372 Comparator comparator = (Comparator) deserialize(is, objectStack); 1373 1373 if (comparator != null) 1374 s = new TreeSet< Object>(comparator);1374 s = new TreeSet<>(comparator); 1375 1375 1376 1376 for (int i = 0; i < size; i++) … … 1383 1383 int size = Utils.unpackInt(is); 1384 1384 1385 TreeMap<Object, Object> s = new TreeMap< Object, Object>();1385 TreeMap<Object, Object> s = new TreeMap<>(); 1386 1386 objectStack.add(s); 1387 1387 Comparator comparator = (Comparator) deserialize(is, objectStack); 1388 1388 if (comparator != null) 1389 s = new TreeMap< Object, Object>(comparator);1389 s = new TreeMap<>(comparator); 1390 1390 for (int i = 0; i < size; i++) 1391 1391 s.put(deserialize(is, objectStack), deserialize(is, objectStack)); … … 1397 1397 int size = Utils.unpackInt(is); 1398 1398 1399 HashMap<Object, Object> s = new HashMap< Object, Object>(size);1399 HashMap<Object, Object> s = new HashMap<>(size); 1400 1400 objectStack.add(s); 1401 1401 for (int i = 0; i < size; i++) … … 1407 1407 int size = Utils.unpackInt(is); 1408 1408 1409 IdentityHashMap<Object, Object> s = new IdentityHashMap< Object, Object>(size);1409 IdentityHashMap<Object, Object> s = new IdentityHashMap<>(size); 1410 1410 objectStack.add(s); 1411 1411 for (int i = 0; i < size; i++) … … 1417 1417 int size = Utils.unpackInt(is); 1418 1418 1419 LinkedHashMap<Object, Object> s = new LinkedHashMap< Object, Object>(size);1419 LinkedHashMap<Object, Object> s = new LinkedHashMap<>(size); 1420 1420 objectStack.add(s); 1421 1421 for (int i = 0; i < size; i++) … … 1428 1428 int size = Utils.unpackInt(is); 1429 1429 1430 Hashtable<Object, Object> s = new Hashtable< Object, Object>(size);1430 Hashtable<Object, Object> s = new Hashtable<>(size); 1431 1431 objectStack.add(s); 1432 1432 for (int i = 0; i < size; i++) -
applications/editors/josm/plugins/imagerycache/src/org/mapdb/SerializerPojo.java
r30532 r30737 59 59 @Override 60 60 public CopyOnWriteArrayList<ClassInfo> deserialize(DataInput in, int available) throws IOException{ 61 if(available==0) return new CopyOnWriteArrayList< ClassInfo>();61 if(available==0) return new CopyOnWriteArrayList<>(); 62 62 63 63 int size = Utils.unpackInt(in); 64 ArrayList<ClassInfo> ret = new ArrayList< ClassInfo>(size);64 ArrayList<ClassInfo> ret = new ArrayList<>(size); 65 65 66 66 for (int i = 0; i < size; i++) { … … 76 76 ret.add(new ClassInfo(className, fields,isEnum,isExternalizable)); 77 77 } 78 return new CopyOnWriteArrayList< ClassInfo>(ret);78 return new CopyOnWriteArrayList<>(ret); 79 79 } 80 80 }; … … 95 95 public SerializerPojo(CopyOnWriteArrayList<ClassInfo> registered){ 96 96 if(registered == null) 97 this.registered = new CopyOnWriteArrayList< ClassInfo>();97 this.registered = new CopyOnWriteArrayList<>(); 98 98 else 99 99 this.registered = registered; … … 107 107 108 108 private final String name; 109 private final List<FieldInfo> fields = new ArrayList< FieldInfo>();110 private final Map<String, FieldInfo> name2fieldInfo = new HashMap< String, FieldInfo>();111 private final Map<String, Integer> name2fieldId = new HashMap< String, Integer>();109 private final List<FieldInfo> fields = new ArrayList<>(); 110 private final Map<String, FieldInfo> name2fieldInfo = new HashMap<>(); 111 private final Map<String, Integer> name2fieldId = new HashMap<>(); 112 112 private ObjectStreamField[] objectStreamFields; 113 113 … … 290 290 291 291 CopyOnWriteArrayList<ClassInfo> registered; 292 Map<Class<?>, Integer> class2classId = new HashMap< Class<?>, Integer>();293 Map<Integer, Class<?>> classId2class = new HashMap< Integer, Class<?>>();292 Map<Class<?>, Integer> class2classId = new HashMap<>(); 293 Map<Integer, Class<?>> classId2class = new HashMap<>(); 294 294 295 295 … … 333 333 if (fields == null) { 334 334 ObjectStreamClass streamClass = ObjectStreamClass.lookup(clazz); 335 FastArrayList<ObjectStreamField> fieldsList = new FastArrayList< ObjectStreamField>();335 FastArrayList<ObjectStreamField> fieldsList = new FastArrayList<>(); 336 336 while (streamClass != null) { 337 337 for (ObjectStreamField f : streamClass.getFields()) { … … 567 567 568 568 569 private static Map<Class<?>, Constructor<?>> class2constuctor = new ConcurrentHashMap< Class<?>, Constructor<?>>();569 private static Map<Class<?>, Constructor<?>> class2constuctor = new ConcurrentHashMap<>(); 570 570 571 571 /** -
applications/editors/josm/plugins/imagerycache/src/org/mapdb/SnapshotEngine.java
r30532 r30737 22 22 23 23 24 protected final Map<Snapshot, String> snapshots = new ConcurrentHashMap< Snapshot, String>();24 protected final Map<Snapshot, String> snapshots = new ConcurrentHashMap<>(); 25 25 26 26 -
applications/editors/josm/plugins/imagerycache/src/org/mapdb/StoreAppend.java
r29484 r30737 4 4 import java.io.IOError; 5 5 import java.io.IOException; 6 import java.util.BitSet;7 6 import java.util.concurrent.locks.Lock; 8 7 import java.util.concurrent.locks.ReentrantLock; … … 37 36 volatile protected long maxRecid; 38 37 39 protected LongConcurrentHashMap<Volume> volumes = new LongConcurrentHashMap< Volume>();40 protected final LongConcurrentHashMap<Long> recidsInTx = new LongConcurrentHashMap< Long>();38 protected LongConcurrentHashMap<Volume> volumes = new LongConcurrentHashMap<>(); 39 protected final LongConcurrentHashMap<Long> recidsInTx = new LongConcurrentHashMap<>(); 41 40 42 41 … … 85 84 86 85 //replay file and rebuild recid index table 87 LongHashMap<Long> recidsTable2 = new LongHashMap< Long>();86 LongHashMap<Long> recidsTable2 = new LongHashMap<>(); 88 87 if(!currentVolume.isEmpty()){ 89 88 currentFileOffset =0; … … 405 404 if(!recidsInTx.isEmpty()) throw new IllegalAccessError("Uncommited changes"); 406 405 407 LongHashMap<Boolean> ff = new LongHashMap< Boolean>();406 LongHashMap<Boolean> ff = new LongHashMap<>(); 408 407 for(long recid=0;recid<maxRecid;recid++){ 409 408 long indexVal = recidsTable.getLong(recid*8); -
applications/editors/josm/plugins/imagerycache/src/org/mapdb/StoreWAL.java
r29484 r30737 3 3 import java.io.IOError; 4 4 import java.io.IOException; 5 import java.util.concurrent.locks.Lock;6 import java.util.concurrent.locks.ReentrantReadWriteLock;7 5 8 6 /** … … 31 29 protected long logSize; 32 30 33 protected final LongConcurrentHashMap<long[]> modified = new LongConcurrentHashMap< long[]>();31 protected final LongConcurrentHashMap<long[]> modified = new LongConcurrentHashMap<>(); 34 32 35 33 -
applications/editors/josm/plugins/imagerycache/src/org/mapdb/TxMaker.java
r30532 r30737 18 18 protected final Object lock = new Object(); 19 19 20 protected final LongMap<TxEngine> globalMod = new LongHashMap< TxEngine>();20 protected final LongMap<TxEngine> globalMod = new LongHashMap<>(); 21 21 22 22 … … 59 59 60 60 protected LongMap<Fun.Tuple2<?, Serializer>> modItems = 61 new LongHashMap< Fun.Tuple2<?, Serializer>>();61 new LongHashMap<>(); 62 62 63 protected Set<Long> newItems = new LinkedHashSet< Long>();63 protected Set<Long> newItems = new LinkedHashSet<>(); 64 64 65 65 protected TxEngine(Engine engine) { -
applications/editors/josm/plugins/imagerycache/src/org/mapdb/Volume.java
r29484 r30737 28 28 import java.util.Map; 29 29 import java.util.WeakHashMap; 30 import java.util.concurrent.ExecutionException;31 import java.util.concurrent.Future;32 30 import java.util.concurrent.locks.ReentrantLock; 33 31 import java.util.logging.Level; -
applications/editors/josm/plugins/imagerycache/src/org/openstreetmap/josm/plugins/imagerycache/DBTile.java
r30135 r30737 16 16 data = dbTile.data.clone(); 17 17 if (dbTile.metaData != null) { 18 metaData = new HashMap< String, String>(dbTile.metaData);18 metaData = new HashMap<>(dbTile.metaData); 19 19 } else { 20 metaData = new HashMap< String, String>();20 metaData = new HashMap<>(); 21 21 } 22 22 lastModified = dbTile.lastModified; -
applications/editors/josm/plugins/imagerycache/src/org/openstreetmap/josm/plugins/imagerycache/TileDAOMapDB.java
r29946 r30737 19 19 public static boolean dbNotAvailable = false; 20 20 21 protected HashMap<String, DB> dbs = new HashMap< String, DB>();22 protected HashMap<String, Map<Long, DBTile>> storages = new HashMap< String, Map<Long, DBTile>>();21 protected HashMap<String, DB> dbs = new HashMap<>(); 22 protected HashMap<String, Map<Long, DBTile>> storages = new HashMap<>(); 23 23 private File cacheFolder; 24 24
Note:
See TracChangeset
for help on using the changeset viewer.