Record Class DoubleVector

java.lang.Object
java.lang.Record
io.micronaut.data.model.vector.DoubleVector
Record Components:
data - the backing double values array (a defensive copy is returned by accessors)
All Implemented Interfaces:
Vector

@TypeDef(type=OBJECT, converter=DoubleVectorAttributeConverter.class) public record DoubleVector(double[] data) extends Record implements Vector
Double-backed immutable vector. Split from Vector.java into a dedicated package.
Since:
5.0.0
Author:
Nemanja Mikic
  • Constructor Details

    • DoubleVector

      public DoubleVector(double[] data)
      Creates a double vector.
      Parameters:
      data - the backing values
  • Method Details

    • data

      public double[] data()
      Returns the value of the data record component.
      Returns:
      the value of the data record component
    • getType

      public @NonNull Class<? extends Number> getType()
      Return the primitive number type the vector is backed by.
      Specified by:
      getType in interface Vector
      Returns:
      the primitive number type (Byte.TYPE, Float.TYPE or Double.TYPE)
    • toFloatArray

      public float[] toFloatArray()
      Convert this vector to a new float array copy.
      Specified by:
      toFloatArray in interface Vector
      Returns:
      a new float[] with the vector content
    • toDoubleArray

      public double[] toDoubleArray()
      Convert this vector to a new double array copy.
      Specified by:
      toDoubleArray in interface Vector
      Returns:
      a new double[] with the vector content
    • toByteArray

      public byte[] toByteArray()
      Convert this vector to a new byte array copy.
      Specified by:
      toByteArray in interface Vector
      Returns:
      a new byte[] with the vector content
    • toString

      public @NonNull String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public boolean equals(Object obj)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      obj - the object with which to compare
      Returns:
      true if this object is the same as the obj argument; false otherwise.