Package org.h2.mvstore.tx
Class VersionedValueType<T,D>
- All Implemented Interfaces:
Comparator<VersionedValue<T>>
,DataType<VersionedValue<T>>
,StatefulDataType<D>
public class VersionedValueType<T,D>
extends BasicDataType<VersionedValue<T>>
implements StatefulDataType<D>
The value type for a versioned value.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
compare
(VersionedValue<T> a, VersionedValue<T> b) Compare two keys.VersionedValue<T>[]
createStorage
(int size) Create storage object of array type to hold valuesboolean
int
getMemory
(VersionedValue<T> v) Calculates the amount of used memory in bytes.private int
getValMemory
(T obj) int
hashCode()
read
(ByteBuffer buff) Read an object.void
read
(ByteBuffer buff, Object storage, int len) Read a list of objects.void
save
(WriteBuffer buff, MetaType<D> metaType) Save the state.void
write
(WriteBuffer buff, Object storage, int len) Write a list of objects.void
write
(WriteBuffer buff, VersionedValue<T> v) Write an object.Methods inherited from class org.h2.mvstore.type.BasicDataType
binarySearch, cast, isMemoryEstimationAllowed
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
-
Field Details
-
valueType
-
factory
-
-
Constructor Details
-
VersionedValueType
-
-
Method Details
-
createStorage
Description copied from interface:DataType
Create storage object of array type to hold values- Specified by:
createStorage
in interfaceDataType<T>
- Parameters:
size
- number of values to hold- Returns:
- storage object
-
getMemory
Description copied from interface:DataType
Calculates the amount of used memory in bytes.- Specified by:
getMemory
in interfaceDataType<T>
- Specified by:
getMemory
in classBasicDataType<VersionedValue<T>>
- Parameters:
v
- the object- Returns:
- the used memory
-
getValMemory
-
read
Description copied from interface:DataType
Read a list of objects.- Specified by:
read
in interfaceDataType<T>
- Overrides:
read
in classBasicDataType<VersionedValue<T>>
- Parameters:
buff
- the target bufferstorage
- the objectslen
- the number of objects to read
-
read
Description copied from interface:DataType
Read an object.- Specified by:
read
in interfaceDataType<T>
- Specified by:
read
in classBasicDataType<VersionedValue<T>>
- Parameters:
buff
- the source buffer- Returns:
- the object
-
write
Description copied from interface:DataType
Write a list of objects.- Specified by:
write
in interfaceDataType<T>
- Overrides:
write
in classBasicDataType<VersionedValue<T>>
- Parameters:
buff
- the target bufferstorage
- the objectslen
- the number of objects to write
-
write
Description copied from interface:DataType
Write an object.- Specified by:
write
in interfaceDataType<T>
- Specified by:
write
in classBasicDataType<VersionedValue<T>>
- Parameters:
buff
- the target bufferv
- the value
-
equals
- Specified by:
equals
in interfaceComparator<T>
- Overrides:
equals
in classBasicDataType<VersionedValue<T>>
-
hashCode
public int hashCode()- Overrides:
hashCode
in classBasicDataType<VersionedValue<T>>
-
save
Description copied from interface:StatefulDataType
Save the state.- Specified by:
save
in interfaceStatefulDataType<T>
- Parameters:
buff
- the target buffermetaType
- the meta type
-
compare
Description copied from interface:DataType
Compare two keys.- Specified by:
compare
in interfaceComparator<T>
- Specified by:
compare
in interfaceDataType<T>
- Overrides:
compare
in classBasicDataType<VersionedValue<T>>
- Parameters:
a
- the first keyb
- the second key- Returns:
- -1 if the first key is smaller, 1 if larger, and 0 if equal
-
getFactory
- Specified by:
getFactory
in interfaceStatefulDataType<T>
-