Package com.oracle.coherence.ai.search
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 vectorsV
- 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 Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Default constructor for serialization.protected
BaseQueryResult
(double result, K key, V value) Create aBaseQueryResult
. -
Method Summary
Modifier and TypeMethodDescriptionboolean
double
The result value obtained by executing the query on the vector.int
Determine the serialization version supported by the implementing class.getKey()
Returns the key for the entry this result matches.getValue()
Returns the value for the entry this result matches.int
hashCode()
void
Restore the contents of a user type instance by reading its state using the specified PofReader object.void
Restore the contents of this object by loading the object's state from the passed DataInput object.toString()
void
writeExternal
(PofWriter out) Save the contents of a POF user type instance by writing its state using the specified PofWriter object.void
writeExternal
(DataOutput out) Save the contents of this object by storing the object's state into the passed DataOutput object.Methods inherited from class com.tangosol.io.AbstractEvolvable
getDataVersion, getFutureData, setDataVersion, setFutureData
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.tangosol.io.Evolvable
getDataVersion, getFutureData, setDataVersion, setFutureData
-
Field Details
-
m_distance
protected double m_distanceThe result of the query. -
m_key
The optional key of the vector the result applies to. -
m_value
The optional vector the result applies to.
-
-
Constructor Details
-
BaseQueryResult
protected BaseQueryResult()Default constructor for serialization. -
BaseQueryResult
Create aBaseQueryResult
.- Parameters:
result
- the query resultkey
- the optional key of the vector the result applies tovalue
- 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 interfaceQueryResult<K,
V> - Returns:
- the result value obtained by executing the query on the vector
-
getKey
Description copied from interface:QueryResult
Returns the key for the entry this result matches.- Specified by:
getKey
in interfaceQueryResult<K,
V> - Returns:
- the key for the entry this result matches
-
getValue
Description copied from interface:QueryResult
Returns the value for the entry this result matches.- Specified by:
getValue
in interfaceQueryResult<K,
V> - Returns:
- the value for the entry this result matches
-
equals
-
hashCode
public int hashCode() -
toString
-
getImplVersion
public int getImplVersion()Description copied from class:AbstractEvolvable
Determine the serialization version supported by the implementing class.- Specified by:
getImplVersion
in interfaceEvolvable
- Specified by:
getImplVersion
in classAbstractEvolvable
- Returns:
- the serialization version supported by this object
-
readExternal
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 interfacePortableObject
- Parameters:
in
- the PofReader from which to read the object's state- Throws:
IOException
- if an I/O error occurs
-
writeExternal
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 interfacePortableObject
- Parameters:
out
- the PofWriter to which to write the object's state- Throws:
IOException
- if an I/O error occurs
-
readExternal
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 interfaceExternalizableLite
- 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
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 interfaceExternalizableLite
- Parameters:
out
- the DataOutput stream to write the state of this object to- Throws:
IOException
- if an I/O exception occurs
-