45 lines
942 B
Java
45 lines
942 B
Java
package org.warp.cowdb.lists;
|
|
|
|
import it.unimi.dsi.fastutil.longs.LongArrayList;
|
|
import org.warp.cowdb.EnhancedObject;
|
|
import org.warp.cowdb.IDatabase;
|
|
import org.warp.jcwdb.ann.DBDataType;
|
|
import org.warp.jcwdb.ann.DBField;
|
|
|
|
import java.io.IOException;
|
|
|
|
public class ObjectCowList<T> extends CowList<T> {
|
|
|
|
@DBField(id = 0, type = DBDataType.REFERENCES_LIST)
|
|
private LongArrayList indices;
|
|
|
|
@Override
|
|
protected LongArrayList getIndices() {
|
|
return indices;
|
|
}
|
|
|
|
public ObjectCowList() {
|
|
super();
|
|
}
|
|
|
|
public ObjectCowList(IDatabase database) throws IOException {
|
|
super(database);
|
|
indices = new LongArrayList();
|
|
}
|
|
|
|
@Override
|
|
public void initialize() throws IOException {
|
|
|
|
}
|
|
|
|
@Override
|
|
protected T loadItem(long uid) throws IOException {
|
|
return database.getObjectsIO().loadObject(uid);
|
|
}
|
|
|
|
@Override
|
|
protected void writeItemToDisk(long uid, T item) throws IOException {
|
|
database.getObjectsIO().setObject(uid, item);
|
|
}
|
|
}
|