Package org.h2.mvstore.db
Class RowDataType
- All Implemented Interfaces:
Comparator<SearchRow>,DataType<SearchRow>,StatefulDataType<Database>
public final class RowDataType
extends BasicDataType<SearchRow>
implements StatefulDataType<Database>
The data type for rows.
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionRowDataType(CastDataProvider provider, CompareMode compareMode, DataHandler handler, int[] sortTypes, int[] indexes, int columnCount, boolean storeKeys) -
Method Summary
Modifier and TypeMethodDescriptionintbinarySearch(SearchRow key, Object storage, int size, int initialGuess) Perform binary search for the key within the storageintbinarySearch(SearchRow key, SearchRow[] keys, int size, int initialGuess) intCompare two keys.createStorage(int capacity) Create storage object of array type to hold valuesbooleanintint[]intCalculates the amount of used memory in bytes.inthashCode()booleanread(ByteBuffer buff) Read an object.voidsave(WriteBuffer buff, MetaType<Database> metaType) Save the state.voidsetRowFactory(RowFactory rowFactory) voidwrite(WriteBuffer buff, SearchRow row) Write an object.Methods inherited from class org.h2.mvstore.type.BasicDataType
cast, 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
-
Constructor Details
-
RowDataType
public RowDataType(CastDataProvider provider, CompareMode compareMode, DataHandler handler, int[] sortTypes, int[] indexes, int columnCount, boolean storeKeys)
-
-
Method Details
-
getIndexes
public int[] getIndexes() -
getRowFactory
-
setRowFactory
-
getColumnCount
public int getColumnCount() -
isStoreKeys
public boolean isStoreKeys() -
createStorage
Description copied from interface:DataTypeCreate storage object of array type to hold values- Specified by:
createStoragein interfaceDataType<SearchRow>- Parameters:
capacity- number of values to hold- Returns:
- storage object
-
compare
Description copied from interface:DataTypeCompare two keys.- Specified by:
comparein interfaceComparator<SearchRow>- Specified by:
comparein interfaceDataType<SearchRow>- Overrides:
comparein classBasicDataType<SearchRow>- Parameters:
a- the first keyb- 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<SearchRow>- Overrides:
binarySearchin classBasicDataType<SearchRow>- Parameters:
key- to search forstorage- 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
-
getMemory
Description copied from interface:DataTypeCalculates the amount of used memory in bytes. -
read
Description copied from interface:DataTypeRead an object. -
write
Description copied from interface:DataTypeWrite an object. -
equals
- Specified by:
equalsin interfaceComparator<SearchRow>- Overrides:
equalsin classBasicDataType<SearchRow>
-
hashCode
public int hashCode()- Overrides:
hashCodein classBasicDataType<SearchRow>
-
save
Description copied from interface:StatefulDataTypeSave the state.- Specified by:
savein interfaceStatefulDataType<Database>- Parameters:
buff- the target buffermetaType- the meta type
-
getFactory
- Specified by:
getFactoryin interfaceStatefulDataType<Database>
-