Search in sources :

Example 1 with WritableDataStore

use of de.lmu.ifi.dbs.elki.database.datastore.WritableDataStore in project elki by elki-project.

the class MemoryDataStoreFactory method makeStorage.

@SuppressWarnings("unchecked")
@Override
public <T> WritableDataStore<T> makeStorage(DBIDs ids, int hints, Class<? super T> dataclass) {
    if (Double.class.equals(dataclass)) {
        return (WritableDataStore<T>) makeDoubleStorage(ids, hints);
    }
    if (Integer.class.equals(dataclass)) {
        return (WritableDataStore<T>) makeIntegerStorage(ids, hints);
    }
    if (ids instanceof DBIDRange) {
        DBIDRange range = (DBIDRange) ids;
        Object[] data = new Object[range.size()];
        return new ArrayStore<>(data, range);
    } else {
        return new MapIntegerDBIDStore<>(ids.size());
    }
}
Also used : DBIDRange(de.lmu.ifi.dbs.elki.database.ids.DBIDRange) WritableDataStore(de.lmu.ifi.dbs.elki.database.datastore.WritableDataStore)

Aggregations

WritableDataStore (de.lmu.ifi.dbs.elki.database.datastore.WritableDataStore)1 DBIDRange (de.lmu.ifi.dbs.elki.database.ids.DBIDRange)1