Class VersionedValueType<T,D>

java.lang.Object
org.h2.mvstore.type.BasicDataType<org.h2.value.VersionedValue<T>>
org.h2.mvstore.tx.VersionedValueType<T,D>
All Implemented Interfaces:
Comparator<org.h2.value.VersionedValue<T>>, DataType<org.h2.value.VersionedValue<T>>, StatefulDataType<D>

public class VersionedValueType<T,D> extends BasicDataType<org.h2.value.VersionedValue<T>> implements StatefulDataType<D>
The value type for a versioned value.
  • Constructor Details

    • VersionedValueType

      public VersionedValueType(DataType<T> valueType)
  • Method Details

    • createStorage

      public org.h2.value.VersionedValue<T>[] createStorage(int size)
      Description copied from interface: DataType
      Create storage object of array type to hold values
      Specified by:
      createStorage in interface DataType<T>
      Parameters:
      size - number of values to hold
      Returns:
      storage object
    • getMemory

      public int getMemory(org.h2.value.VersionedValue<T> v)
      Description copied from interface: DataType
      Calculates the amount of used memory in bytes.
      Specified by:
      getMemory in interface DataType<T>
      Specified by:
      getMemory in class BasicDataType<org.h2.value.VersionedValue<T>>
      Parameters:
      v - the object
      Returns:
      the used memory
    • read

      public void read(ByteBuffer buff, Object storage, int len)
      Description copied from interface: DataType
      Read a list of objects.
      Specified by:
      read in interface DataType<T>
      Overrides:
      read in class BasicDataType<org.h2.value.VersionedValue<T>>
      Parameters:
      buff - the target buffer
      storage - the objects
      len - the number of objects to read
    • read

      public org.h2.value.VersionedValue<T> read(ByteBuffer buff)
      Description copied from interface: DataType
      Read an object.
      Specified by:
      read in interface DataType<T>
      Specified by:
      read in class BasicDataType<org.h2.value.VersionedValue<T>>
      Parameters:
      buff - the source buffer
      Returns:
      the object
    • write

      public void write(WriteBuffer buff, Object storage, int len)
      Description copied from interface: DataType
      Write a list of objects.
      Specified by:
      write in interface DataType<T>
      Overrides:
      write in class BasicDataType<org.h2.value.VersionedValue<T>>
      Parameters:
      buff - the target buffer
      storage - the objects
      len - the number of objects to write
    • write

      public void write(WriteBuffer buff, org.h2.value.VersionedValue<T> v)
      Description copied from interface: DataType
      Write an object.
      Specified by:
      write in interface DataType<T>
      Specified by:
      write in class BasicDataType<org.h2.value.VersionedValue<T>>
      Parameters:
      buff - the target buffer
      v - the value
    • equals

      public boolean equals(Object obj)
      Specified by:
      equals in interface Comparator<T>
      Overrides:
      equals in class BasicDataType<org.h2.value.VersionedValue<T>>
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class BasicDataType<org.h2.value.VersionedValue<T>>
    • save

      public void save(WriteBuffer buff, MetaType<D> metaType)
      Description copied from interface: StatefulDataType
      Save the state.
      Specified by:
      save in interface StatefulDataType<T>
      Parameters:
      buff - the target buffer
      metaType - the meta type
    • compare

      public int compare(org.h2.value.VersionedValue<T> a, org.h2.value.VersionedValue<T> b)
      Description copied from interface: DataType
      Compare two keys.
      Specified by:
      compare in interface Comparator<T>
      Specified by:
      compare in interface DataType<T>
      Overrides:
      compare in class BasicDataType<org.h2.value.VersionedValue<T>>
      Parameters:
      a - the first key
      b - the second key
      Returns:
      -1 if the first key is smaller, 1 if larger, and 0 if equal
    • getFactory

      public VersionedValueType.Factory<D> getFactory()
      Specified by:
      getFactory in interface StatefulDataType<T>