Class NodeReferenceWithVector
- Direct Known Subclasses:
NodeReferenceWithDistance
This class extends NodeReference by adding a RealVector field. It encapsulates both the primary key
of a node and its corresponding vector data, which is particularly useful in vector-based search and
indexing scenarios. Primarily, node references are used to refer to Nodes in a storage-independent way, i.e.
a node reference always contains the vector of a node while the node itself (depending on the storage adapter)
may not.
-
Constructor Summary
ConstructorsConstructorDescriptionNodeReferenceWithVector(Tuple primaryKey, Transformed<RealVector> vector) Constructs a newNodeReferenceWithVectorwith a specified primary key and vector. -
Method Summary
Modifier and TypeMethodDescriptionReturns this instance cast as aNodeReferenceWithVector.booleanCompares thisNodeReferenceWithVectorto the specified object for equality.Gets the vector ofHalfobjects.inthashCode()Computes the hash code for this object.toString()Returns a string representation of this object.Methods inherited from class com.apple.foundationdb.async.hnsw.NodeReference
getPrimaryKey, primaryKeys
-
Constructor Details
-
NodeReferenceWithVector
Constructs a newNodeReferenceWithVectorwith a specified primary key and vector.The primary key is used to initialize the parent class via a call to
super(), while the vector is stored as a field in this instance. Both parameters are expected to be non-null.- Parameters:
primaryKey- the primary key of the node, must not be nullvector- the vector associated with the node, must not be null
-
-
Method Details
-
getVector
Gets the vector ofHalfobjects.This method provides access to the internal vector. The returned vector is guaranteed not to be null, as indicated by the
@Nonnullannotation.- Returns:
- the vector of
Halfobjects; will never benull.
-
asNodeReferenceWithVector
Returns this instance cast as aNodeReferenceWithVector.- Overrides:
asNodeReferenceWithVectorin classNodeReference- Returns:
- this instance as a
NodeReferenceWithVector, which is nevernull.
-
equals
Compares thisNodeReferenceWithVectorto the specified object for equality.- Overrides:
equalsin classNodeReference- Parameters:
o- the object to compare with thisNodeReferenceWithVector.- Returns:
trueif the objects are equal;falseotherwise.
-
hashCode
public int hashCode()Computes the hash code for this object.- Overrides:
hashCodein classNodeReference- Returns:
- a hash code value for this object.
-
toString
Returns a string representation of this object.- Overrides:
toStringin classNodeReference- Returns:
- a concise string representation of this object.
-