Package org.h2.mvstore.rtree
Class SpatialDataType
- All Implemented Interfaces:
Comparator<Spatial>
,DataType<Spatial>
A spatial data type. This class supports up to 31 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.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
Compare two keys.boolean
Check whether a contains b.protected Spatial
create
(long id, float... minMax) Creates spatial object with specified parameters.(package private) Spatial
createBoundingBox
(Object objA) Create a bounding box starting with the given object.Spatial[]
createStorage
(int size) Create storage object of array type to hold valuesboolean
Check whether two spatial values are equal.private float
float
getAreaIncrease
(Object objA, Object objB) Get the area increase by extending a to contain b.(package private) float
getCombinedArea
(Object objA, Object objB) Get the combined area of both objects.int[]
getExtremes
(ArrayList<Object> list) Get the most extreme pair (elements that are as far apart as possible).int
Calculates the amount of used memory in bytes.getNotNull
(ArrayList<Object> list) void
increaseBounds
(Object bounds, Object add) Increase the bounds in the given spatial object.private void
increaseMaxInnerBounds
(Object bounds, Object add) boolean
Check whether a is completely inside b and does not touch the given bound.boolean
Check whether the two objects overlap.read
(ByteBuffer buff) Read an object.void
write
(WriteBuffer buff, Spatial k) Write an object.Methods inherited from class org.h2.mvstore.type.BasicDataType
binarySearch, cast, equals, hashCode, isMemoryEstimationAllowed, read, write
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Comparator
reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Field Details
-
dimensions
private final int dimensions
-
-
Constructor Details
-
SpatialDataType
public SpatialDataType(int dimensions)
-
-
Method Details
-
create
Creates spatial object with specified parameters.- Parameters:
id
- the IDminMax
- min x, max x, min y, max y, and so on- Returns:
- the spatial object
-
createStorage
Description copied from interface:DataType
Create storage object of array type to hold values- Parameters:
size
- number of values to hold- Returns:
- storage object
-
compare
Description copied from interface:DataType
Compare two keys.- Specified by:
compare
in interfaceComparator<Spatial>
- Specified by:
compare
in interfaceDataType<Spatial>
- Overrides:
compare
in classBasicDataType<Spatial>
- Parameters:
a
- the first keyb
- the second key- Returns:
- -1 if the first key is smaller, 1 if larger, and 0 if equal
-
equals
Check whether two spatial values are equal.- Parameters:
a
- the first valueb
- the second value- Returns:
- true if they are equal
-
getMemory
Description copied from interface:DataType
Calculates the amount of used memory in bytes. -
write
Description copied from interface:DataType
Write an object. -
read
Description copied from interface:DataType
Read an object. -
isOverlap
Check whether the two objects overlap.- Parameters:
a
- the first objectb
- the second object- Returns:
- true if they overlap
-
increaseBounds
Increase the bounds in the given spatial object.- Parameters:
bounds
- the bounds (may be modified)add
- the value
-
getAreaIncrease
Get the area increase by extending a to contain b.- Parameters:
objA
- the bounding boxobjB
- the object- Returns:
- the area
-
getCombinedArea
Get the combined area of both objects.- Parameters:
objA
- the first objectobjB
- the second object- Returns:
- the area
-
getArea
-
contains
Check whether a contains b.- Parameters:
objA
- the bounding boxobjB
- the object- Returns:
- the area
-
isInside
Check whether a is completely inside b and does not touch the given bound.- Parameters:
objA
- the object to checkobjB
- the bounds- Returns:
- true if a is completely inside b
-
createBoundingBox
Create a bounding box starting with the given object.- Parameters:
objA
- the object- Returns:
- the bounding box
-
getExtremes
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
-
getNotNull
-
increaseMaxInnerBounds
-