public class PfComparatorImpl extends Object implements PfComparator
Guarded.EnsureThat, Guarded.New
Constructor and Description |
---|
PfComparatorImpl() |
Modifier and Type | Method and Description |
---|---|
double |
calculateDissimilarity(byte[] target,
byte[] query)
Compare two descriptors in serialized form.
|
double |
calculateDissimilarity(FloatVectorDescriptor target,
FloatVectorDescriptor query)
Compare two descriptors.
|
double |
calculateSimilarity(byte[] target,
byte[] query)
Compare two descriptors in serialized form.
|
double |
calculateSimilarity(FloatVectorDescriptor target,
FloatVectorDescriptor query)
Compare two descriptors.
|
ComparisonResult |
compare(byte[] target,
byte[] query)
Compare two descriptors in serialized form.
|
ComparisonResult |
compare(FloatVectorDescriptor target,
FloatVectorDescriptor query)
Compare two descriptors.
|
Object |
getGuardObject()
Gets the guard object associated to the generated descriptors/utilities.
|
Optional<Double> |
getLowerBound()
Get lower bound for the similarity/dissimilarity values if such one can be determined.
|
MetricMetadata |
getMetricMetadata()
Metadata about this metric.
|
Optional<Double> |
getUpperBound()
Get upper bound for the similarity/dissimilarity values if such one can be determined.
|
UnguardedContext<FloatVectorDescriptor,?> |
unguardedContext()
Associated unguarded context.
|
public ComparisonResult compare(FloatVectorDescriptor target, FloatVectorDescriptor query)
DescriptorComparator
Please note that some implementation might return a result object containing additional data related to the compariosn results.
compare
in interface DescriptorComparator<FloatVectorDescriptor>
target
- Target descriptorquery
- Query descriptorpublic ComparisonResult compare(byte[] target, byte[] query)
DescriptorComparator
Please note that some implementation might return a result object containing additional data related to the
compariosn results. This method's functionality is equivalent to comparing
(with DescriptorComparator.compare(com.chemaxon.descriptors.common.Descriptor, com.chemaxon.descriptors.common.Descriptor)
)
deserialized
(by DescriptorSerializer.fromByteArray(byte[])
) descriptors.
compare
in interface DescriptorComparator<FloatVectorDescriptor>
target
- Target descriptor in its serialized formquery
- Query descriptor in its serialized formpublic double calculateSimilarity(FloatVectorDescriptor target, FloatVectorDescriptor query)
DescriptorComparator
Please note that this convenience method wraps ComparisonResult.getSimilarity()
of comparison result
constructed by
DescriptorComparator.compare(com.chemaxon.descriptors.common.Descriptor, com.chemaxon.descriptors.common.Descriptor)
calculateSimilarity
in interface DescriptorComparator<FloatVectorDescriptor>
target
- Target descriptorquery
- Query descriptorpublic double calculateDissimilarity(FloatVectorDescriptor target, FloatVectorDescriptor query)
DescriptorComparator
Please note that this convenience method wraps ComparisonResult.getDissimilarity()
of comparison
result constructed by
DescriptorComparator.compare(com.chemaxon.descriptors.common.Descriptor, com.chemaxon.descriptors.common.Descriptor)
calculateDissimilarity
in interface DescriptorComparator<FloatVectorDescriptor>
target
- Target descriptorquery
- Query descriptorpublic double calculateSimilarity(byte[] target, byte[] query)
DescriptorComparator
calculateSimilarity
in interface DescriptorComparator<FloatVectorDescriptor>
target
- Target descriptor in its serialized formquery
- Query descriptor in its serialized formpublic double calculateDissimilarity(byte[] target, byte[] query)
DescriptorComparator
calculateDissimilarity
in interface DescriptorComparator<FloatVectorDescriptor>
target
- Target descriptor in its serialized formquery
- Query descriptor in its serialized formpublic Optional<Double> getLowerBound()
DescriptorComparator
getLowerBound
in interface DescriptorComparator<FloatVectorDescriptor>
public Optional<Double> getUpperBound()
DescriptorComparator
getUpperBound
in interface DescriptorComparator<FloatVectorDescriptor>
public MetricMetadata getMetricMetadata()
DescriptorComparator
It is guaranteed that the actual instance returned can be used as a parameter of the appropriate comparator
getter method of the associated DescriptorGenerator
getMetricMetadata
in interface DescriptorComparator<FloatVectorDescriptor>
public UnguardedContext<FloatVectorDescriptor,?> unguardedContext()
DescriptorComparator
unguardedContext
in interface DescriptorComparator<FloatVectorDescriptor>
public Object getGuardObject()
Guarded
This method is intended to use only for ensuring the compatibility of manipulated objects.
Implementations might use the associated DescriptorGenerator
or DescriptorParameters
reference as
the guard object, however it is a non recommended practice to use this method to access the associated generator
to perform further operations on it.
getGuardObject
in interface Guarded
null
.