@Test public void testGetTreeSet() throws Exception { Set m1 = db.getTreeSet("test"); m1.add(1); m1.add(2); assertTrue(m1 == db.getTreeSet("test")); assertEquals(m1, new DB(engine).getTreeSet("test")); }
synchronized public <K> NavigableSet<K> getTreeSet(String name){ checkNotClosed(); NavigableSet<K> ret = (NavigableSet<K>) getFromWeakCollection(name); if(ret!=null) return ret; Long recid = nameDir.get(name); if(recid!=null){ BTreeMap<K,Object> m = new BTreeMap<K,Object>(engine, recid, defaultSerializer); if(m.hasValues) throw new ClassCastException("Collection is Map, not Set"); ret = m.keySet(); }else{ BTreeMap<K,Object> m = new BTreeMap<K,Object>(engine,BTreeMap.DEFAULT_MAX_NODE_SIZE, false, false, defaultSerializer, null, null, null); nameDir.put(name, m.treeRecid); ret = m.keySet(); } collections.put(name, new WeakReference<Object>(ret)); return ret; }
DB { synchronized public <K> NavigableSet<K> getTreeSet(String name){ checkNotClosed(); NavigableSet<K> ret = (NavigableSet<K>) getFromWeakCollection(name); if(ret!=null) return ret; Long recid = nameDir.get(name); if(recid!=null){ BTreeMap<K,Object> m = new BTreeMap<K,Object>(engine, recid, defaultSerializer); if(m.hasValues) throw new ClassCastException("Collection is Map, not Set"); ret = m.keySet(); }else{ BTreeMap<K,Object> m = new BTreeMap<K,Object>(engine,BTreeMap.DEFAULT_MAX_NODE_SIZE, false, false, defaultSerializer, null, null, null); nameDir.put(name, m.treeRecid); ret = m.keySet(); } collections.put(name, new WeakReference<Object>(ret)); return ret; } }
DB { synchronized public <K> NavigableSet<K> getTreeSet(String name){ checkNotClosed(); NavigableSet<K> ret = (NavigableSet<K>) getFromWeakCollection(name); if(ret!=null) return ret; Long recid = nameDir.get(name); if(recid!=null){ BTreeMap<K,Object> m = new BTreeMap<K,Object>(engine, recid, defaultSerializer); if(m.hasValues) throw new ClassCastException("Collection is Map, not Set"); ret = m.keySet(); }else{ BTreeMap<K,Object> m = new BTreeMap<K,Object>(engine,BTreeMap.DEFAULT_MAX_NODE_SIZE, false, false, defaultSerializer, null, null, null); nameDir.put(name, m.treeRecid); ret = m.keySet(); } collections.put(name, new WeakReference<Object>(ret)); return ret; } DB(final Engine engine); }
DB { synchronized public <K> NavigableSet<K> getTreeSet(String name){ checkNotClosed(); NavigableSet<K> ret = (NavigableSet<K>) getFromWeakCollection(name); if(ret!=null) return ret; Long recid = nameDir.get(name); if(recid!=null){ BTreeMap<K,Object> m = new BTreeMap<K,Object>(engine, recid, defaultSerializer); if(m.hasValues) throw new ClassCastException("Collection is Map, not Set"); ret = m.keySet(); }else{ BTreeMap<K,Object> m = new BTreeMap<K,Object>(engine,BTreeMap.DEFAULT_MAX_NODE_SIZE, false, false, defaultSerializer, null, null, null); nameDir.put(name, m.treeRecid); ret = m.keySet(); } collections.put(name, new WeakReference<Object>(ret)); return ret; } DB(final Engine engine); synchronized HTreeMap<K,V> getHashMap(String name); synchronized HTreeMap<K,V> createHashMap(
            String name, Serializer<K> keySerializer, Serializer<V> valueSerializer); synchronized Set<K> getHashSet(String name); synchronized Set<K> createHashSet(String name, Serializer<K> serializer); synchronized BTreeMap<K,V> getTreeMap(String name); synchronized BTreeMap<K,V> createTreeMap(
            String name, int nodeSize, boolean valuesStoredOutsideNodes,
            BTreeKeySerializer<K> keySerializer, Serializer<V> valueSerializer, Comparator<K> comparator); Map<String, Long> getNameDir(); synchronized NavigableSet<K> getTreeSet(String name); synchronized NavigableSet<K> createTreeSet(String name, int nodeSize, BTreeKeySerializer<K> serializer, Comparator<K> comparator); synchronized Queue<E> getQueue(String name); synchronized Queue<E> getStack(String name); synchronized Queue<E> getCircularQueue(String name); synchronized Queue<E> createQueue(String name, Serializer<E> serializer); synchronized Queue<E> createStack(String name, Serializer<E> serializer, boolean useLocks); synchronized Queue<E> createCircularQueue(String name, Serializer<E> serializer, long size); synchronized void close(); synchronized boolean isClosed(); synchronized void commit(); synchronized void rollback(); synchronized void compact(); synchronized DB snapshot(); Serializer getDefaultSerializer(); Engine getEngine(); }
DB { synchronized public <K> NavigableSet<K> getTreeSet(String name){ checkNotClosed(); NavigableSet<K> ret = (NavigableSet<K>) getFromWeakCollection(name); if(ret!=null) return ret; Long recid = nameDir.get(name); if(recid!=null){ BTreeMap<K,Object> m = new BTreeMap<K,Object>(engine, recid, defaultSerializer); if(m.hasValues) throw new ClassCastException("Collection is Map, not Set"); ret = m.keySet(); }else{ BTreeMap<K,Object> m = new BTreeMap<K,Object>(engine,BTreeMap.DEFAULT_MAX_NODE_SIZE, false, false, defaultSerializer, null, null, null); nameDir.put(name, m.treeRecid); ret = m.keySet(); } collections.put(name, new WeakReference<Object>(ret)); return ret; } DB(final Engine engine); synchronized HTreeMap<K,V> getHashMap(String name); synchronized HTreeMap<K,V> createHashMap(
            String name, Serializer<K> keySerializer, Serializer<V> valueSerializer); synchronized Set<K> getHashSet(String name); synchronized Set<K> createHashSet(String name, Serializer<K> serializer); synchronized BTreeMap<K,V> getTreeMap(String name); synchronized BTreeMap<K,V> createTreeMap(
            String name, int nodeSize, boolean valuesStoredOutsideNodes,
            BTreeKeySerializer<K> keySerializer, Serializer<V> valueSerializer, Comparator<K> comparator); Map<String, Long> getNameDir(); synchronized NavigableSet<K> getTreeSet(String name); synchronized NavigableSet<K> createTreeSet(String name, int nodeSize, BTreeKeySerializer<K> serializer, Comparator<K> comparator); synchronized Queue<E> getQueue(String name); synchronized Queue<E> getStack(String name); synchronized Queue<E> getCircularQueue(String name); synchronized Queue<E> createQueue(String name, Serializer<E> serializer); synchronized Queue<E> createStack(String name, Serializer<E> serializer, boolean useLocks); synchronized Queue<E> createCircularQueue(String name, Serializer<E> serializer, long size); synchronized void close(); synchronized boolean isClosed(); synchronized void commit(); synchronized void rollback(); synchronized void compact(); synchronized DB snapshot(); Serializer getDefaultSerializer(); Engine getEngine();  }