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 intprivate static final RowDataType.Factoryprivate final int[]private final int[]private final booleanprivate final ValueDataType -
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.private intcreateStorage(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.private static voidwriteIntArray(WriteBuffer buff, int[] array) Methods inherited from class BasicDataType
cast, isMemoryEstimationAllowed, read, writeMethods inherited from class Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface 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: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
-
compareSearchRows
-
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
-
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
-
writeIntArray
-
getFactory
- Specified by:
getFactoryin interfaceStatefulDataType<Database>
-