## org.h2.mvstore.rtree
Class SpatialType

    java.lang.Object
      org.h2.mvstore.rtree.SpatialType

All Implemented Interfaces:
  DataType

    public class SpatialType

extends java.lang.Object
implements DataType

A spatial data type. This class supports up to 255 dimensions. Each dimension can have a minimum and a maximum value of type float. For each dimension, the maximum value is only stored when it is not the same as the minimum.

Constructor Summary
`SpatialType(int dimensions)`

Method Summary
`java.lang.String` `asString()` Get the stable string representation that is used to build this data type.
`int` `compare(java.lang.Object a, java.lang.Object b)` Compare two keys.
`boolean` `contains(java.lang.Object objA, java.lang.Object objB)` Check whether a contains b.
`boolean` `equals(java.lang.Object a, java.lang.Object b)` Check whether two spatial values are equal.
`static SpatialType` `fromString(java.lang.String s)` Read a value from a string.
`float` `getAreaIncrease(java.lang.Object objA, java.lang.Object objB)` Get the area increase by extending a to contain b.
`int[]` `getExtremes(java.util.ArrayList<java.lang.Object> list)` Get the most extreme pair (elements that are as far apart as possible).
`int` `getMaxLength(java.lang.Object obj)` Get the maximum length in bytes used to store an object.
`int` `getMemory(java.lang.Object obj)` Estimate the used memory in bytes.
`void` `increaseBounds(java.lang.Object bounds, java.lang.Object add)` Increase the bounds in the given spatial object.
`boolean` `isInside(java.lang.Object objA, java.lang.Object objB)` Check whether a is completely inside b and does not touch the given bound.
`boolean` `isOverlap(java.lang.Object objA, java.lang.Object objB)` Check whether the two objects overlap.
`java.lang.Object` `read(java.nio.ByteBuffer buff)` Read an object.
`void` `write(java.nio.ByteBuffer buff, java.lang.Object obj)` Write the object.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### SpatialType

    public SpatialType(int dimensions)

Method Detail

### fromString

    public static SpatialType fromString(java.lang.String s)

  Read a value from a string.

  Parameters:
    `s` - the string
  Returns:
    the value

### compare

    public int compare(java.lang.Object a,
                       java.lang.Object b)

  Description copied from interface: `DataType`
  Compare two keys.

  Specified by:
    `compare` in interface `DataType`
  Parameters:
    `a` - the first key
    `b` - the second key
  Returns:
    -1 if the first key is smaller, 1 if larger, and 0 if equal

### equals

    public boolean equals(java.lang.Object a,
                          java.lang.Object b)

  Check whether two spatial values are equal.

  Parameters:
    `a` - the first value
    `b` - the second value
  Returns:
    true if they are equal

### getMaxLength

    public int getMaxLength(java.lang.Object obj)

  Description copied from interface: `DataType`
  Get the maximum length in bytes used to store an object. In many cases, this method can be faster than calculating the exact length.

  Specified by:
    `getMaxLength` in interface `DataType`
  Parameters:
    `obj` - the object
  Returns:
    the maximum length

### getMemory

    public int getMemory(java.lang.Object obj)

  Description copied from interface: `DataType`
  Estimate the used memory in bytes.

  Specified by:
    `getMemory` in interface `DataType`
  Parameters:
    `obj` - the object
  Returns:
    the used memory

### write

    public void write(java.nio.ByteBuffer buff,
                      java.lang.Object obj)

  Description copied from interface: `DataType`
  Write the object.

  Specified by:
    `write` in interface `DataType`
  Parameters:
    `buff` - the target buffer
    `obj` - the value

### read

    public java.lang.Object read(java.nio.ByteBuffer buff)

  Description copied from interface: `DataType`
  Read an object.

  Specified by:
    `read` in interface `DataType`
  Parameters:
    `buff` - the source buffer
  Returns:
    the object

### asString

    public java.lang.String asString()

  Description copied from interface: `DataType`
  Get the stable string representation that is used to build this data type.

  To avoid conflict with the default factory, the returned string should start with the package name of the type factory.

  Specified by:
    `asString` in interface `DataType`
  Returns:
    the string representation

### isOverlap

    public boolean isOverlap(java.lang.Object objA,
                             java.lang.Object objB)

  Check whether the two objects overlap.

  Parameters:
    `objA` - the first object
    `objB` - the second object
  Returns:
    true if they overlap

### increaseBounds

    public void increaseBounds(java.lang.Object bounds,
                               java.lang.Object add)

  Increase the bounds in the given spatial object.

  Parameters:
    `bounds` - the bounds (may be modified)
    `add` - the value

### getAreaIncrease

    public float getAreaIncrease(java.lang.Object objA,
                                 java.lang.Object objB)

  Get the area increase by extending a to contain b.

  Parameters:
    `objA` - the bounding box
    `objB` - the object
  Returns:
    the area

### contains

    public boolean contains(java.lang.Object objA,
                            java.lang.Object objB)

  Check whether a contains b.

  Parameters:
    `objA` - the bounding box
    `objB` - the object
  Returns:
    the area

### isInside

    public boolean isInside(java.lang.Object objA,
                            java.lang.Object objB)

  Check whether a is completely inside b and does not touch the given bound.

  Parameters:
    `objA` - the object to check
    `objB` - the bounds
  Returns:
    true if a is completely inside b

### getExtremes

    public int[] getExtremes(java.util.ArrayList<java.lang.Object> list)

  Get the most extreme pair (elements that are as far apart as possible). This method is used to split a page (linear split). If no extreme objects could be found, this method returns null.

  Parameters:
    `list` - the objects
  Returns:
    the indexes of the extremes