Package org.h2.mvstore.type
Class LongDataType
- All Implemented Interfaces:
Comparator<Long>
,DataType<Long>
Class LongDataType.
- 8/21/17 6:52 PM initial creation
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static int
binarySearch
(long key, Long[] storage, int low, int high, int x) int
binarySearch
(Long keyObj, Object storageObj, int size, int initialGuess) Perform binary search for the key within the storageint
Compare two keys.Long[]
createStorage
(int size) Create storage object of array type to hold valuesint
Calculates the amount of used memory in bytes.read
(ByteBuffer buff) Read an object.void
write
(WriteBuffer buff, Long data) Write an object.Methods inherited from class org.h2.mvstore.type.BasicDataType
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
-
INSTANCE
-
EMPTY_LONG_ARR
-
-
Constructor Details
-
LongDataType
private LongDataType()
-
-
Method Details
-
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. -
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<Long>
- Specified by:
compare
in interfaceDataType<Long>
- Overrides:
compare
in classBasicDataType<Long>
- 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:DataType
Perform binary search for the key within the storage- Specified by:
binarySearch
in interfaceDataType<Long>
- Overrides:
binarySearch
in classBasicDataType<Long>
- 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
-
binarySearch
-