Package org.h2.mvstore.rtree
Class MVRTreeMap<V>
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- org.h2.mvstore.MVMap<Spatial,V>
-
- org.h2.mvstore.rtree.MVRTreeMap<V>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classMVRTreeMap.Builder<V>A builder for this class.private static classMVRTreeMap.ContainsRTreeCursor<V>private static classMVRTreeMap.IntersectsRTreeCursor<V>static classMVRTreeMap.RTreeCursor<V>A cursor to iterate over a subset of the keys.-
Nested classes/interfaces inherited from class org.h2.mvstore.MVMap
MVMap.BasicBuilder<M extends MVMap<K,V>,K,V>, MVMap.Decision, MVMap.DecisionMaker<V>, MVMap.MapBuilder<M extends MVMap<K,V>,K,V>
-
-
Field Summary
Fields Modifier and Type Field Description private SpatialDataTypekeyTypeThe spatial key type.private booleanquadraticSplit
-
Constructor Summary
Constructors Modifier Constructor Description MVRTreeMap(java.util.Map<java.lang.String,java.lang.Object> config, SpatialDataType keyType, DataType<V> valueType)privateMVRTreeMap(MVRTreeMap<V> source)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(Spatial key, V value)Add a given key-value pair.voidaddNodeKeys(java.util.ArrayList<Spatial> list, Page<Spatial,V> p)Add all node keys (including internal bounds) to the given list.MVRTreeMap<V>cloneIt()Clone the current map.private booleancontains(Page<Spatial,V> p, int index, java.lang.Object key)MVRTreeMap.RTreeCursor<V>findContainedKeys(Spatial x)Iterate over all keys that are fully contained within the given rectangle.MVRTreeMap.RTreeCursor<V>findIntersectingKeys(Spatial x)Iterate over all keys that have an intersection with the given rectangle.Vget(Page<Spatial,V> p, Spatial key)Get the object for the given key.private SpatialgetBounds(Page<Spatial,V> x)protected intgetChildPageCount(Page<Spatial,V> p)Get the child page count for this page.java.lang.StringgetType()Get the map type.booleanisQuadraticSplit()private static <V> voidmove(Page<Spatial,V> source, Page<Spatial,V> target, int sourceIndex)private Page<Spatial,V>newPage(boolean leaf)private Voperate(Page<Spatial,V> p, Spatial key, V value, MVMap.DecisionMaker<? super V> decisionMaker, java.util.Collection<Page<Spatial,V>> removedPages)Voperate(Spatial key, V value, MVMap.DecisionMaker<? super V> decisionMaker)Add, replace or remove a key-value pair.Vput(Spatial key, V value)Add or replace a key-value pair.Vremove(java.lang.Object key)Remove a key-value pair, if the key exists.voidsetQuadraticSplit(boolean quadraticSplit)private Page<Spatial,V>split(Page<Spatial,V> p)private Page<Spatial,V>splitLinear(Page<Spatial,V> p)private Page<Spatial,V>splitQuadratic(Page<Spatial,V> p)-
Methods inherited from class org.h2.mvstore.MVMap
append, asString, beforeWrite, ceilingKey, clear, containsKey, createEmptyLeaf, createEmptyNode, cursor, cursor, cursor, entrySet, equals, firstKey, floorKey, flushAndGetRoot, get, getId, getKey, getKeyIndex, getKeyType, getName, getRoot, getRootPage, getStore, getValueType, getVersion, hashCode, higherKey, higherKey, isClosed, isEmpty, isPersistent, isReadOnly, isVolatile, keyIterator, keyIteratorReverse, keyList, keySet, lastKey, lowerKey, lowerKey, openVersion, putIfAbsent, remove, replace, replace, setVolatile, size, sizeAsLong, toString, trimLast, tryLock, unlockRoot, updateRoot
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
-
-
-
Field Detail
-
keyType
private final SpatialDataType keyType
The spatial key type.
-
quadraticSplit
private boolean quadraticSplit
-
-
Constructor Detail
-
MVRTreeMap
public MVRTreeMap(java.util.Map<java.lang.String,java.lang.Object> config, SpatialDataType keyType, DataType<V> valueType)
-
MVRTreeMap
private MVRTreeMap(MVRTreeMap<V> source)
-
-
Method Detail
-
cloneIt
public MVRTreeMap<V> cloneIt()
Description copied from class:MVMapClone the current map.
-
findIntersectingKeys
public MVRTreeMap.RTreeCursor<V> findIntersectingKeys(Spatial x)
Iterate over all keys that have an intersection with the given rectangle.- Parameters:
x- the rectangle- Returns:
- the iterator
-
findContainedKeys
public MVRTreeMap.RTreeCursor<V> findContainedKeys(Spatial x)
Iterate over all keys that are fully contained within the given rectangle.- Parameters:
x- the rectangle- Returns:
- the iterator
-
get
public V get(Page<Spatial,V> p, Spatial key)
Get the object for the given key. An exact match is required.
-
remove
public V remove(java.lang.Object key)
Remove a key-value pair, if the key exists.
-
operate
public V operate(Spatial key, V value, MVMap.DecisionMaker<? super V> decisionMaker)
Description copied from class:MVMapAdd, replace or remove a key-value pair.
-
operate
private V operate(Page<Spatial,V> p, Spatial key, V value, MVMap.DecisionMaker<? super V> decisionMaker, java.util.Collection<Page<Spatial,V>> removedPages)
-
put
public V put(Spatial key, V value)
Description copied from class:MVMapAdd or replace a key-value pair.
-
add
public void add(Spatial key, V value)
Add a given key-value pair. The key should not exist (if it exists, the result is undefined).- Parameters:
key- the keyvalue- the value
-
move
private static <V> void move(Page<Spatial,V> source, Page<Spatial,V> target, int sourceIndex)
-
addNodeKeys
public void addNodeKeys(java.util.ArrayList<Spatial> list, Page<Spatial,V> p)
Add all node keys (including internal bounds) to the given list. This is mainly used to visualize the internal splits.- Parameters:
list- the listp- the root page
-
isQuadraticSplit
public boolean isQuadraticSplit()
-
setQuadraticSplit
public void setQuadraticSplit(boolean quadraticSplit)
-
getChildPageCount
protected int getChildPageCount(Page<Spatial,V> p)
Description copied from class:MVMapGet the child page count for this page. This is to allow another map implementation to override the default, in case the last child is not to be used.- Overrides:
getChildPageCountin classMVMap<Spatial,V>- Parameters:
p- the page- Returns:
- the number of direct children
-
-