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 class
RowDataType.Factory
-
Field Summary
Fields Modifier and Type Field Description private int
columnCount
private static RowDataType.Factory
FACTORY
private int[]
indexes
private int[]
sortTypes
private boolean
storeKeys
private ValueDataType
valueDataType
-
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 int
binarySearch(SearchRow key, java.lang.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(SearchRow a, SearchRow b)
Compare two keys.private int
compareSearchRows(SearchRow a, SearchRow b)
SearchRow[]
createStorage(int capacity)
Create storage object of array type to hold valuesboolean
equals(java.lang.Object obj)
int
getColumnCount()
RowDataType.Factory
getFactory()
int[]
getIndexes()
int
getMemory(SearchRow row)
Calculates the amount of used memory in bytes.RowFactory
getRowFactory()
int
hashCode()
boolean
isStoreKeys()
SearchRow
read(java.nio.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
-
-
-
-
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: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
public int compare(SearchRow a, SearchRow b)
Description copied from interface:DataType
Compare two keys.
-
binarySearch
public int binarySearch(SearchRow key, java.lang.Object storage, int size, int initialGuess)
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
-
getMemory
public int getMemory(SearchRow row)
Description copied from interface:DataType
Calculates the amount of used memory in bytes.
-
read
public SearchRow read(java.nio.ByteBuffer buff)
Description copied from interface:DataType
Read an object.
-
write
public void write(WriteBuffer buff, SearchRow row)
Description copied from interface:DataType
Write an object.
-
equals
public boolean equals(java.lang.Object obj)
- Specified by:
equals
in interfacejava.util.Comparator<SearchRow>
- Overrides:
equals
in classBasicDataType<SearchRow>
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classBasicDataType<SearchRow>
-
save
public void save(WriteBuffer buff, MetaType<Database> metaType)
Description copied from interface:StatefulDataType
Save the state.- Specified by:
save
in 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:
getFactory
in interfaceStatefulDataType<Database>
-
-