Top Description Methods
org.h2.mvstore.type

public Interface DataType<T>

extends Comparator<T>
Known Direct Implementers
org.h2.mvstore.db.NullValueDataType, org.h2.mvstore.type.BasicDataType
Imports
java.nio.ByteBuffer, java.util.Comparator, org.h2.mvstore.WriteBuffer

A data type.

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

index of the key , if found, - index of the insertion point, if not
binarySearch
(T
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
)

Perform binary search for the key within the storage

public int

Returns:

-1 if the first key is smaller, 1 if larger, and 0 if equal
compare
(T
the first key
a
,
T
the second key
b
)

Redeclares java.util.Comparator.compare.

Compare two keys.

public T[]

Returns:

storage object
createStorage
(int
number of values to hold
size
)

Create storage object of array type to hold values

public int

Returns:

the used memory
getMemory
(T
the object
obj
)

Calculates the amount of used memory in bytes.

public boolean

Returns:

true if memory estimation is allowed
isMemoryEstimationAllowed
()

Whether memory estimation based on previously seen values is allowed/desirable

public T

Returns:

the object
read
(ByteBuffer
the source buffer
buff
)

Read an object.

public void
read(ByteBuffer
the target buffer
buff
,
Object
the objects
storage
,
int
the number of objects to read
len
)

Read a list of objects.

public void
write(WriteBuffer
the target buffer
buff
,
T
the value
obj
)

Write an object.

public void
write(WriteBuffer
the target buffer
buff
,
Object
the objects
storage
,
int
the number of objects to write
len
)

Write a list of objects.

Inherited from java.util.Comparator:
comparingcomparingcomparingDoublecomparingIntcomparingLongequalsnaturalOrdernullsFirstnullsLastreversedreverseOrderthenComparingthenComparingthenComparingthenComparingDoublethenComparingIntthenComparingLong

Method Detail

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

Perform binary search for the key within the storage

Parameters
key:T

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

compareback to summary
public int compare(T a, T b)

Redeclares java.util.Comparator.compare.

Compare two keys.

Parameters
a:T

the first key

b:T

the second key

Returns:int

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

Annotations
@Override
Exceptions
UnsupportedOperationException:
if the type is not orderable
createStorageback to summary
public T[] createStorage(int size)

Create storage object of array type to hold values

Parameters
size:int

number of values to hold

Returns:T[]

storage object

getMemoryback to summary
public int getMemory(T obj)

Calculates the amount of used memory in bytes.

Parameters
obj:T

the object

Returns:int

the used memory

isMemoryEstimationAllowedback to summary
public boolean isMemoryEstimationAllowed()

Whether memory estimation based on previously seen values is allowed/desirable

Returns:boolean

true if memory estimation is allowed

readback to summary
public T read(ByteBuffer buff)

Read an object.

Parameters
buff:ByteBuffer

the source buffer

Returns:T

the object

readback to summary
public void read(ByteBuffer buff, Object storage, int len)

Read a list of objects.

Parameters
buff:ByteBuffer

the target buffer

storage:Object

the objects

len:int

the number of objects to read

writeback to summary
public void write(WriteBuffer buff, T obj)

Write an object.

Parameters
buff:WriteBuffer

the target buffer

obj:T

the value

writeback to summary
public void write(WriteBuffer buff, Object storage, int len)

Write a list of objects.

Parameters
buff:WriteBuffer

the target buffer

storage:Object

the objects

len:int

the number of objects to write