Package org.h2.mvstore.db
Class RowDataType
- java.lang.Object
-
- org.h2.mvstore.type.BasicDataType<SearchRow>
-
- org.h2.mvstore.db.RowDataType
-
- All Implemented Interfaces:
java.util.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 Modifier and Type Class Description static classRowDataType.Factory
-
Field Summary
Fields Modifier and Type Field Description private intcolumnCountprivate static RowDataType.FactoryFACTORYprivate int[]indexesprivate int[]sortTypesprivate booleanstoreKeysprivate ValueDataTypevalueDataType
-
Constructor Summary
Constructors Constructor Description RowDataType(CastDataProvider provider, CompareMode compareMode, DataHandler handler, int[] sortTypes, int[] indexes, int columnCount, boolean storeKeys)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intbinarySearch(SearchRow key, java.lang.Object storage, int size, int initialGuess)Perform binary search for the key within the storageintbinarySearch(SearchRow key, SearchRow[] keys, int size, int initialGuess)intcompare(SearchRow a, SearchRow b)Compare two keys.private intcompareSearchRows(SearchRow a, SearchRow b)SearchRow[]createStorage(int capacity)Create storage object of array type to hold valuesbooleanequals(java.lang.Object obj)intgetColumnCount()RowDataType.FactorygetFactory()int[]getIndexes()intgetMemory(SearchRow row)Calculates the amount of used memory in bytes.RowFactorygetRowFactory()inthashCode()booleanisStoreKeys()SearchRowread(java.nio.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.private static voidwriteIntArray(WriteBuffer buff, int[] array)-
Methods inherited from class org.h2.mvstore.type.BasicDataType
cast, isMemoryEstimationAllowed, read, write
-
-
-
-
Field Detail
-
valueDataType
private final ValueDataType valueDataType
-
sortTypes
private final int[] sortTypes
-
indexes
private final int[] indexes
-
columnCount
private final int columnCount
-
storeKeys
private final boolean storeKeys
-
FACTORY
private static final RowDataType.Factory FACTORY
-
-
Constructor Detail
-
RowDataType
public RowDataType(CastDataProvider provider, CompareMode compareMode, DataHandler handler, int[] sortTypes, int[] indexes, int columnCount, boolean storeKeys)
-
-
Method Detail
-
getIndexes
public int[] getIndexes()
-
getRowFactory
public RowFactory getRowFactory()
-
setRowFactory
public void setRowFactory(RowFactory rowFactory)
-
getColumnCount
public int getColumnCount()
-
isStoreKeys
public boolean isStoreKeys()
-
createStorage
public SearchRow[] createStorage(int capacity)
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
public int compare(SearchRow a, SearchRow b)
Description copied from interface:DataTypeCompare two keys.
-
binarySearch
public int binarySearch(SearchRow key, java.lang.Object storage, int size, int initialGuess)
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
-
getMemory
public int getMemory(SearchRow row)
Description copied from interface:DataTypeCalculates the amount of used memory in bytes.
-
read
public SearchRow read(java.nio.ByteBuffer buff)
Description copied from interface:DataTypeRead an object.
-
write
public void write(WriteBuffer buff, SearchRow row)
Description copied from interface:DataTypeWrite an object.
-
equals
public boolean equals(java.lang.Object obj)
- Specified by:
equalsin interfacejava.util.Comparator<SearchRow>- Overrides:
equalsin classBasicDataType<SearchRow>
-
hashCode
public int hashCode()
- Overrides:
hashCodein classBasicDataType<SearchRow>
-
save
public void save(WriteBuffer buff, MetaType<Database> metaType)
Description copied from interface:StatefulDataTypeSave the state.- Specified by:
savein interfaceStatefulDataType<Database>- Parameters:
buff- the target buffermetaType- the meta type
-
writeIntArray
private static void writeIntArray(WriteBuffer buff, int[] array)
-
getFactory
public RowDataType.Factory getFactory()
- Specified by:
getFactoryin interfaceStatefulDataType<Database>
-
-