Package elki.database.datastore.memory
Class MapIntegerDBIDStore<T>
- java.lang.Object
-
- elki.database.datastore.memory.MapIntegerDBIDStore<T>
-
- Type Parameters:
T- Representation object type
- All Implemented Interfaces:
DataStore<T>,WritableDataStore<T>
public class MapIntegerDBIDStore<T> extends java.lang.Object implements WritableDataStore<T>
A class to answer representation queries using a map. Basically, it is just a wrapper around a regular map.- Since:
- 0.5.0
- Author:
- Erich Schubert
-
-
Constructor Summary
Constructors Constructor Description MapIntegerDBIDStore()Constructor.MapIntegerDBIDStore(int size)Constructor.MapIntegerDBIDStore(it.unimi.dsi.fastutil.ints.Int2ObjectMap<T> data)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Clear the storage (resetting it to the default value).voiddelete(DBIDRef id)Delete the contents for a particular ID and notifies the registered listeners.voiddestroy()Deallocate the storage, freeing the memory and notifies the registered listeners.Tget(DBIDRef id)Retrieves an object from the storage.Tput(DBIDRef id, T value)Associates the specified value with the specified id in this storage.
-
-
-
Field Detail
-
data
private it.unimi.dsi.fastutil.ints.Int2ObjectMap<T> data
Storage Map.
-
-
Constructor Detail
-
MapIntegerDBIDStore
public MapIntegerDBIDStore(it.unimi.dsi.fastutil.ints.Int2ObjectMap<T> data)
Constructor.- Parameters:
data- Existing map
-
MapIntegerDBIDStore
public MapIntegerDBIDStore()
Constructor.
-
MapIntegerDBIDStore
public MapIntegerDBIDStore(int size)
Constructor.- Parameters:
size- Expected size
-
-
Method Detail
-
get
public T get(DBIDRef id)
Description copied from interface:DataStoreRetrieves an object from the storage.
-
put
public T put(DBIDRef id, T value)
Description copied from interface:WritableDataStoreAssociates the specified value with the specified id in this storage. If the storage previously contained a value for the id, the previous value is replaced by the specified value.- Specified by:
putin interfaceWritableDataStore<T>- Parameters:
id- Database ID.value- Value to store.- Returns:
- previous value
-
destroy
public void destroy()
Description copied from interface:WritableDataStoreDeallocate the storage, freeing the memory and notifies the registered listeners.- Specified by:
destroyin interfaceWritableDataStore<T>
-
delete
public void delete(DBIDRef id)
Description copied from interface:WritableDataStoreDelete the contents for a particular ID and notifies the registered listeners.- Specified by:
deletein interfaceWritableDataStore<T>- Parameters:
id- Database ID.
-
clear
public void clear()
Description copied from interface:WritableDataStoreClear the storage (resetting it to the default value).- Specified by:
clearin interfaceWritableDataStore<T>
-
-