Class IntegerDataType

java.lang.Object
org.h2.mvstore.type.BasicDataType<Integer>
org.h2.mvstore.type.IntegerDataType
All Implemented Interfaces:
Comparator<Integer>, DataType<Integer>

public class IntegerDataType extends BasicDataType<Integer>
Class IntegerDataType.
  • 4/10/24 1:18 PM initial creation
  • Field Details

  • Method Details

    • getMemory

      public int getMemory(Integer obj)
      Description copied from interface: DataType
      Calculates the amount of used memory in bytes.
      Specified by:
      getMemory in interface DataType<Integer>
      Specified by:
      getMemory in class BasicDataType<Integer>
      Parameters:
      obj - the object
      Returns:
      the used memory
    • write

      public void write(WriteBuffer buff, Integer data)
      Description copied from interface: DataType
      Write an object.
      Specified by:
      write in interface DataType<Integer>
      Specified by:
      write in class BasicDataType<Integer>
      Parameters:
      buff - the target buffer
      data - the value
    • read

      public Integer read(ByteBuffer buff)
      Description copied from interface: DataType
      Read an object.
      Specified by:
      read in interface DataType<Integer>
      Specified by:
      read in class BasicDataType<Integer>
      Parameters:
      buff - the source buffer
      Returns:
      the object
    • createStorage

      public Integer[] createStorage(int size)
      Description copied from interface: DataType
      Create storage object of array type to hold values
      Parameters:
      size - number of values to hold
      Returns:
      storage object
    • compare

      public int compare(Integer one, Integer two)
      Description copied from interface: DataType
      Compare two keys.
      Specified by:
      compare in interface Comparator<Integer>
      Specified by:
      compare in interface DataType<Integer>
      Overrides:
      compare in class BasicDataType<Integer>
      Parameters:
      one - the first key
      two - the second key
      Returns:
      -1 if the first key is smaller, 1 if larger, and 0 if equal
    • binarySearch

      public int binarySearch(Integer keyObj, Object storageObj, int size, int initialGuess)
      Description copied from interface: DataType
      Perform binary search for the key within the storage
      Specified by:
      binarySearch in interface DataType<Integer>
      Overrides:
      binarySearch in class BasicDataType<Integer>
      Parameters:
      keyObj - to search for
      storageObj - to search within (an array of type T)
      size - number of data items in the storage
      initialGuess - for key position
      Returns:
      index of the key , if found, - index of the insertion point, if not