Renamed the packages

This commit is contained in:
Andrea Cavalli 2019-03-07 11:32:45 +01:00
parent 947f21fc8f
commit 4d5075c9d1
49 changed files with 165 additions and 193 deletions

View File

@ -1,4 +1,4 @@
package org.warp.cowdb;
package org.warp.jcwdb;
import java.util.Objects;
import java.util.StringJoiner;

View File

@ -1,13 +1,14 @@
package org.warp.cowdb;
package org.warp.jcwdb;
import org.apache.commons.lang3.NotImplementedException;
import org.apache.commons.lang3.reflect.MethodUtils;
import org.warp.cowdb.database.EnhancedObjectFullInfo;
import org.warp.jcwdb.ann.DBClass;
import org.warp.jcwdb.ann.DBDataType;
import org.warp.jcwdb.ann.DBPrimitiveType;
import org.warp.jcwdb.ann.DBPropertyGetter;
import org.warp.jcwdb.ann.DBPropertySetter;
import org.warp.jcwdb.database.EnhancedObjectFullInfo;
import org.warp.jcwdb.annotations.DBClass;
import org.warp.jcwdb.annotations.DBDataType;
import org.warp.jcwdb.annotations.DBPrimitiveType;
import org.warp.jcwdb.annotations.DBPropertyGetter;
import org.warp.jcwdb.annotations.DBPropertySetter;
import org.warp.jcwdb.database.IDatabaseTools;
import java.io.IOException;
import java.lang.reflect.Field;

View File

@ -1,7 +1,7 @@
package org.warp.cowdb;
package org.warp.jcwdb;
import org.warp.jcwdb.ann.DBDataType;
import org.warp.jcwdb.ann.DBPrimitiveType;
import org.warp.jcwdb.annotations.DBDataType;
import org.warp.jcwdb.annotations.DBPrimitiveType;
import java.io.IOException;
import java.util.function.Supplier;

View File

@ -1,4 +1,4 @@
package org.warp.jcwdb.ann;
package org.warp.jcwdb.annotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;

View File

@ -1,4 +1,4 @@
package org.warp.jcwdb.ann;
package org.warp.jcwdb.annotations;
public enum DBDataType {
ENHANCED_OBJECT,

View File

@ -1,4 +1,4 @@
package org.warp.jcwdb.ann;
package org.warp.jcwdb.annotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;

View File

@ -1,4 +1,4 @@
package org.warp.jcwdb.ann;
package org.warp.jcwdb.annotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;

View File

@ -1,4 +1,4 @@
package org.warp.jcwdb.ann;
package org.warp.jcwdb.annotations;
public enum DBPrimitiveType {
BOOLEAN,

View File

@ -1,4 +1,4 @@
package org.warp.jcwdb.ann;
package org.warp.jcwdb.annotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;

View File

@ -1,4 +1,4 @@
package org.warp.jcwdb.ann;
package org.warp.jcwdb.annotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;

View File

@ -1,6 +1,7 @@
package org.warp.cowdb;
package org.warp.jcwdb.database;
import org.warp.cowdb.database.*;
import org.warp.jcwdb.EnhancedObject;
import org.warp.jcwdb.functionalinterfaces.FunctionWithIO;
import java.io.IOException;
import java.nio.ByteBuffer;

View File

@ -1,13 +1,11 @@
package org.warp.cowdb.database;
package org.warp.jcwdb.database;
import org.warp.cowdb.BlockInfo;
import org.warp.cowdb.IBlocksIO;
import org.warp.cowdb.IBlocksMetadata;
import org.warp.jcwdb.BlockInfo;
import java.io.IOException;
import java.nio.ByteBuffer;
import static org.warp.cowdb.IBlocksMetadata.EMPTY_BLOCK_ID;
import static org.warp.jcwdb.database.IBlocksMetadata.EMPTY_BLOCK_ID;
public class DatabaseBlocksIO implements IBlocksIO {

View File

@ -1,8 +1,7 @@
package org.warp.cowdb.database;
package org.warp.jcwdb.database;
import org.warp.cowdb.BlockInfo;
import org.warp.cowdb.IBlocksMetadata;
import org.warp.jcwdb.BlockInfo;
import java.io.IOException;
import java.nio.ByteBuffer;

View File

@ -1,11 +1,9 @@
package org.warp.cowdb.database;
package org.warp.jcwdb.database;
import it.unimi.dsi.fastutil.longs.Long2LongLinkedOpenHashMap;
import it.unimi.dsi.fastutil.longs.Long2LongMap;
import it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap;
import it.unimi.dsi.fastutil.longs.Long2ObjectMap;
import it.unimi.dsi.fastutil.objects.ObjectIterator;
import org.warp.cowdb.BlockInfo;
import org.warp.jcwdb.BlockInfo;
import java.io.IOException;
import java.util.LinkedList;
@ -13,8 +11,6 @@ import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import static org.warp.cowdb.database.DatabaseBlocksMetadata.ERROR_BLOCK_INFO;
public class DatabaseBlocksMetadataCache {
private static final int GOOD_CACHE_SIZE = 70000;
@ -33,7 +29,7 @@ public class DatabaseBlocksMetadataCache {
public BlockInfo get(long block) throws IOException {
if (closed) throw new IOException("Cache already closed!");
synchronized (readAccessLock) {
return blocks2Info.getOrDefault(block, ERROR_BLOCK_INFO);
return blocks2Info.getOrDefault(block, DatabaseBlocksMetadata.ERROR_BLOCK_INFO);
}
}

View File

@ -1,6 +1,4 @@
package org.warp.cowdb.database;
import org.warp.cowdb.BlockInfo;
package org.warp.jcwdb.database;
import java.io.IOException;
import java.util.concurrent.Future;

View File

@ -1,9 +1,8 @@
package org.warp.cowdb.database;
package org.warp.jcwdb.database;
import org.apache.commons.lang3.reflect.FieldUtils;
import org.warp.cowdb.EnhancedObject;
import org.warp.cowdb.IDataInitializer;
import org.warp.jcwdb.ann.*;
import org.warp.jcwdb.EnhancedObject;
import org.warp.jcwdb.annotations.*;
import java.io.IOException;
import java.lang.reflect.Field;

View File

@ -1,9 +1,9 @@
package org.warp.cowdb.database;
package org.warp.jcwdb.database;
import it.unimi.dsi.fastutil.longs.LongList;
import org.warp.cowdb.EnhancedObjectUpgrader;
import org.warp.jcwdb.ann.DBDataType;
import org.warp.jcwdb.ann.DBPrimitiveType;
import org.warp.jcwdb.EnhancedObjectUpgrader;
import org.warp.jcwdb.annotations.DBDataType;
import org.warp.jcwdb.annotations.DBPrimitiveType;
import java.io.IOException;
import java.util.function.Supplier;

View File

@ -1,15 +1,12 @@
package org.warp.cowdb.database;
package org.warp.jcwdb.database;
import org.warp.cowdb.IFileIO;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.channels.SeekableByteChannel;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardOpenOption;
import java.util.concurrent.ExecutionException;
public class DatabaseFileIO implements IFileIO {

View File

@ -1,4 +1,4 @@
package org.warp.cowdb.database;
package org.warp.jcwdb.database;
import com.esotericsoftware.kryo.Kryo;
import com.esotericsoftware.kryo.io.Input;
@ -11,11 +11,8 @@ import it.unimi.dsi.fastutil.longs.LongArrayList;
import it.unimi.dsi.fastutil.longs.LongList;
import it.unimi.dsi.fastutil.shorts.ShortArrayList;
import org.apache.commons.lang3.reflect.FieldUtils;
import org.warp.cowdb.EnhancedObject;
import org.warp.cowdb.IDataInitializer;
import org.warp.cowdb.IDatabaseTools;
import org.warp.cowdb.IObjectsIO;
import org.warp.jcwdb.ann.*;
import org.warp.jcwdb.EnhancedObject;
import org.warp.jcwdb.annotations.*;
import java.io.ByteArrayOutputStream;
import java.io.IOException;

View File

@ -1,11 +1,9 @@
package org.warp.cowdb.database;
import org.warp.cowdb.IReferencesIO;
package org.warp.jcwdb.database;
import java.io.IOException;
import java.nio.ByteBuffer;
import static org.warp.cowdb.IBlocksMetadata.EMPTY_BLOCK_ID;
import static org.warp.jcwdb.database.IBlocksMetadata.EMPTY_BLOCK_ID;
public class DatabaseReferencesIO implements IReferencesIO {

View File

@ -1,21 +1,15 @@
package org.warp.cowdb.database;
import it.unimi.dsi.fastutil.bytes.ByteLinkedOpenCustomHashSet;
import org.warp.cowdb.IReferencesMetadata;
import org.warp.jcwdb.ann.DBClass;
package org.warp.jcwdb.database;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.channels.AsynchronousFileChannel;
import java.nio.channels.SeekableByteChannel;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardOpenOption;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import static org.warp.cowdb.IBlocksMetadata.EMPTY_BLOCK_ID;
import static org.warp.cowdb.IBlocksMetadata.ERROR_BLOCK_ID;
import static org.warp.jcwdb.database.IBlocksMetadata.EMPTY_BLOCK_ID;
import static org.warp.jcwdb.database.IBlocksMetadata.ERROR_BLOCK_ID;
public class DatabaseReferencesMetadata implements IReferencesMetadata {
private final AsynchronousFileChannel metaFileChannel;

View File

@ -1,4 +1,4 @@
package org.warp.cowdb.database;
package org.warp.jcwdb.database;
import it.unimi.dsi.fastutil.longs.*;
import it.unimi.dsi.fastutil.objects.ObjectIterator;
@ -9,7 +9,7 @@ import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import static org.warp.cowdb.IBlocksMetadata.ERROR_BLOCK_ID;
import static org.warp.jcwdb.database.IBlocksMetadata.ERROR_BLOCK_ID;
public class DatabaseReferencesMetadataCache {

View File

@ -1,4 +1,4 @@
package org.warp.cowdb.database;
package org.warp.jcwdb.database;
import java.io.IOException;
import java.util.concurrent.Future;

View File

@ -1,7 +1,7 @@
package org.warp.cowdb.database;
package org.warp.jcwdb.database;
import org.warp.jcwdb.ann.DBDataType;
import org.warp.jcwdb.ann.DBPrimitiveType;
import org.warp.jcwdb.annotations.DBDataType;
import org.warp.jcwdb.annotations.DBPrimitiveType;
import java.lang.reflect.Field;

View File

@ -1,4 +1,4 @@
package org.warp.cowdb;
package org.warp.jcwdb.database;
import java.io.IOException;
import java.io.InputStream;

View File

@ -1,4 +1,6 @@
package org.warp.cowdb;
package org.warp.jcwdb.database;
import org.warp.jcwdb.BlockInfo;
import java.io.IOException;

View File

@ -1,4 +1,6 @@
package org.warp.cowdb;
package org.warp.jcwdb.database;
import org.warp.jcwdb.EnhancedObject;
import java.io.IOException;

View File

@ -1,4 +1,4 @@
package org.warp.cowdb;
package org.warp.jcwdb.database;
import java.io.IOException;

View File

@ -1,9 +1,8 @@
package org.warp.cowdb;
package org.warp.jcwdb.database;
import org.warp.jcwdb.ann.DBDataType;
import org.warp.jcwdb.EnhancedObject;
import java.io.IOException;
import java.lang.reflect.Method;
public interface IDatabaseTools {
void initializeEnhancedObject(EnhancedObject enhancedObject) throws IOException;

View File

@ -1,4 +1,4 @@
package org.warp.cowdb;
package org.warp.jcwdb.database;
import java.io.*;
import java.nio.ByteBuffer;

View File

@ -1,8 +1,9 @@
package org.warp.cowdb;
package org.warp.jcwdb.database;
import it.unimi.dsi.fastutil.longs.LongArrayList;
import it.unimi.dsi.fastutil.longs.LongList;
import org.warp.jcwdb.ann.DBDataType;
import org.warp.jcwdb.EnhancedObject;
import org.warp.jcwdb.annotations.DBDataType;
import java.io.IOException;
import java.lang.reflect.Method;

View File

@ -1,4 +1,4 @@
package org.warp.cowdb;
package org.warp.jcwdb.database;
import java.io.IOException;
import java.io.InputStream;

View File

@ -1,4 +1,4 @@
package org.warp.cowdb;
package org.warp.jcwdb.database;
import java.io.IOException;

View File

@ -1,4 +1,4 @@
package org.warp.cowdb.database;
package org.warp.jcwdb.database;
import java.io.IOException;

View File

@ -1,4 +1,4 @@
package org.warp.jcwdb.ann;
package org.warp.jcwdb.functionalinterfaces;
import java.io.IOException;
import java.util.Objects;

View File

@ -1,4 +1,4 @@
package org.warp.cowdb;
package org.warp.jcwdb.functionalinterfaces;
import java.io.IOException;
import java.util.Objects;

View File

@ -1,4 +1,4 @@
package org.warp.jcwdb.ann;
package org.warp.jcwdb.functionalinterfaces;
import java.io.IOException;

View File

@ -1,4 +1,4 @@
package org.warp.jcwdb.ann;
package org.warp.jcwdb.functionalinterfaces;
import java.io.IOException;

View File

@ -1,15 +1,14 @@
package org.warp.cowdb.lists;
package org.warp.jcwdb.lists;
import it.unimi.dsi.fastutil.longs.LongArrayList;
import org.warp.cowdb.EnhancedObject;
import org.warp.cowdb.IDatabase;
import org.warp.cowdb.IDatabaseTools;
import org.warp.jcwdb.ann.DBDataType;
import org.warp.jcwdb.ann.DBField;
import org.warp.jcwdb.EnhancedObject;
import org.warp.jcwdb.database.IDatabaseTools;
import org.warp.jcwdb.annotations.DBDataType;
import org.warp.jcwdb.annotations.DBField;
import java.io.IOException;
public class EnhancedObjectCowList<T extends EnhancedObject> extends CowList<T> {
public class EnhancedObjectJCWDBList<T extends EnhancedObject> extends JCWDBList<T> {
@DBField(id = 0, type = DBDataType.REFERENCES_LIST)
private LongArrayList indices;
@ -22,11 +21,11 @@ public class EnhancedObjectCowList<T extends EnhancedObject> extends CowList<T>
return indices;
}
public EnhancedObjectCowList() {
public EnhancedObjectJCWDBList() {
super();
}
public EnhancedObjectCowList(IDatabaseTools databaseTools, Class<T> type) throws IOException {
public EnhancedObjectJCWDBList(IDatabaseTools databaseTools, Class<T> type) throws IOException {
super(databaseTools);
this.type = type;
indices = new LongArrayList();

View File

@ -1,24 +1,23 @@
package org.warp.cowdb.lists;
package org.warp.jcwdb.lists;
import it.unimi.dsi.fastutil.longs.LongArrayList;
import org.warp.cowdb.EnhancedObject;
import org.warp.cowdb.IDatabase;
import org.warp.cowdb.IDatabaseTools;
import org.warp.jcwdb.EnhancedObject;
import org.warp.jcwdb.database.IDatabaseTools;
import java.io.IOException;
import java.util.StringJoiner;
public abstract class CowList<T> extends EnhancedObject {
public abstract class JCWDBList<T> extends EnhancedObject {
private final Object indicesAccessLock = new Object();
protected abstract LongArrayList getIndices();
public CowList() {
public JCWDBList() {
}
public CowList(IDatabaseTools databaseTools) throws IOException {
public JCWDBList(IDatabaseTools databaseTools) throws IOException {
super(databaseTools);
}
@ -88,7 +87,7 @@ public abstract class CowList<T> extends EnhancedObject {
@Override
public String toString() {
return new StringJoiner(", ", CowList.class.getSimpleName() + "[", "]")
return new StringJoiner(", ", JCWDBList.class.getSimpleName() + "[", "]")
.add(getIndices().size() + " items")
.toString();
}

View File

@ -1,14 +1,13 @@
package org.warp.cowdb.lists;
package org.warp.jcwdb.lists;
import it.unimi.dsi.fastutil.longs.LongArrayList;
import org.warp.cowdb.IDatabase;
import org.warp.cowdb.IDatabaseTools;
import org.warp.jcwdb.ann.DBDataType;
import org.warp.jcwdb.ann.DBField;
import org.warp.jcwdb.database.IDatabaseTools;
import org.warp.jcwdb.annotations.DBDataType;
import org.warp.jcwdb.annotations.DBField;
import java.io.IOException;
public class ObjectCowList<T> extends CowList<T> {
public class ObjectJCWDBList<T> extends JCWDBList<T> {
@DBField(id = 0, type = DBDataType.REFERENCES_LIST)
private LongArrayList indices;
@ -18,11 +17,11 @@ public class ObjectCowList<T> extends CowList<T> {
return indices;
}
public ObjectCowList() {
public ObjectJCWDBList() {
super();
}
public ObjectCowList(IDatabaseTools databaseTools) throws IOException {
public ObjectJCWDBList(IDatabaseTools databaseTools) throws IOException {
super(databaseTools);
indices = new LongArrayList();
}

View File

@ -3,12 +3,12 @@ package org.warp.jcwdb.tests;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.warp.cowdb.EnhancedObject;
import org.warp.cowdb.IDatabaseTools;
import org.warp.jcwdb.ann.DBDataType;
import org.warp.jcwdb.ann.DBField;
import org.warp.jcwdb.ann.DBPropertyGetter;
import org.warp.jcwdb.ann.DBPropertySetter;
import org.warp.jcwdb.EnhancedObject;
import org.warp.jcwdb.database.IDatabaseTools;
import org.warp.jcwdb.annotations.DBDataType;
import org.warp.jcwdb.annotations.DBField;
import org.warp.jcwdb.annotations.DBPropertyGetter;
import org.warp.jcwdb.annotations.DBPropertySetter;
import org.warp.jcwdb.utils.NTestUtils;
import java.io.IOException;

View File

@ -3,19 +3,11 @@ package org.warp.jcwdb.tests;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.warp.cowdb.Database;
import org.warp.cowdb.EnhancedObject;
import org.warp.cowdb.IDatabase;
import org.warp.jcwdb.ann.DBDataType;
import org.warp.jcwdb.ann.DBField;
import org.warp.jcwdb.ann.DBPropertyGetter;
import org.warp.jcwdb.ann.DBPropertySetter;
import org.warp.jcwdb.utils.NTestUtils;
import org.warp.jcwdb.database.Database;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import static org.junit.Assert.assertEquals;

View File

@ -3,13 +3,12 @@ package org.warp.jcwdb.tests;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.warp.cowdb.EnhancedObject;
import org.warp.cowdb.IDatabase;
import org.warp.cowdb.IDatabaseTools;
import org.warp.jcwdb.ann.DBDataType;
import org.warp.jcwdb.ann.DBField;
import org.warp.jcwdb.ann.DBPropertyGetter;
import org.warp.jcwdb.ann.DBPropertySetter;
import org.warp.jcwdb.EnhancedObject;
import org.warp.jcwdb.database.IDatabaseTools;
import org.warp.jcwdb.annotations.DBDataType;
import org.warp.jcwdb.annotations.DBField;
import org.warp.jcwdb.annotations.DBPropertyGetter;
import org.warp.jcwdb.annotations.DBPropertySetter;
import org.warp.jcwdb.utils.NTestUtils;
import java.io.IOException;

View File

@ -1,11 +1,11 @@
package org.warp.jcwdb.tests;
import org.warp.cowdb.EnhancedObject;
import org.warp.cowdb.IDatabaseTools;
import org.warp.jcwdb.ann.DBDataType;
import org.warp.jcwdb.ann.DBField;
import org.warp.jcwdb.ann.DBPrimitiveField;
import org.warp.jcwdb.ann.DBPrimitiveType;
import org.warp.jcwdb.EnhancedObject;
import org.warp.jcwdb.database.IDatabaseTools;
import org.warp.jcwdb.annotations.DBDataType;
import org.warp.jcwdb.annotations.DBField;
import org.warp.jcwdb.annotations.DBPrimitiveField;
import org.warp.jcwdb.annotations.DBPrimitiveType;
import java.io.IOException;

View File

@ -1,13 +1,14 @@
package org.warp.jcwdb.tests;
import it.unimi.dsi.fastutil.longs.LongArrayList;
import org.warp.cowdb.Database;
import org.warp.cowdb.EnhancedObject;
import org.warp.cowdb.IDatabaseTools;
import org.warp.cowdb.lists.EnhancedObjectCowList;
import org.warp.cowdb.lists.ObjectCowList;
import org.warp.jcwdb.functionalinterfaces.RunnableWithIO;
import org.warp.jcwdb.database.Database;
import org.warp.jcwdb.EnhancedObject;
import org.warp.jcwdb.database.IDatabaseTools;
import org.warp.jcwdb.lists.EnhancedObjectJCWDBList;
import org.warp.jcwdb.lists.ObjectJCWDBList;
import org.warp.jcwdb.VariableWrapper;
import org.warp.jcwdb.ann.*;
import org.warp.jcwdb.annotations.*;
import java.io.IOException;
import java.nio.file.Files;
@ -51,23 +52,23 @@ public class Performance {
testS("Database root creation", 3000, Performance::regenDb, () -> db.loadRoot(PreloadedListContainer.class, PreloadedListContainer::new), () -> {});
final VariableWrapper<PreloadedListContainer> preloadedListContainer = new VariableWrapper<>(null);
final VariableWrapper<SimpleEnhancedObject> simpleEnhancedObjectContainer = new VariableWrapper<>(null);
testS("ObjectCowList<Int> creation", 3000, () -> {
testS("ObjectJCWDBList<Int> creation", 3000, () -> {
regenDb();
preloadedListContainer.var = db.loadRoot(PreloadedListContainer.class, PreloadedListContainer::new);
}, () -> preloadedListContainer.var.list = new ObjectCowList<>(db), () -> {});
testS("ObjectCowList<Int>: Filling with 1000 items", 100, () -> {
}, () -> preloadedListContainer.var.list = new ObjectJCWDBList<>(db), () -> {});
testS("ObjectJCWDBList<Int>: Filling with 1000 items", 100, () -> {
regenDb();
preloadedListContainer.var = db.loadRoot(PreloadedListContainer.class, PreloadedListContainer::new);
preloadedListContainer.var.list = new ObjectCowList<>(db);
preloadedListContainer.var.list = new ObjectJCWDBList<>(db);
}, () -> {
for (int i = 0; i < 1000; i++) {
preloadedListContainer.var.list.add(1000);
}
}, () -> {});
testS("ObjectCowList<EnhancedObject>: Filling with 1000 items", 100, () -> {
testS("ObjectJCWDBList<EnhancedObject>: Filling with 1000 items", 100, () -> {
regenDb();
preloadedListContainer.var = db.loadRoot(PreloadedListContainer.class, PreloadedListContainer::new);
preloadedListContainer.var.listOfEnhancedObj = new EnhancedObjectCowList<>(db, SimpleEnhancedObject.class);
preloadedListContainer.var.listOfEnhancedObj = new EnhancedObjectJCWDBList<>(db, SimpleEnhancedObject.class);
simpleEnhancedObjectContainer.var = new SimpleEnhancedObject(db);
simpleEnhancedObjectContainer.var.integerNumber = 10;
simpleEnhancedObjectContainer.var.longNumber = 10L;
@ -80,28 +81,28 @@ public class Performance {
preloadedListContainer.var.listOfEnhancedObj.add(simpleEnhancedObjectContainer.var);
}
}, () -> {});
testS("ObjectCowList<Int>: Filling with 10000 items", 10, () -> {
testS("ObjectJCWDBList<Int>: Filling with 10000 items", 10, () -> {
regenDb();
preloadedListContainer.var = db.loadRoot(PreloadedListContainer.class, PreloadedListContainer::new);
preloadedListContainer.var.list = new ObjectCowList<>(db);
preloadedListContainer.var.list = new ObjectJCWDBList<>(db);
}, () -> {
for (int i = 0; i < 10000; i++) {
preloadedListContainer.var.list.add(1000);
}
}, () -> {});
testS("ObjectCowList<Int>: Filling with 100000 items", 1, () -> {
testS("ObjectJCWDBList<Int>: Filling with 100000 items", 1, () -> {
regenDb();
preloadedListContainer.var = db.loadRoot(PreloadedListContainer.class, PreloadedListContainer::new);
preloadedListContainer.var.list = new ObjectCowList<>(db);
preloadedListContainer.var.list = new ObjectJCWDBList<>(db);
}, () -> {
for (int i = 0; i < 100000; i++) {
preloadedListContainer.var.list.add(1000);
}
}, () -> {});
testS("ObjectCowList<Int>: Loading 1000 items", 100, () -> {
testS("ObjectJCWDBList<Int>: Loading 1000 items", 100, () -> {
regenDb();
preloadedListContainer.var = db.loadRoot(PreloadedListContainer.class, PreloadedListContainer::new);
preloadedListContainer.var.list = new ObjectCowList<>(db);
preloadedListContainer.var.list = new ObjectJCWDBList<>(db);
for (int i = 0; i < 1000; i++) {
preloadedListContainer.var.list.add(1000);
}
@ -110,10 +111,10 @@ public class Performance {
preloadedListContainer.var.list.get(i);
}
}, () -> {});
testS("ObjectCowList<EnhancedObject>: Loading with 1000 items", 100, () -> {
testS("ObjectJCWDBList<EnhancedObject>: Loading with 1000 items", 100, () -> {
regenDb();
preloadedListContainer.var = db.loadRoot(PreloadedListContainer.class, PreloadedListContainer::new);
preloadedListContainer.var.listOfEnhancedObj = new EnhancedObjectCowList<>(db, SimpleEnhancedObject.class);
preloadedListContainer.var.listOfEnhancedObj = new EnhancedObjectJCWDBList<>(db, SimpleEnhancedObject.class);
simpleEnhancedObjectContainer.var = new SimpleEnhancedObject(db);
simpleEnhancedObjectContainer.var.integerNumber = 10;
simpleEnhancedObjectContainer.var.longNumber = 10L;
@ -129,10 +130,10 @@ public class Performance {
preloadedListContainer.var.listOfEnhancedObj.get(i);
}
}, () -> {});
testS("ObjectCowList<Int>: Loading 10000 items", 10, () -> {
testS("ObjectJCWDBList<Int>: Loading 10000 items", 10, () -> {
regenDb();
preloadedListContainer.var = db.loadRoot(PreloadedListContainer.class, PreloadedListContainer::new);
preloadedListContainer.var.list = new ObjectCowList<>(db);
preloadedListContainer.var.list = new ObjectJCWDBList<>(db);
for (int i = 0; i < 10000; i++) {
preloadedListContainer.var.list.add(1000);
}
@ -141,20 +142,20 @@ public class Performance {
preloadedListContainer.var.list.get(i);
}
}, () -> {});
testS("ObjectCowList<Int>: getLast() with 1000 items", 100, () -> {
testS("ObjectJCWDBList<Int>: getLast() with 1000 items", 100, () -> {
regenDb();
preloadedListContainer.var = db.loadRoot(PreloadedListContainer.class, PreloadedListContainer::new);
preloadedListContainer.var.list = new ObjectCowList<>(db);
preloadedListContainer.var.list = new ObjectJCWDBList<>(db);
for (int i = 0; i < 1000; i++) {
preloadedListContainer.var.list.add(1000);
}
}, () -> {
preloadedListContainer.var.list.getLast();
}, () -> {});
testS("ObjectCowList<EnhancedObject>: getLast() with 1000 items", 100, () -> {
testS("ObjectJCWDBList<EnhancedObject>: getLast() with 1000 items", 100, () -> {
regenDb();
preloadedListContainer.var = db.loadRoot(PreloadedListContainer.class, PreloadedListContainer::new);
preloadedListContainer.var.listOfEnhancedObj = new EnhancedObjectCowList<>(db, SimpleEnhancedObject.class);
preloadedListContainer.var.listOfEnhancedObj = new EnhancedObjectJCWDBList<>(db, SimpleEnhancedObject.class);
simpleEnhancedObjectContainer.var = new SimpleEnhancedObject(db);
simpleEnhancedObjectContainer.var.integerNumber = 10;
simpleEnhancedObjectContainer.var.longNumber = 10L;
@ -168,10 +169,10 @@ public class Performance {
}, () -> {
preloadedListContainer.var.listOfEnhancedObj.getLast();
}, () -> {});
testS("ObjectCowList<Int>: size() with 1000 items", 100, () -> {
testS("ObjectJCWDBList<Int>: size() with 1000 items", 100, () -> {
regenDb();
preloadedListContainer.var = db.loadRoot(PreloadedListContainer.class, PreloadedListContainer::new);
preloadedListContainer.var.list = new ObjectCowList<>(db);
preloadedListContainer.var.list = new ObjectJCWDBList<>(db);
for (int i = 0; i < 1000; i++) {
preloadedListContainer.var.list.add(1000);
}
@ -284,10 +285,10 @@ public class Performance {
public static class PreloadedListContainer extends EnhancedObject {
@DBField(id = 0, type = DBDataType.ENHANCED_OBJECT)
public ObjectCowList<Integer> list;
public ObjectJCWDBList<Integer> list;
@DBField(id = 1, type = DBDataType.ENHANCED_OBJECT)
public EnhancedObjectCowList<SimpleEnhancedObject> listOfEnhancedObj;
public EnhancedObjectJCWDBList<SimpleEnhancedObject> listOfEnhancedObj;
public PreloadedListContainer() {
@ -310,12 +311,12 @@ public class Performance {
@DBPropertyGetter(id = 0, type = DBDataType.ENHANCED_OBJECT)
public ObjectCowList<Integer> getList() {
public ObjectJCWDBList<Integer> getList() {
return getProperty();
}
@DBPropertySetter(id = 1, type = DBDataType.ENHANCED_OBJECT)
public void setList(ObjectCowList<Integer> list) {
public void setList(ObjectJCWDBList<Integer> list) {
setProperty(list);
}
}

View File

@ -1,13 +1,13 @@
package org.warp.jcwdb.tests;
import org.warp.cowdb.EnhancedObject;
import org.warp.cowdb.EnhancedObjectUpgrader;
import org.warp.cowdb.IDatabaseTools;
import org.warp.jcwdb.ann.DBClass;
import org.warp.jcwdb.ann.DBDataType;
import org.warp.jcwdb.ann.DBField;
import org.warp.jcwdb.ann.DBPrimitiveField;
import org.warp.jcwdb.ann.DBPrimitiveType;
import org.warp.jcwdb.EnhancedObject;
import org.warp.jcwdb.EnhancedObjectUpgrader;
import org.warp.jcwdb.database.IDatabaseTools;
import org.warp.jcwdb.annotations.DBClass;
import org.warp.jcwdb.annotations.DBDataType;
import org.warp.jcwdb.annotations.DBField;
import org.warp.jcwdb.annotations.DBPrimitiveField;
import org.warp.jcwdb.annotations.DBPrimitiveType;
import java.io.IOException;

View File

@ -1,9 +1,9 @@
package org.warp.jcwdb.utils;
import org.warp.cowdb.Database;
import org.warp.cowdb.EnhancedObject;
import org.warp.jcwdb.ann.DBPrimitiveField;
import org.warp.jcwdb.ann.DBPrimitiveType;
import org.warp.jcwdb.database.Database;
import org.warp.jcwdb.EnhancedObject;
import org.warp.jcwdb.annotations.DBPrimitiveField;
import org.warp.jcwdb.annotations.DBPrimitiveType;
import java.io.IOException;

View File

@ -1,10 +1,11 @@
package org.warp.jcwdb.utils;
import it.unimi.dsi.fastutil.longs.LongArrayList;
import org.warp.cowdb.Database;
import org.warp.cowdb.EnhancedObject;
import org.warp.cowdb.IDatabaseTools;
import org.warp.jcwdb.ann.*;
import org.warp.jcwdb.functionalinterfaces.RunnableWithIO;
import org.warp.jcwdb.database.Database;
import org.warp.jcwdb.EnhancedObject;
import org.warp.jcwdb.database.IDatabaseTools;
import org.warp.jcwdb.annotations.*;
import java.io.File;
import java.io.IOException;