## org.h2.mvstore.rtree
Class MVRTreeMap<V>

    java.lang.Object
      java.util.AbstractMap<K,V>
          org.h2.mvstore.MVMap<SpatialKey,V>
              org.h2.mvstore.rtree.MVRTreeMap<V>

Type Parameters:
  `V` - the value class

All Implemented Interfaces:
  java.util.concurrent.ConcurrentMap<SpatialKey,V>, java.util.Map<SpatialKey,V>

    public class MVRTreeMap<V>

extends MVMap<SpatialKey,V>

An r-tree implementation. It uses the quadratic split algorithm.

Nested Class Summary

Nested classes/interfaces inherited from class java.util.AbstractMap
`java.util.AbstractMap.SimpleEntry<K,V>, java.util.AbstractMap.SimpleImmutableEntry<K,V>`

Nested classes/interfaces inherited from interface java.util.Map
`java.util.Map.Entry<K,V>`

Field Summary

Fields inherited from class org.h2.mvstore.MVMap
`root, store`

Constructor Summary
`MVRTreeMap(int dimensions, DataType valueType)`

Method Summary
`void` `add(SpatialKey key, V value)` Add a given key-value pair.
`void` `addNodeKeys(java.util.ArrayList<SpatialKey> list, Page p)` Add all node keys (including internal bounds) to the given list.

`static

`<V> MVRTreeMap<V>`

`

`create(int dimensions, DataType valueType)`
Create a new map with the given dimensions and value type.

`java.util.Iterator<SpatialKey>` `findContainedKeys(SpatialKey x)` Iterate over all keys that are fully contained within the given rectangle.
`java.util.Iterator<SpatialKey>` `findIntersectingKeys(SpatialKey x)` Iterate over all keys that have an intersection with the given rectangle.
`V` `get(java.lang.Object key)` Get a value.
`protected java.lang.Object` `get(Page p, java.lang.Object key)` Get the object for the given key.
`protected int` `getChildPageCount(Page p)` Get the child page count for this page.
`protected Page` `getPage(SpatialKey key)` Get the page for the given value.
`java.lang.String` `getType()` Get the map type.
`boolean` `isQuadraticSplit()`
`V` `put(SpatialKey key, V value)` Add or replace a key-value pair.
`protected java.lang.Object` `remove(Page p, long writeVersion, java.lang.Object key)` Remove a key-value pair.
`void` `setQuadraticSplit(boolean quadraticSplit)`

Methods inherited from class org.h2.mvstore.MVMap

`asString, binarySearch, binarySearchPage, ceilingKey, changeIterator, checkOpen, checkWrite, clear, close, containsKey, entrySet, equals, firstKey, floorKey, getKey, getKeyIndex, getKeyType, getRoot, getSize, getValueType, getVersion, hashCode, hasUnsavedChanges, higherKey, isClosed, isReadOnly, keyIterator, keyList, keySet, lastKey, lowerKey, newRoot, open, openReadOnly, openVersion, put, putIfAbsent, remove, remove, removeMap, removePage, replace, replace, setReadOnly, size`

Methods inherited from class java.util.AbstractMap
`clone, containsValue, isEmpty, putAll, toString, values`

Methods inherited from class java.lang.Object
`finalize, getClass, notify, notifyAll, wait, wait, wait`

Methods inherited from interface java.util.Map
`containsValue, isEmpty, putAll, values`

Constructor Detail

### MVRTreeMap

    public MVRTreeMap(int dimensions,
                      DataType valueType)

Method Detail

### create

    public static <V> MVRTreeMap<V> create(int dimensions,
                                           DataType valueType)

  Create a new map with the given dimensions and value type.

  Type Parameters:
    `V` - the value type
  Parameters:
    `dimensions` - the number of dimensions
    `valueType` - the value type
  Returns:
    the map

### get

    public V get(java.lang.Object key)

  Description copied from class: `MVMap`
  Get a value.

  Specified by:
    `get` in interface `java.util.Map<SpatialKey,V>`
  Overrides:
    `get` in class `MVMap<SpatialKey,V>`
  Parameters:
    `key` - the key
  Returns:
    the value, or null if not found

### findIntersectingKeys

    public java.util.Iterator<SpatialKey> findIntersectingKeys(SpatialKey x)

  Iterate over all keys that have an intersection with the given rectangle.

  Parameters:
    `x` - the rectangle
  Returns:
    the iterator

### findContainedKeys

    public java.util.Iterator<SpatialKey> findContainedKeys(SpatialKey x)

  Iterate over all keys that are fully contained within the given rectangle.

  Parameters:
    `x` - the rectangle
  Returns:
    the iterator

### get

    protected java.lang.Object get(Page p,
                                   java.lang.Object key)

  Get the object for the given key. An exact match is required.

  Parameters:
    `p` - the page
    `key` - the key
  Returns:
    the value, or null if not found

### getPage

    protected Page getPage(SpatialKey key)

  Description copied from class: `MVMap`
  Get the page for the given value.

  Overrides:
    `getPage` in class `MVMap<SpatialKey,V>`
  Parameters:
    `key` - the key
  Returns:
    the value, or null if not found

### remove

    protected java.lang.Object remove(Page p,
                                      long writeVersion,
                                      java.lang.Object key)

  Description copied from class: `MVMap`
  Remove a key-value pair.

  Overrides:
    `remove` in class `MVMap<SpatialKey,V>`
  Parameters:
    `p` - the page (may not be null)
    `writeVersion` - the write version
    `key` - the key
  Returns:
    the old value, or null if the key did not exist

### put

    public V put(SpatialKey key,
                 V value)

  Description copied from class: `MVMap`
  Add or replace a key-value pair.

  Specified by:
    `put` in interface `java.util.Map<SpatialKey,V>`
  Overrides:
    `put` in class `MVMap<SpatialKey,V>`
  Parameters:
    `key` - the key (may not be null)
    `value` - the value (may not be null)
  Returns:
    the old value if the key existed, or null otherwise

### add

    public void add(SpatialKey key,
                    V value)

  Add a given key-value pair. The key should not exist (if it exists, the result is undefined).

  Parameters:
    `key` - the key
    `value` - the value

### addNodeKeys

    public void addNodeKeys(java.util.ArrayList<SpatialKey> list,
                            Page p)

  Add all node keys (including internal bounds) to the given list. This is mainly used to visualize the internal splits.

  Parameters:
    `list` - the list
    `p` - the root page

### isQuadraticSplit

    public boolean isQuadraticSplit()

### setQuadraticSplit

    public void setQuadraticSplit(boolean quadraticSplit)

### getChildPageCount

    protected int getChildPageCount(Page p)

  Description copied from class: `MVMap`
  Get 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:
    `getChildPageCount` in class `MVMap<SpatialKey,V>`
  Parameters:
    `p` - the page
  Returns:
    the number of direct children

### getType

    public java.lang.String getType()

  Description copied from class: `MVMap`
  Get the map type. When opening an existing map, the map type must match.

  Overrides:
    `getType` in class `MVMap<SpatialKey,V>`
  Returns:
    the map type