de.lmu.ifi.dbs.elki.database.datastore.memory
Class MapRecordStore

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.database.datastore.memory.MapRecordStore
All Implemented Interfaces:
RecordStore, WritableRecordStore

public class MapRecordStore
extends Object
implements WritableRecordStore

A class to answer representation queries using a map and an index within the record.


Nested Class Summary
protected  class MapRecordStore.StorageAccessor<T>
          Access a single record in the given data.
 
Field Summary
private  Map<DBID,Object[]> data
          Storage Map
private  int rlen
          Record length
 
Constructor Summary
MapRecordStore(int rlen)
          Constructor without existing data.
MapRecordStore(int rlen, Map<DBID,Object[]> data)
          Constructor with existing data.
 
Method Summary
protected
<T> T
get(DBID id, int index)
          Actual getter
<T> WritableDataStore<T>
getStorage(int col, Class<? super T> datatype)
          Get a WritableDataStore instance for a particular record column.
 boolean remove(DBID id)
          Remove an object from the store, all columns.
protected
<T> T
set(DBID id, int index, T value)
          Actual setter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rlen

private final int rlen
Record length


data

private final Map<DBID,Object[]> data
Storage Map

Constructor Detail

MapRecordStore

public MapRecordStore(int rlen,
                      Map<DBID,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,
                                           Class<? super T> datatype)
Description copied from interface: WritableRecordStore
Get a WritableDataStore instance for a particular record column.

Specified by:
getStorage in interface RecordStore
Specified by:
getStorage in interface WritableRecordStore
Type Parameters:
T - Data type
Parameters:
col - Column number
datatype - data class
Returns:
writable storage

get

protected <T> T get(DBID id,
                    int index)
Actual getter

Parameters:
id - Database ID
index - column index
Returns:
current value

set

protected <T> T set(DBID id,
                    int index,
                    T value)
Actual setter

Parameters:
id - Database ID
index - column index
value - new value
Returns:
previous value

remove

public boolean remove(DBID id)
Description copied from interface: WritableRecordStore
Remove an object from the store, all columns.

Specified by:
remove in interface WritableRecordStore
Parameters:
id - object ID to remove
Returns:
success code

Release 0.4.0 (2011-09-20_1324)