Package org.h2.mvstore.db

# Class RowDataType

java.lang.Object
org.h2.mvstore.type.BasicDataType<SearchRow>
org.h2.mvstore.db.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
Modifier and Type
Class
Description
`static final class`
`RowDataType.Factory`

## Constructor Summary

Constructors
Constructor
Description
`RowDataType(CastDataProvider provider, CompareMode compareMode, DataHandler handler, int[] sortTypes, int[] indexes, int columnCount, boolean storeKeys)`

## Method Summary

Modifier and Type
Method
Description
`int`
`binarySearch(SearchRow key, Object storage, int size, int initialGuess)`
Perform binary search for the key within the storage
`int`
`binarySearch(SearchRow key, SearchRow[] keys, int size, int initialGuess)`
`int`
`compare(SearchRow a, SearchRow b)`
Compare two keys.
`SearchRow[]`
`createStorage(int capacity)`
Create storage object of array type to hold values
`boolean`
`equals(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(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.

### 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`

## 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

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 interface `DataType<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.

Specified by:
  `compare` in interface `Comparator<SearchRow>`
Specified by:
  `compare` in interface `DataType<SearchRow>`
Overrides:
  `compare` in class `BasicDataType<SearchRow>`
Parameters:
  `a` - the first key
  `b` - the second key
Returns:
  -1 if the first key is smaller, 1 if larger, and 0 if equal

### binarySearch

public int binarySearch(SearchRow key, Object storage, int size, int initialGuess)
Description copied from interface: `DataType`
Perform binary search for the key within the storage

Specified by:
  `binarySearch` in interface `DataType<SearchRow>`
Overrides:
  `binarySearch` in class `BasicDataType<SearchRow>`
Parameters:
  `key` - to search for
  `storage` - to search within (an array of type T)
  `size` - number of data items in the storage
  `initialGuess` - for key position
Returns:
  index of the key , if found, - index of the insertion point, if not

### binarySearch

public int binarySearch(SearchRow key, SearchRow[] keys, int size, int initialGuess)

### getMemory

public int getMemory(SearchRow row)
Description copied from interface: `DataType`
Calculates the amount of used memory in bytes.

Specified by:
  `getMemory` in interface `DataType<SearchRow>`
Specified by:
  `getMemory` in class `BasicDataType<SearchRow>`
Parameters:
  `row` - the object
Returns:
  the used memory

### read

public SearchRow read(ByteBuffer buff)
Description copied from interface: `DataType`
Read an object.

Specified by:
  `read` in interface `DataType<SearchRow>`
Specified by:
  `read` in class `BasicDataType<SearchRow>`
Parameters:
  `buff` - the source buffer
Returns:
  the object

### write

public void write(WriteBuffer buff, SearchRow row)
Description copied from interface: `DataType`
Write an object.

Specified by:
  `write` in interface `DataType<SearchRow>`
Specified by:
  `write` in class `BasicDataType<SearchRow>`
Parameters:
  `buff` - the target buffer
  `row` - the value

### equals

public boolean equals(Object obj)

Specified by:
  `equals` in interface `Comparator<SearchRow>`
Overrides:
  `equals` in class `BasicDataType<SearchRow>`

### hashCode

public int hashCode()

Overrides:
  `hashCode` in class `BasicDataType<SearchRow>`

### save

public void save(WriteBuffer buff, MetaType<Database> metaType)
Description copied from interface: `StatefulDataType`
Save the state.

Specified by:
  `save` in interface `StatefulDataType<Database>`
Parameters:
  `buff` - the target buffer
  `metaType` - the meta type

### getFactory

public RowDataType.Factory getFactory()

Specified by:
  `getFactory` in interface `StatefulDataType<Database>`