Package org.h2.mvstore.type
Class IntegerDataType
- All Implemented Interfaces:
Comparator<Integer>,DataType<Integer>
Class IntegerDataType.
- 4/10/24 1:18 PM initial creation
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionintbinarySearch(Integer keyObj, Object storageObj, int size, int initialGuess) Perform binary search for the key within the storageintCompare two keys.Integer[]createStorage(int size) Create storage object of array type to hold valuesintCalculates the amount of used memory in bytes.read(ByteBuffer buff) Read an object.voidwrite(WriteBuffer buff, Integer data) Write an object.Methods inherited from class org.h2.mvstore.type.BasicDataType
cast, equals, hashCode, isMemoryEstimationAllowed, read, writeMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Comparator
reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Field Details
-
INSTANCE
-
-
Method Details
-
getMemory
Description copied from interface:DataTypeCalculates the amount of used memory in bytes. -
write
Description copied from interface:DataTypeWrite an object. -
read
Description copied from interface:DataTypeRead an object. -
createStorage
Description copied from interface:DataTypeCreate storage object of array type to hold values- Parameters:
size- number of values to hold- Returns:
- storage object
-
compare
Description copied from interface:DataTypeCompare two keys.- Specified by:
comparein interfaceComparator<Integer>- Specified by:
comparein interfaceDataType<Integer>- Overrides:
comparein classBasicDataType<Integer>- Parameters:
one- the first keytwo- the second key- Returns:
- -1 if the first key is smaller, 1 if larger, and 0 if equal
-
binarySearch
Description copied from interface:DataTypePerform binary search for the key within the storage- Specified by:
binarySearchin interfaceDataType<Integer>- Overrides:
binarySearchin classBasicDataType<Integer>- Parameters:
keyObj- to search forstorageObj- to search within (an array of type T)size- number of data items in the storageinitialGuess- for key position- Returns:
- index of the key , if found, - index of the insertion point, if not
-