T
- @Beta @PublicAPI public abstract class AbstractShapeComparator<T extends ShapeDescriptor> extends Object implements ShapeComparator<T>
Guarded.EnsureThat, Guarded.New
Constructor and Description |
---|
AbstractShapeComparator(DescriptorGenerator<T> generator) |
Modifier and Type | Method and Description |
---|---|
double |
calculateDissimilarity(byte[] target,
byte[] query)
Compare two descriptors in serialized form.
|
double |
calculateDissimilarity(T target,
T query)
Compare two descriptors.
|
double |
calculateSimilarity(byte[] target,
byte[] query)
Compare two descriptors in serialized form.
|
double |
calculateSimilarity(T target,
T query)
Compare two descriptors.
|
ShapeComparisonResult |
compare(byte[] target,
byte[] query)
Compare two descriptors in serialized form.
|
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.
|
UnguardedContext<T,byte[]> |
unguardedContext()
Associated unguarded context.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
compare
getMetricMetadata, getUpperBound
public AbstractShapeComparator(DescriptorGenerator<T> generator)
public double calculateSimilarity(byte[] target, byte[] query)
DescriptorComparator
calculateSimilarity
in interface DescriptorComparator<T extends ShapeDescriptor>
target
- Target descriptor in its serialized formquery
- Query descriptor in its serialized formpublic double calculateDissimilarity(byte[] target, byte[] query)
DescriptorComparator
calculateDissimilarity
in interface DescriptorComparator<T extends ShapeDescriptor>
target
- Target descriptor in its serialized formquery
- Query descriptor in its serialized formpublic Optional<Double> getLowerBound()
DescriptorComparator
getLowerBound
in interface DescriptorComparator<T extends ShapeDescriptor>
public double calculateSimilarity(T target, T 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<T extends ShapeDescriptor>
target
- Target descriptorquery
- Query descriptorpublic double calculateDissimilarity(T target, T 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<T extends ShapeDescriptor>
target
- Target descriptorquery
- Query descriptorpublic ShapeComparisonResult 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 ShapeComparator<T extends ShapeDescriptor>
compare
in interface DescriptorComparator<T extends ShapeDescriptor>
target
- Target descriptor in its serialized formquery
- Query descriptor in its serialized formpublic UnguardedContext<T,byte[]> unguardedContext()
DescriptorComparator
unguardedContext
in interface DescriptorComparator<T extends ShapeDescriptor>
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
.