提交 117b640f authored 作者: andrei's avatar andrei

Address synthetic access issues

上级 4ecab392
......@@ -118,7 +118,6 @@ public final class Cursor<K, V> implements Iterator<K> {
*
* @param n the number of entries to skip
*/
@SuppressWarnings("unchecked")
public void skip(long n) {
if (n < 10) {
while (n-- > 0 && hasNext()) {
......@@ -126,10 +125,11 @@ public final class Cursor<K, V> implements Iterator<K> {
}
} else if(hasNext()) {
assert cursorPos != null;
CursorPos curPos = cursorPos;
CursorPos cp = cursorPos;
CursorPos parent;
while ((parent = curPos.parent) != null) curPos = parent;
Page root = curPos.page;
while ((parent = cp.parent) != null) cp = parent;
Page root = cp.page;
@SuppressWarnings("unchecked")
MVMap<K, ?> map = (MVMap<K, ?>) root.map;
long index = map.getKeyIndex(next());
last = map.getKey(index + n);
......
......@@ -58,12 +58,12 @@ public class MVMap<K, V> extends AbstractMap<K, V>
* This designates the "last stored" version for a store which was
* just open for the first time.
*/
public static final long INITIAL_VERSION = -1;
static final long INITIAL_VERSION = -1;
protected MVMap(Map<String, Object> config) {
this((MVStore)config.get("store"),
(DataType)config.get("key"),
(DataType)config.get("val"),
this((MVStore) config.get("store"),
(DataType) config.get("key"),
(DataType) config.get("val"),
DataUtils.readHexInt(config, "id", 0),
DataUtils.readHexLong(config, "createVersion", 0),
new AtomicReference<RootReference>()
......@@ -83,7 +83,6 @@ public class MVMap<K, V> extends AbstractMap<K, V>
setInitialRoot(createEmptyLeaf(), store.getCurrentVersion());
}
@SuppressWarnings("unchecked")
private MVMap(MVStore store, DataType keyType, DataType valueType, int id, long createVersion,
AtomicReference<RootReference> root) {
this.store = store;
......@@ -142,7 +141,6 @@ public class MVMap<K, V> extends AbstractMap<K, V>
* @param value the value (may not be null)
* @return the old value if the key existed, or null otherwise
*/
@SuppressWarnings("unchecked")
public final V put(K key, V value, DecisionMaker<? super V> decisionMaker) {
DataUtils.checkArgument(value != null, "The value may not be null");
return operate(key, value, decisionMaker);
......@@ -174,7 +172,6 @@ public class MVMap<K, V> extends AbstractMap<K, V>
* @param index the index
* @return the key
*/
@SuppressWarnings("unchecked")
public final K getKey(long index) {
if (index < 0 || index >= sizeAsLong()) {
return null;
......@@ -186,7 +183,9 @@ public class MVMap<K, V> extends AbstractMap<K, V>
if (index >= offset + p.getKeyCount()) {
return null;
}
return (K) p.getKey((int) (index - offset));
@SuppressWarnings("unchecked")
K key = (K) p.getKey((int) (index - offset));
return key;
}
int i = 0, size = getChildPageCount(p);
for (; i < size; i++) {
......@@ -386,30 +385,6 @@ public class MVMap<K, V> extends AbstractMap<K, V>
return (V) Page.get(p, key);
}
/**
* Get the value for the given key, or null if not found.
*
* @param p the page
* @param key the key
* @return the value or null
*/
protected Object binarySearch(Page p, Object key) {
int x = p.binarySearch(key);
if (!p.isLeaf()) {
if (x < 0) {
x = -x - 1;
} else {
x++;
}
p = p.getChildPage(x);
return binarySearch(p, key);
}
if (x >= 0) {
return p.getValue(x);
}
return null;
}
@Override
public final boolean containsKey(Object key) {
return get(key) != null;
......@@ -472,7 +447,6 @@ public class MVMap<K, V> extends AbstractMap<K, V>
* @param value the expected value
* @return true if the item was removed
*/
@SuppressWarnings("unchecked")
@Override
public boolean remove(Object key, Object value) {
EqualsDecisionMaker<V> decisionMaker = new EqualsDecisionMaker<>(valueType, (V)value);
......@@ -499,7 +473,7 @@ public class MVMap<K, V> extends AbstractMap<K, V>
* @param datatype to use for comparison
* @return true if they are equal
*/
public static boolean areValuesEqual(DataType datatype, Object a, Object b) {
static boolean areValuesEqual(DataType datatype, Object a, Object b) {
return a == b
|| a != null && b != null && datatype.compare(a, b) == 0;
}
......@@ -799,8 +773,8 @@ public class MVMap<K, V> extends AbstractMap<K, V>
* @param newRootPage the new root page
* @param attemptUpdateCounter how many attempt (including current)
* were made to update root
* @param obeyLock false means override root iven if it marked as locked (used to unlock)
* true will fail to update, if rott is currently locked
* @param obeyLock false means override root even if it's marked as locked (used to unlock)
* true will fail to update, if root is currently locked
* @return new RootReference or null if update failed
*/
private RootReference setNewRoot(RootReference oldRoot, Page newRootPage,
......@@ -862,7 +836,8 @@ public class MVMap<K, V> extends AbstractMap<K, V>
/**
* Use the new root page from now on.
* @param oldRoot the old root reference, will use the current root reference, if null is specified
* @param oldRoot the old root reference, will use the current root reference,
* if null is specified
* @param newRoot the new root page
*/
protected final boolean updateRoot(RootReference oldRoot, Page newRoot, int attemptUpdateCounter) {
......@@ -1179,7 +1154,7 @@ public class MVMap<K, V> extends AbstractMap<K, V>
/**
* Indicator that map is locked for update.
*/
public final boolean lockedForUpdate;
final boolean lockedForUpdate;
/**
* Reference to the previous root in the chain.
*/
......@@ -1193,7 +1168,7 @@ public class MVMap<K, V> extends AbstractMap<K, V>
*/
public final long updateAttemptCounter;
private RootReference(Page root, long version, RootReference previous,
RootReference(Page root, long version, RootReference previous,
long updateCounter, long updateAttemptCounter,
boolean lockedForUpdate) {
this.root = root;
......@@ -1205,7 +1180,7 @@ public class MVMap<K, V> extends AbstractMap<K, V>
}
// This one is used for locking
private RootReference(RootReference r) {
RootReference(RootReference r) {
this.root = r.root;
this.version = r.version;
this.previous = r.previous;
......@@ -1215,7 +1190,7 @@ public class MVMap<K, V> extends AbstractMap<K, V>
}
// This one is used for unlocking
private RootReference(RootReference r, Page root, int attempt) {
RootReference(RootReference r, Page root, int attempt) {
this.root = root;
this.version = r.version;
this.previous = r.previous;
......@@ -1225,7 +1200,7 @@ public class MVMap<K, V> extends AbstractMap<K, V>
}
// This one is used for version change
private RootReference(RootReference r, long version, int attempt) {
RootReference(RootReference r, long version, int attempt) {
RootReference previous = r;
RootReference tmp;
while ((tmp = previous.previous) != null && tmp.root == r.root) {
......@@ -1240,7 +1215,7 @@ public class MVMap<K, V> extends AbstractMap<K, V>
}
// This one is used for r/o snapshots
private RootReference(Page root, long version) {
RootReference(Page root, long version) {
this.root = root;
this.version = version;
this.previous = null;
......@@ -1373,16 +1348,19 @@ public class MVMap<K, V> extends AbstractMap<K, V>
public Builder() {}
@Override
public Builder<K,V> keyType(DataType dataType) {
setKeyType(dataType);
return this;
}
@Override
public Builder<K,V> valueType(DataType dataType) {
setValueType(dataType);
return this;
}
@Override
protected MVMap<K, V> create(Map<String, Object> config) {
Object type = config.get("type");
if(type == null || type.equals("rtree")) {
......@@ -1443,7 +1421,7 @@ public class MVMap<K, V> extends AbstractMap<K, V>
}
};
private static final DecisionMaker<Object> IF_ABSENT = new DecisionMaker<Object>() {
static final DecisionMaker<Object> IF_ABSENT = new DecisionMaker<Object>() {
@Override
public Decision decide(Object existingValue, Object providedValue) {
return existingValue == null ? Decision.PUT : Decision.ABORT;
......@@ -1455,7 +1433,7 @@ public class MVMap<K, V> extends AbstractMap<K, V>
}
};
private static final DecisionMaker<Object> IF_PRESENT = new DecisionMaker<Object>() {
static final DecisionMaker<Object> IF_PRESENT = new DecisionMaker<Object>() {
@Override
public Decision decide(Object existingValue, Object providedValue) {
return existingValue != null ? Decision.PUT : Decision.ABORT;
......@@ -1468,12 +1446,12 @@ public class MVMap<K, V> extends AbstractMap<K, V>
};
/**
* Makes adecision about how to proceed with update.
* Makes a decision about how to proceed with the update.
* @param existingValue value currently exists in the map
* @param providedValue original input value
* @return PUT if a new value need to replace existing one or
* new value to be inserted if there is none
* REMOVE if existin value should be deleted
* REMOVE if existing value should be deleted
* ABORT if update operation should be aborted
*/
public abstract Decision decide(V existingValue, V providedValue);
......@@ -1507,7 +1485,8 @@ public class MVMap<K, V> extends AbstractMap<K, V>
RootReference rootReference = getRoot();
int contention = 0;
if (oldRootReference != null) {
long updateAttemptCounter = rootReference.updateAttemptCounter - oldRootReference.updateAttemptCounter;
long updateAttemptCounter = rootReference.updateAttemptCounter -
oldRootReference.updateAttemptCounter;
assert updateAttemptCounter >= 0 : updateAttemptCounter;
long updateCounter = rootReference.updateCounter - oldRootReference.updateCounter;
assert updateCounter >= 0 : updateCounter;
......@@ -1521,7 +1500,7 @@ public class MVMap<K, V> extends AbstractMap<K, V>
int index = pos.index;
CursorPos tip = pos;
pos = pos.parent;
final V result = index < 0 ? null : (V)p.getValue(index);
V result = index < 0 ? null : (V)p.getValue(index);
Decision decision = decisionMaker.decide(result, value);
int unsavedMemory = 0;
......@@ -1538,7 +1517,8 @@ public class MVMap<K, V> extends AbstractMap<K, V>
if (index < 0) {
return null;
}
if (attempt > 2 && !(needUnlock = lockRoot(decisionMaker, rootReference, attempt, contention))) {
if (attempt > 2 && !(needUnlock = lockRoot(decisionMaker, rootReference,
attempt, contention))) {
continue;
}
if (p.getTotalCount() == 1 && pos != null) {
......@@ -1557,7 +1537,8 @@ public class MVMap<K, V> extends AbstractMap<K, V>
break;
}
case PUT: {
if (attempt > 2 && !(needUnlock = lockRoot(decisionMaker, rootReference, attempt, contention))) {
if (attempt > 2 && !(needUnlock = lockRoot(decisionMaker, rootReference,
attempt, contention))) {
continue;
}
value = decisionMaker.selectValue(result, value);
......@@ -1565,7 +1546,8 @@ public class MVMap<K, V> extends AbstractMap<K, V>
if (index < 0) {
p.insertLeaf(-index - 1, key, value);
int keyCount;
while ((keyCount = p.getKeyCount()) > store.getKeysPerPage() || p.getMemory() > store.getMaxPageSize()
while ((keyCount = p.getKeyCount()) > store.getKeysPerPage()
|| p.getMemory() > store.getMaxPageSize()
&& keyCount > (p.isLeaf() ? 1 : 2)) {
long totalCount = p.getTotalCount();
int at = keyCount >> 1;
......@@ -1681,7 +1663,7 @@ public class MVMap<K, V> extends AbstractMap<K, V>
private final V expectedValue;
private Decision decision;
private EqualsDecisionMaker(DataType dataType, V expectedValue) {
EqualsDecisionMaker(DataType dataType, V expectedValue) {
this.dataType = dataType;
this.expectedValue = expectedValue;
}
......@@ -1699,7 +1681,7 @@ public class MVMap<K, V> extends AbstractMap<K, V>
decision = null;
}
public Decision getDecision() {
Decision getDecision() {
return decision;
}
......
......@@ -158,7 +158,7 @@ public final class MVStore {
private volatile boolean closed;
private final FileStore fileStore;
final FileStore fileStore;
private final boolean fileStoreIsProvided;
private final int pageSplitSize;
......@@ -170,14 +170,14 @@ public final class MVStore {
* It is split in 16 segments. The stack move distance is 2% of the expected
* number of entries.
*/
private final CacheLongKeyLIRS<Page> cache;
final CacheLongKeyLIRS<Page> cache;
/**
* The page chunk references cache. The default size is 4 MB, and the
* average size is 2 KB. It is split in 16 segments. The stack move distance
* is 2% of the expected number of entries.
*/
private final CacheLongKeyLIRS<int[]> cacheChunkRef;
final CacheLongKeyLIRS<int[]> cacheChunkRef;
/**
* The newest chunk. If nothing was stored yet, this field is not set.
......@@ -511,9 +511,8 @@ public final class MVStore {
if (map == null) {
String configAsString = meta.get(MVMap.getMapKey(id));
if(configAsString != null) {
HashMap<String, Object> config = new HashMap<>();
HashMap<String, String> cfg = DataUtils.parseMap(configAsString);
config.putAll(cfg);
HashMap<String, Object> config =
new HashMap<String, Object>(DataUtils.parseMap(configAsString));
config.put("id", id);
map = builder.create(this, config);
map.init();
......@@ -729,7 +728,8 @@ public final class MVStore {
int length = c.len * BLOCK_SIZE;
fileStore.markUsed(start, length);
}
assert fileStore.getFileLengthInUse() == measureFileLengthInUse() : fileStore.getFileLengthInUse() + " != " + measureFileLengthInUse();
assert fileStore.getFileLengthInUse() == measureFileLengthInUse() :
fileStore.getFileLengthInUse() + " != " + measureFileLengthInUse();
// read all chunk headers and footers within the retention time,
// to detect unwritten data after a power failure
} while((newest = verifyLastChunks()) != null);
......@@ -989,7 +989,7 @@ public final class MVStore {
* @param pos the position
* @return the chunk
*/
private Chunk getChunk(long pos) {
Chunk getChunk(long pos) {
Chunk c = getChunkIfFound(pos);
if (c == null) {
int chunkId = DataUtils.getPageChunkId(pos);
......@@ -1203,7 +1203,8 @@ public final class MVStore {
long filePos = allocateFileSpace(length, !reuseSpace);
c.block = filePos / BLOCK_SIZE;
c.len = length / BLOCK_SIZE;
assert fileStore.getFileLengthInUse() == measureFileLengthInUse() : fileStore.getFileLengthInUse() + " != " + measureFileLengthInUse() + " " + c;
assert fileStore.getFileLengthInUse() == measureFileLengthInUse() :
fileStore.getFileLengthInUse() + " != " + measureFileLengthInUse() + " " + c;
c.metaRootPos = metaRoot.getPos();
// calculate and set the likely next position
if (reuseSpace) {
......@@ -1311,7 +1312,8 @@ public final class MVStore {
long start = c.block * BLOCK_SIZE;
int length = c.len * BLOCK_SIZE;
fileStore.free(start, length);
assert fileStore.getFileLengthInUse() == measureFileLengthInUse() : fileStore.getFileLengthInUse() + " != " + measureFileLengthInUse();
assert fileStore.getFileLengthInUse() == measureFileLengthInUse() :
fileStore.getFileLengthInUse() + " != " + measureFileLengthInUse();
} else {
if (c.unused == 0) {
c.unused = time;
......@@ -1370,7 +1372,7 @@ public final class MVStore {
private ChunkIdsCollector child;
private int mapId;
private ChunkIdsCollector(int mapId) {
ChunkIdsCollector(int mapId) {
this.parent = null;
this.mapId = mapId;
}
......@@ -1448,7 +1450,7 @@ public final class MVStore {
"Negative position {0}; p={1}, c={2}", filePos, pos, chunk.toString());
}
long maxPos = (chunk.block + chunk.len) * BLOCK_SIZE;
Page.readChildrensPositions(fileStore, pos, filePos, maxPos, childCollector);
Page.readChildrenPositions(fileStore, pos, filePos, maxPos, childCollector);
}
// and cache resulting set of chunk ids
if (cacheChunkRef != null) {
......@@ -1476,9 +1478,9 @@ public final class MVStore {
private int[] getChunkIds() {
int chunkIds[] = new int[referenced.size()];
int indx = 0;
int index = 0;
for (int chunkId : referenced) {
chunkIds[indx++] = chunkId;
chunkIds[index++] = chunkId;
}
return chunkIds;
}
......@@ -2391,7 +2393,8 @@ public final class MVStore {
long start = c.block * BLOCK_SIZE;
int length = c.len * BLOCK_SIZE;
fileStore.free(start, length);
assert fileStore.getFileLengthInUse() == measureFileLengthInUse() : fileStore.getFileLengthInUse() + " != " + measureFileLengthInUse();
assert fileStore.getFileLengthInUse() == measureFileLengthInUse() :
fileStore.getFileLengthInUse() + " != " + measureFileLengthInUse();
// overwrite the chunk,
// so it is not be used later on
WriteBuffer buff = getWriteBuffer();
......@@ -2486,9 +2489,7 @@ public final class MVStore {
"Renaming the meta map is not allowed");
int id = map.getId();
String oldName = getMapName(id);
if (oldName.equals(newName)) {
return;
}
if (oldName != null && !oldName.equals(newName)) {
DataUtils.checkArgument(
!meta.containsKey("name." + newName),
"A map named {0} already exists", newName);
......@@ -2497,6 +2498,7 @@ public final class MVStore {
meta.put("name." + newName, Integer.toHexString(id));
markMetaChanged();
}
}
/**
* Remove a map. Please note rolling back this operation does not restore
......@@ -2857,7 +2859,7 @@ public final class MVStore {
public final long version;
public final AtomicInteger counter = new AtomicInteger();
private TxCounter(long version) {
TxCounter(long version) {
this.version = version;
}
......@@ -3136,7 +3138,5 @@ public final class MVStore {
// Cast from HashMap<String, String> to HashMap<String, Object> is safe
return new Builder((HashMap) DataUtils.parseMap(s));
}
}
}
......@@ -66,16 +66,33 @@ public abstract class Page implements Cloneable
private volatile boolean removedInMemory;
/**
* The estimated number of bytes used per page object.
* The estimated number of bytes used per base page.
*/
private static final int PAGE_MEMORY = Constants.MEMORY_OBJECT + 2 * Constants.MEMORY_POINTER + Constants.MEMORY_ARRAY + 17;
protected static final int PAGE_NODE_MEMORY = PAGE_MEMORY + Constants.MEMORY_POINTER + 8 + Constants.MEMORY_ARRAY;
protected static final int PAGE_LEAF_MEMORY = PAGE_MEMORY + Constants.MEMORY_POINTER + Constants.MEMORY_ARRAY;
private static final int PAGE_MEMORY =
Constants.MEMORY_OBJECT + // this
2 * Constants.MEMORY_POINTER + // map, keys
Constants.MEMORY_ARRAY + // Object[] keys
17; // pos, cachedCompare, memory, removedInMemory
/**
* The estimated number of bytes used per empty internal page object.
*/
static final int PAGE_NODE_MEMORY =
PAGE_MEMORY + // super
Constants.MEMORY_POINTER + // children
Constants.MEMORY_ARRAY + // totalCount
8;
/**
* The estimated number of bytes used per empty leaf page.
*/
static final int PAGE_LEAF_MEMORY =
PAGE_MEMORY + // super
Constants.MEMORY_POINTER + // values
Constants.MEMORY_ARRAY; // Object[] values
/**
* The estimated number of bytes used per child entry.
*/
protected static final int PAGE_MEMORY_CHILD = Constants.MEMORY_POINTER + 16; // 16 = two longs
static final int PAGE_MEMORY_CHILD = Constants.MEMORY_POINTER + 16; // 16 = two longs
/**
* An empty object array.
......@@ -90,16 +107,16 @@ public abstract class Page implements Cloneable
private static final PageReference[] SINGLE_EMPTY = { PageReference.EMPTY };
private Page(MVMap<?, ?> map) {
Page(MVMap<?, ?> map) {
this.map = map;
}
private Page(MVMap<?, ?> map, Page source) {
Page(MVMap<?, ?> map, Page source) {
this(map, source.keys);
memory = source.memory;
}
private Page(MVMap<?, ?> map, Object keys[]) {
Page(MVMap<?, ?> map, Object keys[]) {
this.map = map;
this.keys = keys;
}
......@@ -221,7 +238,7 @@ public abstract class Page implements Cloneable
* @param maxPos the maximum position (the end of the chunk)
* @param collector to report child pages positions to
*/
static void readChildrensPositions(FileStore fileStore, long pos,
static void readChildrenPositions(FileStore fileStore, long pos,
long filePos, long maxPos,
MVStore.ChunkIdsCollector collector) {
ByteBuffer buff;
......@@ -291,9 +308,9 @@ public abstract class Page implements Cloneable
/**
* Create a copy of this page with potentially different owning map.
* This is used exclusively during bulk map copiing.
* Child page references for nodes are cleared (repointed to an empty page)
* to be filled-in later to copiing procedure. This way it can be saved
* This is used exclusively during bulk map copying.
* Child page references for nodes are cleared (re-pointed to an empty page)
* to be filled-in later to copying procedure. This way it can be saved
* mid-process without tree integrity violation
*
* @param map new map to own resulting page
......@@ -468,7 +485,7 @@ public abstract class Page implements Cloneable
*/
abstract Page split(int at);
protected final Object[] splitKeys(int aCount, int bCount) {
final Object[] splitKeys(int aCount, int bCount) {
assert aCount + bCount <= getKeyCount();
Object aKeys[] = createKeyStorage(aCount);
Object bKeys[] = createKeyStorage(bCount);
......@@ -549,7 +566,7 @@ public abstract class Page implements Cloneable
public abstract void insertNode(int index, Object key, Page childPage);
@SuppressWarnings("SuspiciousSystemArraycopy")
protected final void insertKey(int index, Object key) {
final void insertKey(int index, Object key) {
int keyCount = getKeyCount();
assert index <= keyCount : index + " > " + keyCount;
Object[] newKeys = new Object[keyCount + 1];
......@@ -571,16 +588,15 @@ public abstract class Page implements Cloneable
public void remove(int index) {
int keyCount = getKeyCount();
DataType keyType = map.getKeyType();
int indx = index;
if (indx == keyCount) {
--indx;
if (index == keyCount) {
--index;
}
if(isPersistent()) {
Object old = getKey(indx);
Object old = getKey(index);
addMemory(-keyType.getMemory(old));
}
Object newKeys[] = new Object[keyCount - 1];
DataUtils.copyExcept(keys, newKeys, keyCount, indx);
DataUtils.copyExcept(keys, newKeys, keyCount, index);
keys = newKeys;
}
......@@ -792,7 +808,7 @@ public abstract class Page implements Cloneable
return 0; //getKeyCount();
}
protected final void addMemory(int mem) {
final void addMemory(int mem) {
memory += mem;
}
......@@ -826,7 +842,7 @@ public abstract class Page implements Cloneable
return new Object[size];
}
protected final Object[] createValueStorage(int size)
final Object[] createValueStorage(int size)
{
return new Object[size];
}
......@@ -857,7 +873,7 @@ public abstract class Page implements Cloneable
this(page, page.getPos(), page.getTotalCount());
}
private PageReference(long pos, long count) {
PageReference(long pos, long count) {
this(null, pos, count);
assert pos != 0;
}
......@@ -889,7 +905,7 @@ public abstract class Page implements Cloneable
*/
private long totalCount;
private NonLeaf(MVMap<?, ?> map) {
NonLeaf(MVMap<?, ?> map) {
super(map);
}
......@@ -899,7 +915,7 @@ public abstract class Page implements Cloneable
this.totalCount = totalCount;
}
private NonLeaf(MVMap<?, ?> map, Object keys[], PageReference children[], long totalCount) {
NonLeaf(MVMap<?, ?> map, Object keys[], PageReference children[], long totalCount) {
super(map, keys);
this.children = children;
this.totalCount = totalCount;
......@@ -945,6 +961,7 @@ public abstract class Page implements Cloneable
throw new UnsupportedOperationException();
}
@Override
@SuppressWarnings("SuspiciousSystemArraycopy")
public Page split(int at) {
assert !isSaved();
......@@ -1173,7 +1190,7 @@ public abstract class Page implements Cloneable
*/
private Object values[];
private Leaf(MVMap<?, ?> map) {
Leaf(MVMap<?, ?> map) {
super(map);
}
......@@ -1182,7 +1199,7 @@ public abstract class Page implements Cloneable
this.values = source.values;
}
private Leaf(MVMap<?, ?> map, Object keys[], Object values[]) {
Leaf(MVMap<?, ?> map, Object keys[], Object values[]) {
super(map, keys);
this.values = values;
}
......
......@@ -26,7 +26,7 @@ public final class MVRTreeMap<V> extends MVMap<SpatialKey, V> {
/**
* The spatial key type.
*/
private final SpatialDataType keyType;
final SpatialDataType keyType;
private boolean quadraticSplit;
......@@ -177,29 +177,29 @@ public final class MVRTreeMap<V> extends MVMap<SpatialKey, V> {
private V operate(Page p, Object key, V value, DecisionMaker<? super V> decisionMaker) {
V result = null;
if (p.isLeaf()) {
int indx = -1;
int index = -1;
int keyCount = p.getKeyCount();
for (int i = 0; i < keyCount; i++) {
if (keyType.equals(p.getKey(i), key)) {
indx = i;
index = i;
}
}
result = indx < 0 ? null : (V)p.getValue(indx);
result = index < 0 ? null : (V)p.getValue(index);
Decision decision = decisionMaker.decide(result, value);
switch (decision) {
case ABORT: break;
case REMOVE:
if(indx >= 0) {
p.remove(indx);
if(index >= 0) {
p.remove(index);
}
break;
case PUT:
value = decisionMaker.selectValue(result, value);
if(indx < 0) {
if(index < 0) {
p.insertLeaf(p.getKeyCount(), key, value);
} else {
p.setKey(indx, key);
p.setValue(indx, value);
p.setKey(index, key);
p.setValue(index, value);
}
break;
}
......@@ -608,6 +608,7 @@ public final class MVRTreeMap<V> extends MVMap<SpatialKey, V> {
* @param valueType the key type
* @return this
*/
@Override
public Builder<V> valueType(DataType valueType) {
setValueType(valueType);
return this;
......
......@@ -1375,7 +1375,7 @@ public class TestMVStore extends TestBase {
// This test tries to cast in bronze some peculiar behaviour,
// which is rather implementation artifact then intentional.
// Once store is closed, only one sinle version of the data
// Once store is closed, only one single version of the data
// will exists upon re-opening - the latest.
// I hope nobody relies on this "multi-versioning".
/*
......
......@@ -11,11 +11,11 @@ activities activity acts actual actually acute adam adamo adams adapter adapters
adapting adaptive add added addiction adding addition additional additionally
additions addon addr address addressed addresses adds adeptia adjacent adjust
adjusted adjusts admin administration administrator admins admission ado adopt
advanced advances advantage advantages advised aeiou aejaks aelig aes afaik
advance advanced advances advantage advantages advised aeiou aejaks aelig aes afaik
affect affected affects affero affine affinity after afterwards again against agar age
agent agentlib agg aggregate aggregated aggregates aggregating aggressive agile
agrave agree agreeable agreed agreement agreements agrees ahead
ahilmnqbjkcdeopfrsg aid ajax alan alarm ale alefsym alert alessio alexander alfki
ahilmnqbjkcdeopfrsg aid air ajax alan alarm ale alefsym alert alessio alexander alfki
algo algorithm algorithms alias aliased aliases aliasing align aligned alignment
alive all allclasses alleged alleging allocate allocated allocates allocating
allocation allow allowed allowing allows almost aload alone along alpha
......@@ -66,7 +66,7 @@ border bordercolor borg borges boss bot both bottlenecks bottom bound boundaries
boundary bounding bounds bout box boysenberry bpchar bpm brace braces brack
bracket brackets bradmesserle branch branches branda brasil brasilia breach
breadth break breaking breaks bridge bring brings brittain broke broken broker
brought brown browse browser browsers brute brvbar bsdiff bson bsr btc btree
bronze brought brown browse browser browsers brute brvbar bsdiff bson bsr btc btree
btrfs bucher bucket buckets buddha buf buff buffer buffered buffering buffers bug
bugfix bugfixes buggy bugs build builder building builds built bukkit bulk bull
builtin bundle bundled bundles bungisoft burden business busy but button bxor bye
......@@ -127,7 +127,7 @@ consisting consists console consortium conspicuously const constant constants
constitute constitutes constraint constraints construct constructed constructing
construction constructor constructors constructs construe construed consult
consulting consumes consumption contact contacts contain contained container
containers containing contains contended contends content contents context
containers containing contains contended contends content contention contents context
contiguous contingent continuation continue continued continues continuous
contract contracts contribute contributed contributes contributing contribution
contributions contributor contributors control controlled controller controls
......@@ -175,7 +175,7 @@ deprecate deprecated deprecation dept depth deque derby derbyclient derbynet
deregister derivation derivative derive derived des desc descendant descending
descent descr describe described describes describing description descriptions
descriptor deserialization deserialize deserializing design designate designated
designator designed designer desirable desired desktop dest destdir destination
designator designates designed designer desirable desired desktop dest destdir destination
destroy destroyed destroyer destroying destruct destruction destructor detail
detailed details detect detected detecting detection detector detects determine
determining deterministic detrimental deusen deutsch dev develop developed
......@@ -209,7 +209,7 @@ eater ebean ecb eccn ecdh echo ecirc eckenfelder eckenfels ecl eclipse eclipsecs
eclipselink ecm ecole eder edge edh edit editable edited editing edition editor
editors edugility effect effective effectively effects efficient efficiently
effort egrave eid eing eins einstellung either elapsed eldest elect electronic
element elements elephant elig eliminate elisabetta ell ellipsis elm else
element elements elephant elig eligible eliminate elisabetta ell ellipsis elm else
elsewhere elton email emails embedded embedding embeds emergency emf emit emitted
emma empire employee empty emsp emulate emulated emulates emulation enable
enabled enables enabling enc encapsulates enclose enclosed enclosing encode
......@@ -217,8 +217,8 @@ encoded encoder encodes encoding encountered encounters encrypt encrypted
encrypting encryption encrypts end ended enderbury endif ending endings endless
endlessly endorse ends enforce enforceability enforceable enforced engine engines
english enhance enhanced enhancement enhancer enlarge enough enqueued ensp ensure
ensures ensuring enter entered entering enterprise entire entities entity entries
entry enum enumerate enumerated enumerator enumerators enumeration env envelope
ensures ensuring enter entered entering enterprise entire entities entity entrance
entries entry enum enumerate enumerated enumerator enumerators enumeration env envelope
environment environments enwiki eof eol epl epoch epoll epsilon equal equality equally
equals equipment equitable equiv equivalent equivalents era erable eremainder eric
erik err error errorlevel errors erwan ery esc escape escaped escapes escaping
......@@ -247,7 +247,7 @@ february federal federated federation fedotovs fee feed feedback fees feff fetch
fetched fetching few fewer ffeecc fffe fid field fields fiery fifo fifty file
filed filename filepwd files filesystem fill filled filler fillers filling fills
filo filter filtered filtering filters fin final finalization finalize finalizer
finally find finder finding finds fine finer finish finished finland fire
finally find finder finding finds fine finer finish finished finishes finland fire
firebird firebirdsql fired firefox firewall first firstname fish fit fitness fits
fitting five fix fixed fixes fixing fkcolumn fktable flag flags flash flashback
flat fle fletcher flexibility flexible flexive flip flipped fload float floating
......@@ -350,7 +350,7 @@ joel joerg johann john johnny johnson join joined joining joins joist jon jones
joonas jooq jopr jorissen jpa jpox jps jre jsessionid json jsp jsr jsse jstack
jtds jts judged judgment judicial julian july jump jumps jun junctions junit
jurczyk jurisdiction jurisdictions jury just jvm jvoid kaiser kappa karin karl
karlsson kaspersky kawashima keegan keep keeping keeps ken kept kerberos kernel
karlsson kaspersky kawashima keegan keep keeper keeping keeps ken kept kerberos kernel
kerry kevent key keyalg keying keypass keys keystore keystores keytool keyword
keywords khtml kicks kidd kill killed killer killing kills kilobytes kind
kindergarden kinds kingdom kiritimati kit kiwi knife know knowing knowledge known
......@@ -382,7 +382,7 @@ lshl lshr lsm lsquo lstore lsub lte ltrim lucene lucerne lugano lukas lumber
lumberjack luntbuild lushr lutin lxabcdef lxor lying lynx lzf mac macdonald
machine machines maciej macr macro macromedia macros made magic magnolia magyar
mahon mail mailing main mainly maintain maintained maintaining maintains
maintenance major majority make makensis makes making malformed malfunction man
maintenance major majority make makensis maker makes making malformed malfunction man
manage management manager managing manifest manifested manipulate manipulating
manipulation manipulations manley manner manske manual manually many map mapped
mapper mapping mappings maps mar marc march marcio marcy margin marginheight
......@@ -397,7 +397,7 @@ mediumblob mediumint mediumtext megabyte megabytes mehner meier meijer melbourne
mem member members memcpy memmove memo memory mendonca mentioned menu
merchantability merchantable merge merged merges merging meridian message
messager messages messes met meta metadata meteorite method methods mfulton mgmt
michael michi micro microarray microarrays microsoft middle middleware middot
michael michi micro microarray microarrays microsoft mid middle middleware middot
midnight midori midpoint might migrate migrated migrating migration mill miller
million millions millis millisecond milliseconds mime mimer min mind mine
minecraft mini minimal minimalistic minimum minneapolis minor mins minus minute
......@@ -451,7 +451,7 @@ ought ouml our out outback outdated outer outfile outline outln outperforms
output outset outside outstanding over overall overcareful overflow overflows
overhead overlap overlapping overlaps overload overloaded overloading overridden overriding
override overrides overtakes overtaking overview overwrite overwrites overwriting
overwritten overwrote owl own ownable owned owner owners ownership owns oymaurice
overwritten overwrote owl own ownable owned owner owners ownership owning owns oymaurice
pacific pack package packages packaging packets pad padded padding page paged
pages pagestore pageview pagination pair pairs pal panel panels panic papa paper
para paradox paragraph paragraphs parallel param parameter parameterized
......@@ -462,7 +462,7 @@ particularly parties partition partitioning partners partnership parts party pas
passed passes passing passive password passwords past paste pastebin pasted
pasties pasv patadia patch patched patches patching patent patents path pathogen
paths pattern patterns paul pause paused pauses pay payload payment pbkdf pdf pdo
peace pears peek pencil pending pengxiang people pepper per percent percentage
peace pears peculiar peek pencil pending pengxiang people pepper per percent percentage
perfect perform performance performed performing performs perhaps period periodic
periodically periods permanently permil permission permissions permits permitted
permutation permutations perp persist persisted persistence persistent persister
......@@ -472,7 +472,7 @@ philosophers phone php phrase phrases phromros physical pick picked pickle pico
pid pieces pier pietrzak pilot piman ping pinned pipe piped pit pitest piv pivot
pkcolumn pkcs pktable place placed placeholders places placing plain plaintext
plan planned planner planning plans plant platform platforms play player please
plug pluggable plugin plugins plus plusmn png point pointbase pointer pointers
plug pluggable plugin plugins plus plusmn png point pointbase pointed pointer pointers
pointing points poker poland polar pole poleposition policies policy polish poll
polling polski poly polygon pom pondered poodle pool poolable pooled pooling
pools poor poormans pop popular populate populated population popup port
......@@ -513,13 +513,13 @@ reach reachable reached reaches read readability readable reader readers reading
readonly reads readwrite ready real reality really realm realtime reaper reason
reasonable reasonably reasoning reasons rebind rebuild rebuilt rec recalculate
receipt receive received receives receiving recency recent recently recipient
recipients reclaimed recoding recognized recommendations recommended recompile
recompiles reconnect reconnected reconnecting reconstruct record recorded
recipients reclaimed reclamation recoding recognized recommendations recommended
recompile recompiles reconnect reconnected reconnecting reconstruct record recorded
recorder recording records recover recovered recovering recovers recovery
recreate recreated recreation rect rectangle rectangular recurse recursing
recursion recursions recursive recursively recycle recycled red redeployment
redirect redirected redirection redirector redirects redistribute redistribution
redistributions redo reduce reduced reduces redundancy redundant reeve ref
redistributions redo reduce reduced reduces reduction redundancy redundant reeve ref
refactor refactoring refactorings refer reference referenceable referenced
references referencing referent referential referred refers refill reflect
reflected reflection reflective reflectively reflects reformed refresh refreshed
......@@ -553,7 +553,7 @@ revoked revolutions rewind rewrite rewriting rfc rfloor rgb rho rice richard rid
ridvan rife right rightmost rights rijndael ring rioyxlgt risk risks risky rlm
rmd rmdir rmerr rmi rmiregistry rnd rnfr rnto road roadmap roads robert roc rogue
rojas role roles roll rollback rollbacks rolled rolling rollover rolls roman room
root roots rot rotate round rounded rounding roundmagic rounds routine routinely
root rooted roots rot rotate round rounded rounding roundmagic rounds routine routinely
routines row rowcount rowid rowlock rownum rows rowscn rowsize roy royalty rpad rpm rsa
rsaquo rsquo rss rtree rtrim ruby ruebezahl rule rules run rund rundll runnable
runner runners running runs runscript runtime rwd rws sabine safari safe safely
......@@ -626,8 +626,8 @@ suite suites sullivan sum summand summary summer summertime sums sun sunday sup
super superclass superfluous superinterfaces superior superseded supertable
superuser supplemental supplied supplier supply support supported supporter
supporters supporting supports supposed suppress sure surname surrogate
surrogates surrounded survive survives susan suse suspended suxxess sval svg svn
swap swapped sweden sweep swing swiss switch switched switches switching
surrogates surrounded survive survives susan suse suspended suspicious suxxess
sval svg svn swap swapped sweden sweep swing swiss switch switched switches switching
switchstatements switzerland swprintf swt sxd syb sybase syear sylvain symbol
symbolic symbols symmetric sync syncable synced synchronization synchronize
synchronized synchronizers synchronizes synchronizing synchronous synchronously
......@@ -650,7 +650,7 @@ threaded threading threads three threshold threw throttle throttled throttling
through throughput throw throwable throwing thrown throws thumbs thun thursday
thus tick ticker tid tigers tilde time timed timely timeout timer times timestamp
timestampadd timestampdiff timestamps timezone timezones timing tiny tinyblob
tinyint tinytext tips tired tis title titled titles tls tme tmendrscan tmfail
tinyint tinytext tip tips tired tis title titled titles tls tme tmendrscan tmfail
tmjoin tmnoflags tmonephase tmp tmpdir tmresume tmstartrscan tmsuccess tmsuspend
tmueller tmzone toc today todescato todo tofu together toggle token tokenize
tokenizer tokens tolerant tom tomas tomcat tong too took tool toolbar toolkit
......@@ -661,8 +661,8 @@ transactional transactionally transactions transfer transferred transferring
transform transformation transient transiently transition transitional
transitions translatable translate translated translates translating translation
translations translator transmission transmitted transparent transport travel
traversal traversing tray tread treat treated treatment trede tree trees trial
trick tricky tried tries trig trigger triggered triggers trigonometric trim
traversal traverse traversing tray tread treat treated treatment trede tree trees
trial trick tricky tried tries trig trigger triggered triggers trigonometric trim
trimmed trims trip trivial trouble true trunc truncate truncated truncates
truncating truncation trunk trust trusted trx try trying tsi tsmsys tsv tucc
tucker tuesday tune tunes tuning turkel turkish turn turned turns tutorial tweak
......@@ -686,7 +686,7 @@ unset unsigned unsorted unspecified unstable unsuccessful unsupported
unsynchronized untested until untranslated unusable unused unusual unvisited
unwrap unwrapped unwritten unzip upc upd updatable update updated updates
updating upgrade upgraded upgrader upgrades upgrading upload uploaded upon upper
uppercase uppercased uppermost ups upsert upside upsih upsilon urgent urgently
uppercase uppercased uppermost ups upsert upset upside upsih upsilon urgent urgently
uri url urls usa usable usage usd use used useful user userbyid username userpwd
users uses using usr usual usually utc ute utf util utilities utility utilization
utilize utilizes utils uui uuid uuml vacuum vacuuming val valid validate
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论