Top Description Inners Fields Constructors Methods
org.h2.mvstore.db

public final Class RowDataType

extends BasicDataType<SearchRow>
implements StatefulDataType<Database>
Class Inheritance
All Implemented Interfaces
org.h2.mvstore.type.StatefulDataType
Imports
java.nio.ByteBuffer, java.util.Arrays, org.h2.engine.CastDataProvider, .Database, org.h2.mvstore.DataUtils, .WriteBuffer, org.h2.mvstore.type.BasicDataType, .MetaType, .StatefulDataType, org.h2.result.RowFactory, .SearchRow, org.h2.store.DataHandler, org.h2.value.CompareMode, .TypeInfo, .Value

The data type for rows.
Author
Andrei Tokar

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class

Field Summary

Modifier and TypeField and Description
private final int
private static final RowDataType.Factory
private final int[]
private final int[]
private final boolean
private final ValueDataType

Constructor Summary

AccessConstructor and Description
public
RowDataType(CastDataProvider provider, CompareMode compareMode, DataHandler handler, int[] sortTypes, int[] indexes, int columnCount, boolean storeKeys)

Method Summary

Modifier and TypeMethod and Description
public int
binarySearch(SearchRow
to search for
key
,
Object
to search within (an array of type T)
storage
,
int
number of data items in the storage
size
,
int
for key position
initialGuess
)

Overrides org.h2.mvstore.type.BasicDataType.binarySearch.

Implements org.h2.mvstore.type.DataType.binarySearch.

Perform binary search for the key within the storage

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

public int
compare(SearchRow
the first key
a
,
SearchRow
the second key
b
)

Overrides org.h2.mvstore.type.BasicDataType.compare.

Implements org.h2.mvstore.type.DataType.compare.

Compare two keys.

private int
public SearchRow[]
createStorage(int
number of values to hold
capacity
)

Implements org.h2.mvstore.type.DataType.createStorage.

Create storage object of array type to hold values

public boolean
equals(Object
the reference object with which to compare.
obj
)

Overrides org.h2.mvstore.type.BasicDataType.equals.

Implements java.util.Comparator.equals.

Indicates whether some other object is "equal to" this comparator.

public int
public RowDataType.Factory
public int[]
public int
getMemory(SearchRow
the object
row
)

Implements abstract org.h2.mvstore.type.BasicDataType.getMemory.

Implements org.h2.mvstore.type.DataType.getMemory.

Calculates the amount of used memory in bytes.

public RowFactory
public int
hashCode()

Overrides org.h2.mvstore.type.BasicDataType.hashCode.

Returns a hash code value for this object.

public boolean
public SearchRow
read(ByteBuffer
the source buffer
buff
)

Implements abstract org.h2.mvstore.type.BasicDataType.read.

Implements org.h2.mvstore.type.DataType.read.

Read an object.

public void
save(WriteBuffer
the target buffer
buff
,
MetaType<Database>
the meta type
metaType
)

Implements org.h2.mvstore.type.StatefulDataType.save.

Save the state.

public void
public void
write(WriteBuffer
the target buffer
buff
,
SearchRow
the value
row
)

Implements abstract org.h2.mvstore.type.BasicDataType.write.

Implements org.h2.mvstore.type.DataType.write.

Write an object.

private static void
writeIntArray(WriteBuffer buff, int[] array)

Inherited from org.h2.mvstore.type.BasicDataType:
castisMemoryEstimationAllowedreadwrite

Field Detail

columnCountback to summary
private final int columnCount
FACTORYback to summary
private static final RowDataType.Factory FACTORY
indexesback to summary
private final int[] indexes
sortTypesback to summary
private final int[] sortTypes
storeKeysback to summary
private final boolean storeKeys
valueDataTypeback to summary
private final ValueDataType valueDataType

Constructor Detail

RowDataTypeback to summary
public RowDataType(CastDataProvider provider, CompareMode compareMode, DataHandler handler, int[] sortTypes, int[] indexes, int columnCount, boolean storeKeys)

Method Detail

binarySearchback to summary
public int binarySearch(SearchRow key, Object storage, int size, int initialGuess)

Overrides org.h2.mvstore.type.BasicDataType.binarySearch.

Implements org.h2.mvstore.type.DataType.binarySearch.

Doc from org.h2.mvstore.type.DataType.binarySearch.

Perform binary search for the key within the storage

Parameters
key:SearchRow

to search for

storage:Object

to search within (an array of type T)

size:int

number of data items in the storage

initialGuess:int

for key position

Returns:int

index of the key , if found, - index of the insertion point, if not

Annotations
@Override
binarySearchback to summary
public int binarySearch(SearchRow key, SearchRow[] keys, int size, int initialGuess)
compareback to summary
public int compare(SearchRow a, SearchRow b)

Overrides org.h2.mvstore.type.BasicDataType.compare.

Implements org.h2.mvstore.type.DataType.compare.

Doc from org.h2.mvstore.type.DataType.compare.

Compare two keys.

Parameters
a:SearchRow

the first key

b:SearchRow

the second key

Returns:int

-1 if the first key is smaller, 1 if larger, and 0 if equal

Annotations
@Override
compareSearchRowsback to summary
private int compareSearchRows(SearchRow a, SearchRow b)
createStorageback to summary
public SearchRow[] createStorage(int capacity)

Implements org.h2.mvstore.type.DataType.createStorage.

Doc from org.h2.mvstore.type.DataType.createStorage.

Create storage object of array type to hold values

Parameters
capacity:int

number of values to hold

Returns:SearchRow[]

storage object

Annotations
@Override
equalsback to summary
public boolean equals(Object obj)

Overrides org.h2.mvstore.type.BasicDataType.equals.

Implements java.util.Comparator.equals.

Doc from java.util.Comparator.equals.

Indicates whether some other object is "equal to" this comparator. This method must obey the general contract of Object#equals(Object). Additionally, this method can return true only if the specified object is also a comparator and it imposes the same ordering as this comparator. Thus, comp1.equals(comp2) implies that signum(comp1.compare(o1, o2))==signum(comp2.compare(o1, o2)) for every object reference o1 and o2.

Note that it is always safe not to override Object.equals(Object). However, overriding this method may, in some cases, improve performance by allowing programs to determine that two distinct comparators impose the same order.

Parameters
obj:Object

the reference object with which to compare.

Returns:boolean

true only if the specified object is also a comparator and it imposes the same ordering as this comparator.

Annotations
@Override
getColumnCountback to summary
public int getColumnCount()
getFactoryback to summary
public RowDataType.Factory getFactory()

Implements org.h2.mvstore.type.StatefulDataType.getFactory.

Annotations
@Override
getIndexesback to summary
public int[] getIndexes()
getMemoryback to summary
public int getMemory(SearchRow row)

Implements abstract org.h2.mvstore.type.BasicDataType.getMemory.

Implements org.h2.mvstore.type.DataType.getMemory.

Doc from org.h2.mvstore.type.DataType.getMemory.

Calculates the amount of used memory in bytes.

Parameters
row:SearchRow

the object

Returns:int

the used memory

Annotations
@Override
getRowFactoryback to summary
public RowFactory getRowFactory()
hashCodeback to summary
public int hashCode()

Overrides org.h2.mvstore.type.BasicDataType.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object

Annotations
@Override
isStoreKeysback to summary
public boolean isStoreKeys()
readback to summary
public SearchRow read(ByteBuffer buff)

Implements abstract org.h2.mvstore.type.BasicDataType.read.

Implements org.h2.mvstore.type.DataType.read.

Doc from org.h2.mvstore.type.DataType.read.

Read an object.

Parameters
buff:ByteBuffer

the source buffer

Returns:SearchRow

the object

Annotations
@Override
saveback to summary
public void save(WriteBuffer buff, MetaType<Database> metaType)

Implements org.h2.mvstore.type.StatefulDataType.save.

Doc from org.h2.mvstore.type.StatefulDataType.save.

Save the state.

Parameters
buff:WriteBuffer

the target buffer

metaType:MetaType<Database>

the meta type

Annotations
@Override
setRowFactoryback to summary
public void setRowFactory(RowFactory rowFactory)
writeback to summary
public void write(WriteBuffer buff, SearchRow row)

Implements abstract org.h2.mvstore.type.BasicDataType.write.

Implements org.h2.mvstore.type.DataType.write.

Doc from org.h2.mvstore.type.DataType.write.

Write an object.

Parameters
buff:WriteBuffer

the target buffer

row:SearchRow

the value

Annotations
@Override
writeIntArrayback to summary
private static void writeIntArray(WriteBuffer buff, int[] array)
org.h2.mvstore.db back to summary

public final Class RowDataType.Factory

extends Object
implements StatefulDataType.Factory<Database>
Class Inheritance
All Implemented Interfaces
org.h2.mvstore.type.StatefulDataType.Factory

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public RowDataType
create(ByteBuffer
the buffer the source buffer
buff
,
MetaType<Database>
the type
metaDataType
,
Database
the database
database
)

Implements org.h2.mvstore.type.StatefulDataType.Factory.create.

Reads the data type.

private static int[]
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

Factoryback to summary
public Factory()

Method Detail

createback to summary
public RowDataType create(ByteBuffer buff, MetaType<Database> metaDataType, Database database)

Implements org.h2.mvstore.type.StatefulDataType.Factory.create.

Doc from org.h2.mvstore.type.StatefulDataType.Factory.create.

Reads the data type.

Parameters
buff:ByteBuffer

the buffer the source buffer

metaDataType:MetaType<Database>

the type

database:Database

the database

Returns:RowDataType

the data type

Annotations
@Override
readIntArrayback to summary
private static int[] readIntArray(ByteBuffer buff)