Class BaseQueryResult<K,V>

java.lang.Object
com.tangosol.io.AbstractEvolvable
com.oracle.coherence.ai.search.BaseQueryResult<K,V>
Type Parameters:
K - the type of the keys used to identify vectors
V - the type of the vector
All Implemented Interfaces:
QueryResult<K,V>, Evolvable, ExternalizableLite, EvolvablePortableObject, PortableObject, Serializable
Direct Known Subclasses:
BinaryQueryResult, SimpleQueryResult

public abstract class BaseQueryResult<K,V> extends AbstractEvolvable implements QueryResult<K,V>, ExternalizableLite, EvolvablePortableObject
A base class for QueryResult implementations.
See Also:
  • Field Details

    • m_distance

      protected double m_distance
      The result of the query.
    • m_key

      protected K m_key
      The optional key of the vector the result applies to.
    • m_value

      protected V m_value
      The optional vector the result applies to.
  • Constructor Details

    • BaseQueryResult

      protected BaseQueryResult()
      Default constructor for serialization.
    • BaseQueryResult

      protected BaseQueryResult(double result, K key, V value)
      Create a BaseQueryResult.
      Parameters:
      result - the query result
      key - the optional key of the vector the result applies to
      value - the optional result value
  • Method Details

    • getDistance

      public double getDistance()
      Description copied from interface: QueryResult
      The result value obtained by executing the query on the vector.
      Specified by:
      getDistance in interface QueryResult<K,V>
      Returns:
      the result value obtained by executing the query on the vector
    • getKey

      public K getKey()
      Description copied from interface: QueryResult
      Returns the key for the entry this result matches.
      Specified by:
      getKey in interface QueryResult<K,V>
      Returns:
      the key for the entry this result matches
    • getValue

      public V getValue()
      Description copied from interface: QueryResult
      Returns the value for the entry this result matches.
      Specified by:
      getValue in interface QueryResult<K,V>
      Returns:
      the value for the entry this result matches
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getImplVersion

      public int getImplVersion()
      Description copied from class: AbstractEvolvable
      Determine the serialization version supported by the implementing class.
      Specified by:
      getImplVersion in interface Evolvable
      Specified by:
      getImplVersion in class AbstractEvolvable
      Returns:
      the serialization version supported by this object
    • readExternal

      public void readExternal(PofReader in) throws IOException
      Description copied from interface: PortableObject
      Restore the contents of a user type instance by reading its state using the specified PofReader object.
      Specified by:
      readExternal in interface PortableObject
      Parameters:
      in - the PofReader from which to read the object's state
      Throws:
      IOException - if an I/O error occurs
    • writeExternal

      public void writeExternal(PofWriter out) throws IOException
      Description copied from interface: PortableObject
      Save the contents of a POF user type instance by writing its state using the specified PofWriter object.
      Specified by:
      writeExternal in interface PortableObject
      Parameters:
      out - the PofWriter to which to write the object's state
      Throws:
      IOException - if an I/O error occurs
    • readExternal

      public void readExternal(DataInput in) throws IOException
      Description copied from interface: ExternalizableLite
      Restore the contents of this object by loading the object's state from the passed DataInput object.
      Specified by:
      readExternal in interface ExternalizableLite
      Parameters:
      in - the DataInput stream to read data from in order to restore the state of this object
      Throws:
      IOException - if an I/O exception occurs
    • writeExternal

      public void writeExternal(DataOutput out) throws IOException
      Description copied from interface: ExternalizableLite
      Save the contents of this object by storing the object's state into the passed DataOutput object.
      Specified by:
      writeExternal in interface ExternalizableLite
      Parameters:
      out - the DataOutput stream to write the state of this object to
      Throws:
      IOException - if an I/O exception occurs