Class AbstractShapeComparator<T extends ShapeDescriptor>
- Type Parameters:
T
-
- All Implemented Interfaces:
ShapeComparator<T>
,DescriptorComparator<T>
,Guarded
,Serializable
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.chemaxon.descriptors.common.Guarded
Guarded.EnsureThat, Guarded.New
-
Constructor Summary
ModifierConstructorDescriptionprotected
AbstractShapeComparator
(DescriptorGenerator<T> generator) -
Method Summary
Modifier and TypeMethodDescriptiondouble
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.compare
(byte[] target, byte[] query) Compare two descriptors in serialized form.Gets the guard object associated to the generated descriptors/utilities.Get lower bound for the similarity/dissimilarity values if such one can be determined.com.chemaxon.descriptors.common.unguarded.UnguardedContext<T,
byte[]> Associated unguarded context.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.chemaxon.descriptors.common.DescriptorComparator
getMetricMetadata, getUpperBound
Methods inherited from interface com.chemaxon.descriptors.alignment.ShapeComparator
compare
-
Constructor Details
-
AbstractShapeComparator
-
-
Method Details
-
calculateSimilarity
public double calculateSimilarity(byte[] target, byte[] query) Description copied from interface:DescriptorComparator
Compare two descriptors in serialized form.- Specified by:
calculateSimilarity
in interfaceDescriptorComparator<T extends ShapeDescriptor>
- Parameters:
target
- Target descriptor in its serialized formquery
- Query descriptor in its serialized form- Returns:
- Similarity result
-
calculateDissimilarity
public double calculateDissimilarity(byte[] target, byte[] query) Description copied from interface:DescriptorComparator
Compare two descriptors in serialized form.- Specified by:
calculateDissimilarity
in interfaceDescriptorComparator<T extends ShapeDescriptor>
- Parameters:
target
- Target descriptor in its serialized formquery
- Query descriptor in its serialized form- Returns:
- Dissimilarity result
-
getLowerBound
Description copied from interface:DescriptorComparator
Get lower bound for the similarity/dissimilarity values if such one can be determined.- Specified by:
getLowerBound
in interfaceDescriptorComparator<T extends ShapeDescriptor>
- Returns:
- Lower bond if exists; otherwise absent
-
calculateSimilarity
Description copied from interface:DescriptorComparator
Compare two descriptors.Please note that this convenience method wraps
ComparisonResult.getSimilarity()
of comparison result constructed byDescriptorComparator.compare(com.chemaxon.descriptors.common.Descriptor, com.chemaxon.descriptors.common.Descriptor)
- Specified by:
calculateSimilarity
in interfaceDescriptorComparator<T extends ShapeDescriptor>
- Parameters:
target
- Target descriptorquery
- Query descriptor- Returns:
- Similarity result
-
calculateDissimilarity
Description copied from interface:DescriptorComparator
Compare two descriptors.Please note that this convenience method wraps
ComparisonResult.getDissimilarity()
of comparison result constructed byDescriptorComparator.compare(com.chemaxon.descriptors.common.Descriptor, com.chemaxon.descriptors.common.Descriptor)
- Specified by:
calculateDissimilarity
in interfaceDescriptorComparator<T extends ShapeDescriptor>
- Parameters:
target
- Target descriptorquery
- Query descriptor- Returns:
- Dissimilarity result
-
compare
Description copied from interface:DescriptorComparator
Compare two descriptors in serialized form.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 (byDescriptorSerializer.fromByteArray(byte[])
) descriptors.- Specified by:
compare
in interfaceDescriptorComparator<T extends ShapeDescriptor>
- Specified by:
compare
in interfaceShapeComparator<T extends ShapeDescriptor>
- Parameters:
target
- Target descriptor in its serialized formquery
- Query descriptor in its serialized form- Returns:
- Comparison result wrapper
-
unguardedContext
Description copied from interface:DescriptorComparator
Associated unguarded context. For internal use only.- Specified by:
unguardedContext
in interfaceDescriptorComparator<T extends ShapeDescriptor>
- Returns:
- unguarded context
-
getGuardObject
Description copied from interface:Guarded
Gets the guard object associated to the generated descriptors/utilities.Note that serialization/deserialization must preserve guard object reference.
This method is intended to use only for ensuring the compatibility of manipulated objects.
Implementations might use the associated
DescriptorGenerator
orDescriptorParameters
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.- Specified by:
getGuardObject
in interfaceGuarded
- Returns:
- The guard object, can not be
null
.
-