Package elki.database.datastore.memory
Class MapRecordStore
- java.lang.Object
-
- elki.database.datastore.memory.MapRecordStore
-
- All Implemented Interfaces:
RecordStore
,WritableRecordStore
public class MapRecordStore extends java.lang.Object implements WritableRecordStore
A class to answer representation queries using a map and an index within the record.- Since:
- 0.4.0
- Author:
- Erich Schubert
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
MapRecordStore.StorageAccessor<T>
Access a single record in the given data.
-
Constructor Summary
Constructors Constructor Description MapRecordStore(int rlen)
Constructor without existing data.MapRecordStore(int rlen, java.util.Map<DBID,java.lang.Object[]> data)
Constructor with existing data.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected <T> T
get(DBIDRef id, int index)
Actual getter.<T> WritableDataStore<T>
getStorage(int col, java.lang.Class<? super T> datatype)
Get aWritableDataStore
instance for a particular record column.boolean
remove(DBIDRef id)
Remove an object from the store, all columns.protected <T> T
set(DBIDRef id, int index, T value)
Actual setter.
-
-
-
Field Detail
-
rlen
private final int rlen
Record length.
-
data
private final java.util.Map<DBID,java.lang.Object[]> data
Storage Map.
-
-
Constructor Detail
-
MapRecordStore
public MapRecordStore(int rlen, java.util.Map<DBID,java.lang.Object[]> data)
Constructor with existing data.- Parameters:
rlen
- Number of columns (record length)data
- Existing data map
-
MapRecordStore
public MapRecordStore(int rlen)
Constructor without existing data.- Parameters:
rlen
- Number of columns (record length)
-
-
Method Detail
-
getStorage
public <T> WritableDataStore<T> getStorage(int col, java.lang.Class<? super T> datatype)
Description copied from interface:WritableRecordStore
Get aWritableDataStore
instance for a particular record column.- Specified by:
getStorage
in interfaceRecordStore
- Specified by:
getStorage
in interfaceWritableRecordStore
- Type Parameters:
T
- Data type- Parameters:
col
- Column numberdatatype
- data class- Returns:
- writable storage
-
get
protected <T> T get(DBIDRef id, int index)
Actual getter.- Type Parameters:
T
- type- Parameters:
id
- Database IDindex
- column index- Returns:
- current value
-
set
protected <T> T set(DBIDRef id, int index, T value)
Actual setter.- Type Parameters:
T
- type- Parameters:
id
- Database IDindex
- column indexvalue
- new value- Returns:
- previous value
-
remove
public boolean remove(DBIDRef id)
Description copied from interface:WritableRecordStore
Remove an object from the store, all columns.- Specified by:
remove
in interfaceWritableRecordStore
- Parameters:
id
- object ID to remove- Returns:
- success code
-
-