Package elki.database.datastore.memory
Class ArrayIntegerStore
- java.lang.Object
-
- elki.database.datastore.memory.ArrayIntegerStore
-
- All Implemented Interfaces:
DataStore<java.lang.Integer>,IntegerDataStore,WritableDataStore<java.lang.Integer>,WritableIntegerDataStore
public class ArrayIntegerStore extends java.lang.Object implements WritableIntegerDataStore
A class to answer representation queries using the stored Array.- Since:
- 0.5.0
- Author:
- Erich Schubert
-
-
Field Summary
Fields Modifier and Type Field Description private int[]dataData arrayprivate intdefDefault value (forclear()).private DataStoreIDMapidmapDBID to index map
-
Constructor Summary
Constructors Constructor Description ArrayIntegerStore(int size, DataStoreIDMap idmap)Constructor.ArrayIntegerStore(int size, DataStoreIDMap idmap, int def)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated 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.java.lang.Integerget(DBIDRef id)Deprecated.voidincrement(DBIDRef id, int adjust)Increment a value.intintValue(DBIDRef id)Retrieves a value from the storage.intput(DBIDRef id, int value)Associates the specified value with the specified id in this storage.java.lang.Integerput(DBIDRef id, java.lang.Integer value)Deprecated.intputInt(DBIDRef id, int value)Associates the specified value with the specified id in this storage.
-
-
-
Field Detail
-
data
private int[] data
Data array
-
idmap
private DataStoreIDMap idmap
DBID to index map
-
def
private int def
Default value (forclear()).
-
-
Constructor Detail
-
ArrayIntegerStore
public ArrayIntegerStore(int size, DataStoreIDMap idmap)Constructor.- Parameters:
size- Sizeidmap- ID map
-
ArrayIntegerStore
public ArrayIntegerStore(int size, DataStoreIDMap idmap, int def)Constructor.- Parameters:
size- Sizeidmap- ID mapdef- Default value
-
-
Method Detail
-
get
@Deprecated public java.lang.Integer get(DBIDRef id)
Deprecated.Description copied from interface:IntegerDataStoreGetter, but using objects.- Specified by:
getin interfaceDataStore<java.lang.Integer>- Specified by:
getin interfaceIntegerDataStore- Parameters:
id- Database ID.- Returns:
- Object or
null
-
put
@Deprecated public java.lang.Integer put(DBIDRef id, java.lang.Integer value)
Deprecated.Description copied from interface:WritableIntegerDataStoreSetter, but using objects.- Specified by:
putin interfaceWritableDataStore<java.lang.Integer>- Specified by:
putin interfaceWritableIntegerDataStore- Parameters:
id- Database ID.value- Value to store.- Returns:
- previous value
-
intValue
public int intValue(DBIDRef id)
Description copied from interface:IntegerDataStoreRetrieves a value from the storage.- Specified by:
intValuein interfaceIntegerDataStore- Parameters:
id- Database ID.- Returns:
- Double value
-
putInt
public int putInt(DBIDRef id, int value)
Description copied from interface:WritableIntegerDataStoreAssociates 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:
putIntin interfaceWritableIntegerDataStore- Parameters:
id- Database ID.value- Value to store.- Returns:
- previous value
-
put
public int put(DBIDRef id, int value)
Description copied from interface:WritableIntegerDataStoreAssociates 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 interfaceWritableIntegerDataStore- Parameters:
id- Database ID.value- Value to store.- Returns:
- previous value
-
increment
public void increment(DBIDRef id, int adjust)
Description copied from interface:WritableIntegerDataStoreIncrement a value.- Specified by:
incrementin interfaceWritableIntegerDataStore- Parameters:
id- Database ID.adjust- Value to add to the 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<java.lang.Integer>
-
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<java.lang.Integer>- 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<java.lang.Integer>
-
-