Class NodeReferenceWithDistance


public class NodeReferenceWithDistance extends NodeReferenceWithVector
Represents a reference to a node that includes its vector and its distance from a query vector.

This class extends NodeReferenceWithVector by additionally associating a distance value, typically the result of a distance calculation in a nearest neighbor search. Objects of this class are immutable.

  • Constructor Details

    • NodeReferenceWithDistance

      public NodeReferenceWithDistance(@Nonnull Tuple primaryKey, @Nonnull Transformed<RealVector> vector, double distance)
      Constructs a new instance of NodeReferenceWithDistance.

      This constructor initializes the reference with the node's primary key, its vector, and the calculated distance from some origin vector (e.g., a query vector). It calls the superclass constructor to set the primaryKey and vector.

      Parameters:
      primaryKey - the primary key of the referenced node, represented as a Tuple. Must not be null.
      vector - the vector associated with the referenced node. Must not be null.
      distance - the calculated distance of this node reference to some query vector or similar.
  • Method Details

    • getDistance

      public double getDistance()
      Gets the distance.
      Returns:
      the current distance value
    • equals

      public boolean equals(Object o)
      Compares this object against the specified object for equality.

      The result is true if and only if the argument is not null, is a NodeReferenceWithDistance object, has the same properties as determined by the superclass's equals(Object) method, and has the same distance value.

      Overrides:
      equals in class NodeReferenceWithVector
      Parameters:
      o - the object to compare with this instance for equality.
      Returns:
      true if the specified object is equal to this NodeReferenceWithDistance; false otherwise.
    • hashCode

      public int hashCode()
      Generates a hash code for this object.
      Overrides:
      hashCode in class NodeReferenceWithVector
      Returns:
      a hash code value for this object.