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 -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final int
private static final RowDataType.Factory
private final int[]
private final int[]
private final boolean
private final ValueDataType
-
Constructor Summary
ConstructorsConstructorDescriptionRowDataType
(CastDataProvider provider, CompareMode compareMode, DataHandler handler, int[] sortTypes, int[] indexes, int columnCount, boolean storeKeys) -
Method Summary
Modifier and TypeMethodDescriptionint
binarySearch
(SearchRow key, Object storage, int size, int initialGuess) Perform binary search for the key within the storageint
binarySearch
(SearchRow key, SearchRow[] keys, int size, int initialGuess) int
Compare two keys.private int
createStorage
(int capacity) Create storage object of array type to hold valuesboolean
int
int[]
int
Calculates the amount of used memory in bytes.int
hashCode()
boolean
read
(ByteBuffer buff) Read an object.void
save
(WriteBuffer buff, MetaType<Database> metaType) Save the state.void
setRowFactory
(RowFactory rowFactory) void
write
(WriteBuffer buff, SearchRow row) Write an object.private static void
writeIntArray
(WriteBuffer buff, int[] array) Methods inherited from class org.h2.mvstore.type.BasicDataType
cast, 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
-
valueDataType
-
sortTypes
private final int[] sortTypes -
indexes
private final int[] indexes -
columnCount
private final int columnCount -
storeKeys
private final boolean storeKeys -
FACTORY
-
-
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:DataType
Create storage object of array type to hold values- Specified by:
createStorage
in interfaceDataType<SearchRow>
- Parameters:
capacity
- number of values to hold- Returns:
- storage object
-
compare
Description copied from interface:DataType
Compare two keys.- Specified by:
compare
in interfaceComparator<SearchRow>
- Specified by:
compare
in interfaceDataType<SearchRow>
- Overrides:
compare
in 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
-
compareSearchRows
-
binarySearch
Description copied from interface:DataType
Perform binary search for the key within the storage- Specified by:
binarySearch
in interfaceDataType<SearchRow>
- Overrides:
binarySearch
in 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:DataType
Calculates the amount of used memory in bytes. -
read
Description copied from interface:DataType
Read an object. -
write
Description copied from interface:DataType
Write an object. -
equals
- Specified by:
equals
in interfaceComparator<SearchRow>
- Overrides:
equals
in classBasicDataType<SearchRow>
-
hashCode
public int hashCode()- Overrides:
hashCode
in classBasicDataType<SearchRow>
-
save
Description copied from interface:StatefulDataType
Save the state.- Specified by:
save
in interfaceStatefulDataType<Database>
- Parameters:
buff
- the target buffermetaType
- the meta type
-
writeIntArray
-
getFactory
- Specified by:
getFactory
in interfaceStatefulDataType<Database>
-