Interface DoubleDataLayout<S extends DataBuffer<?>>

Type Parameters:
S - type of buffer this layout can be applied to
All Superinterfaces:
DataLayout<S,Double>

public interface DoubleDataLayout<S extends DataBuffer<?>> extends DataLayout<S,Double>
A DataLayout that converts data stored in a buffer to doubles.
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    applyTo(S buffer)
    Apply this layout to the provided buffer.
    double
    readDouble(S buffer, long index)
    Reads n = scale() buffer values at the given index and return them as a double.
    default Double
    readObject(S buffer, long index)
    Reads n = scale() values from the buffer at the given index and return them as a single value in the user type.
    void
    writeDouble(S buffer, double value, long index)
    Writes a double into the buffer at the given index after converting it to the buffer type.
    default void
    writeObject(S buffer, Double value, long index)
    Writes a user value into the buffer at the given index after converting it to the buffer type.

    Methods inherited from interface DataLayout

    scale
  • Method Details

    • applyTo

      default DoubleDataBuffer applyTo(S buffer)
      Description copied from interface: DataLayout
      Apply this layout to the provided buffer.

      The returned DataBuffer instance is simply a wrapper to the original buffer and does not have a backing storage of his own.

      Specified by:
      applyTo in interface DataLayout<S extends DataBuffer<?>, Double>
      Parameters:
      buffer - the target buffer to apply this layout to
      Returns:
      a buffer with this layout
    • writeDouble

      void writeDouble(S buffer, double value, long index)
      Writes a double into the buffer at the given index after converting it to the buffer type.
      Parameters:
      buffer - the buffer to write to
      value - the double to convert and write
      index - index in the buffer where the converted value should be written
      See Also:
    • readDouble

      double readDouble(S buffer, long index)
      Reads n = scale() buffer values at the given index and return them as a double.
      Parameters:
      buffer - the buffer to read from
      index - position of the buffer to read in the buffer
      Returns:
      the double value
      See Also:
    • writeObject

      default void writeObject(S buffer, Double value, long index)
      Description copied from interface: DataLayout
      Writes a user value into the buffer at the given index after converting it to the buffer type.

      It is the responsibility of the implementors of this interface to write the converted value to the given buffer before this call returns, using the most appropriate method. For example, for a layout converting a BigInteger to a single long,

      @Override
      public void writeObject(LongDataBuffer buffer, BigInteger value, long index) {
        buffer.setLong(value.longValue(), index);
      }
      
      If a single user value scales over more than one buffer values, index indicates the starting position of the sequence to be written to the buffer.
      Specified by:
      writeObject in interface DataLayout<S extends DataBuffer<?>, Double>
      Parameters:
      buffer - the buffer to write to
      value - the value in the user type to convert and write
      index - index in the buffer where the converted value should be written
    • readObject

      default Double readObject(S buffer, long index)
      Description copied from interface: DataLayout
      Reads n = scale() values from the buffer at the given index and return them as a single value in the user type.

      It is the responsibility of the implementors of this interface to read the value to be converted from the given buffer, using the most appropriate method. For example, for a layout that converting a single long to a BigInteger,

      @Override
      public BigInteger readObject(LongDataBuffer buffer, long index) {
        return BigInteger.valueOf(buffer.getLong(index));
      }
      
      If a single user value scales over more than one buffer values, index indicates the starting position of the sequence to be read from the buffer.
      Specified by:
      readObject in interface DataLayout<S extends DataBuffer<?>, Double>
      Parameters:
      buffer - the buffer to read from
      index - position of the buffer to read in the buffer
      Returns:
      the converted value