Top Description Fields Constructors Methods
org.h2.mvstore.type

public Class LongDataType

extends BasicDataType<Long>
Class Inheritance
Imports
java.nio.ByteBuffer, org.h2.mvstore.DataUtils, .WriteBuffer

Class LongDataType.
Author
Andrei Tokar

Field Summary

Modifier and TypeField and Description
private static final Long[]
public static final LongDataType

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public int
binarySearch(Long
to search for
keyObj
,
Object
to search within (an array of type T)
storageObj
,
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

private static int
binarySearch(long key, Long[] storage, int low, int high, int x)

public int
compare(Long
the first key
one
,
Long
the second key
two
)

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

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

Compare two keys.

public Long[]
createStorage(int
number of values to hold
size
)

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

Create storage object of array type to hold values

public int
getMemory(Long
the object
obj
)

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

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

Calculates the amount of used memory in bytes.

public Long
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
write(WriteBuffer
the target buffer
buff
,
Long
the value
data
)

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

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

Write an object.

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

Field Detail

EMPTY_LONG_ARRback to summary
private static final Long[] EMPTY_LONG_ARR
INSTANCEback to summary
public static final LongDataType INSTANCE

Constructor Detail

LongDataTypeback to summary
private LongDataType()

Method Detail

binarySearchback to summary
public int binarySearch(Long keyObj, Object storageObj, 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
keyObj:Long

to search for

storageObj: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
private static int binarySearch(long key, Long[] storage, int low, int high, int x)
compareback to summary
public int compare(Long one, Long two)

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
one:Long

the first key

two:Long

the second key

Returns:int

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

Annotations
@Override
createStorageback to summary
public Long[] createStorage(int size)

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
size:int

number of values to hold

Returns:Long[]

storage object

Annotations
@Override
getMemoryback to summary
public int getMemory(Long obj)

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
obj:Long

the object

Returns:int

the used memory

Annotations
@Override
readback to summary
public Long 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:Long

the object

Annotations
@Override
writeback to summary
public void write(WriteBuffer buff, Long data)

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

data:Long

the value

Annotations
@Override