Package elki.database.datastore.memory
Class ArrayDoubleStore
- java.lang.Object
-
- elki.database.datastore.memory.ArrayDoubleStore
-
- All Implemented Interfaces:
DataStore<java.lang.Double>
,DoubleDataStore
,WritableDataStore<java.lang.Double>
,WritableDoubleDataStore
public class ArrayDoubleStore extends java.lang.Object implements WritableDoubleDataStore
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 double[]
data
Data arrayprivate double
def
Default value.private DataStoreIDMap
idmap
DBID to index map
-
Constructor Summary
Constructors Constructor Description ArrayDoubleStore(int size, DataStoreIDMap idmap)
Constructor.ArrayDoubleStore(int size, DataStoreIDMap idmap, double def)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
clear()
Clear the storage (resetting it to the default value).void
delete(DBIDRef id)
Delete the contents for a particular ID and notifies the registered listeners.void
destroy()
Deallocate the storage, freeing the memory and notifies the registered listeners.double
doubleValue(DBIDRef id)
Retrieves an object from the storage.java.lang.Double
get(DBIDRef id)
Deprecated.void
increment(DBIDRef id, double value)
Increment the specified value with the specified id in this storage.double
put(DBIDRef id, double value)
Associates the specified value with the specified id in this storage.java.lang.Double
put(DBIDRef id, java.lang.Double value)
Deprecated.double
putDouble(DBIDRef id, double value)
Associates the specified value with the specified id in this storage.
-
-
-
Field Detail
-
data
private double[] data
Data array
-
def
private double def
Default value.
-
idmap
private DataStoreIDMap idmap
DBID to index map
-
-
Constructor Detail
-
ArrayDoubleStore
public ArrayDoubleStore(int size, DataStoreIDMap idmap)
Constructor.- Parameters:
size
- Sizeidmap
- ID map
-
ArrayDoubleStore
public ArrayDoubleStore(int size, DataStoreIDMap idmap, double def)
Constructor.- Parameters:
size
- Sizeidmap
- ID mapdef
- Default value
-
-
Method Detail
-
get
@Deprecated public java.lang.Double get(DBIDRef id)
Deprecated.Description copied from interface:DoubleDataStore
Getter, but using objects.- Specified by:
get
in interfaceDataStore<java.lang.Double>
- Specified by:
get
in interfaceDoubleDataStore
- Parameters:
id
- Database ID.- Returns:
- Object or
null
-
put
@Deprecated public java.lang.Double put(DBIDRef id, java.lang.Double value)
Deprecated.Description copied from interface:WritableDoubleDataStore
Setter, but using objects.- Specified by:
put
in interfaceWritableDataStore<java.lang.Double>
- Specified by:
put
in interfaceWritableDoubleDataStore
- Parameters:
id
- Database ID.value
- Value to store.- Returns:
- previous value
-
doubleValue
public double doubleValue(DBIDRef id)
Description copied from interface:DoubleDataStore
Retrieves an object from the storage.- Specified by:
doubleValue
in interfaceDoubleDataStore
- Parameters:
id
- Database ID.- Returns:
- Double value
-
putDouble
public double putDouble(DBIDRef id, double value)
Description copied from interface:WritableDoubleDataStore
Associates 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:
putDouble
in interfaceWritableDoubleDataStore
- Parameters:
id
- Database ID.value
- Value to store.- Returns:
- previous value
-
put
public double put(DBIDRef id, double value)
Description copied from interface:WritableDoubleDataStore
Associates 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:
put
in interfaceWritableDoubleDataStore
- Parameters:
id
- Database ID.value
- Value to store.- Returns:
- previous value
-
increment
public void increment(DBIDRef id, double value)
Description copied from interface:WritableDoubleDataStore
Increment the specified value with the specified id in this storage.- Specified by:
increment
in interfaceWritableDoubleDataStore
- Parameters:
id
- Database ID.value
- Value to add to the previous value.
-
clear
public void clear()
Description copied from interface:WritableDataStore
Clear the storage (resetting it to the default value).- Specified by:
clear
in interfaceWritableDataStore<java.lang.Double>
-
destroy
public void destroy()
Description copied from interface:WritableDataStore
Deallocate the storage, freeing the memory and notifies the registered listeners.- Specified by:
destroy
in interfaceWritableDataStore<java.lang.Double>
-
delete
public void delete(DBIDRef id)
Description copied from interface:WritableDataStore
Delete the contents for a particular ID and notifies the registered listeners.- Specified by:
delete
in interfaceWritableDataStore<java.lang.Double>
- Parameters:
id
- Database ID.
-
-