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

public Class VersionedValueType<T, D>

extends BasicDataType<VersionedValue<T>>
implements StatefulDataType<D>
Class Inheritance
All Implemented Interfaces
org.h2.mvstore.type.StatefulDataType
Imports
java.nio.ByteBuffer, org.h2.engine.Constants, org.h2.mvstore.DataUtils, .WriteBuffer, org.h2.mvstore.type.BasicDataType, .DataType, .MetaType, .StatefulDataType, org.h2.value.VersionedValue

The value type for a versioned value.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class

Field Summary

Modifier and TypeField and Description
private final VersionedValueType.Factory<D>
private final DataType<T>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public int
compare(VersionedValue<T>
the first key
a
,
VersionedValue<T>
the second key
b
)

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

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

Compare two keys.

public VersionedValue<T>[]
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 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 VersionedValueType.Factory<D>
public int
getMemory(VersionedValue<T>
the object
v
)

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

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

Calculates the amount of used memory in bytes.

private int
getValMemory(T obj)

public int
hashCode()

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

Returns a hash code value for this object.

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

Overrides org.h2.mvstore.type.BasicDataType.read.

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

Read a list of objects.

public VersionedValue<T>
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<D>
the meta type
metaType
)

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

Save the state.

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

Overrides org.h2.mvstore.type.BasicDataType.write.

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

Write a list of objects.

public void
write(WriteBuffer
the target buffer
buff
,
VersionedValue<T>
the value
v
)

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:
binarySearchcastisMemoryEstimationAllowed

Field Detail

factoryback to summary
private final VersionedValueType.Factory<D> factory
valueTypeback to summary
private final DataType<T> valueType

Constructor Detail

VersionedValueTypeback to summary
public VersionedValueType(DataType<T> valueType)

Method Detail

compareback to summary
public int compare(VersionedValue<T> a, VersionedValue<T> 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:VersionedValue<T>

the first key

b:VersionedValue<T>

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 VersionedValue<T>[] 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:VersionedValue<T>[]

storage object

Annotations
@Override
@SuppressWarnings:unchecked
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
@SuppressWarnings:unchecked
getFactoryback to summary
public VersionedValueType.Factory<D> getFactory()

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

Annotations
@Override
getMemoryback to summary
public int getMemory(VersionedValue<T> v)

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
v:VersionedValue<T>

the object

Returns:int

the used memory

Annotations
@Override
getValMemoryback to summary
private int getValMemory(T obj)
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
readback to summary
public void read(ByteBuffer buff, Object storage, int len)

Overrides org.h2.mvstore.type.BasicDataType.read.

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

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

Read a list of objects.

Parameters
buff:ByteBuffer

the target buffer

storage:Object

the objects

len:int

the number of objects to read

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

the object

Annotations
@Override
saveback to summary
public void save(WriteBuffer buff, MetaType<D> 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<D>

the meta type

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

Overrides org.h2.mvstore.type.BasicDataType.write.

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

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

Write a list of objects.

Parameters
buff:WriteBuffer

the target buffer

storage:Object

the objects

len:int

the number of objects to write

Annotations
@Override
writeback to summary
public void write(WriteBuffer buff, VersionedValue<T> v)

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

v:VersionedValue<T>

the value

Annotations
@Override
org.h2.mvstore.tx back to summary

public final Class VersionedValueType.Factory<D>

extends Object
implements StatefulDataType.Factory<D>
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 DataType<?>
create(ByteBuffer
the buffer the source buffer
buff
,
MetaType<D>
the type
metaType
,
D
the database
database
)

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

Reads the data type.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

Factoryback to summary
public Factory()

Method Detail

createback to summary
public DataType<?> create(ByteBuffer buff, MetaType<D> metaType, D 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

metaType:MetaType<D>

the type

database:D

the database

Returns:DataType<?>

the data type

Annotations
@SuppressWarnings:unchecked
@Override