Package nl.tue.storage
Interface CompressedHashSet<K>
-
- Type Parameters:
K-
- All Known Implementing Classes:
CompressedStoreHashSetImpl,CompressedStoreHashSetImpl.Int32G,CompressedStoreHashSetImpl.Int4G,CompressedStoreHashSetImpl.Int8G,CompressedStoreHashSetImpl.IntCustomAlignment,CompressedStoreHashSetImpl.Long
public interface CompressedHashSet<K>The implementation is not Thread-safe. For thread safety in a multi-threaded environment, both the add and contains method should only be called when holding a lock on this object's monitor. The getObject() method does not have to be synchronized, since the underlying storage is considered immutable and once an index is returned by the add method, this index can be read concurrently. Read access to the backing store can also be a-synchronous, as long as reading is done only from indices previously added.- Author:
- bfvdonge
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description CompressedStoreHashSetImpl.Result<K>add(K val)Returns the index of the given object in the backing store.longcontains(K val)Returns the index of the given object in the backing store.CompressedStore<K>getBackingStore()Returns the CompressedStore used by this Set.longgetMemory()returns the memory use of the backing store plus the size of the backingSet.KgetObject(long l)Return the original object stored at index l in the backing storage.voidremoveAll()clears the storage space and removes all elements in the backing set.intsize()return the number of objects stored in this set
-
-
-
Method Detail
-
add
CompressedStoreHashSetImpl.Result<K> add(K val) throws StorageException
Returns the index of the given object in the backing store. If the object existed before the call to add, a negative index is returned, otherwise a positive index is returned.- Parameters:
val-- Returns:
- Throws:
StorageException
-
contains
long contains(K val) throws StorageException
Returns the index of the given object in the backing store. If the object existed before the call to add, a non-negative index is returned, otherwise -1 is returned.- Parameters:
val-- Returns:
- Throws:
StorageException
-
getMemory
long getMemory()
returns the memory use of the backing store plus the size of the backingSet.- Returns:
-
getObject
K getObject(long l) throws StorageException
Return the original object stored at index l in the backing storage.- Parameters:
l-- Returns:
- Throws:
StorageException
-
getBackingStore
CompressedStore<K> getBackingStore()
Returns the CompressedStore used by this Set.- Returns:
-
size
int size()
return the number of objects stored in this set- Returns:
-
removeAll
void removeAll()
clears the storage space and removes all elements in the backing set.
-
-