public class FvGeneratorImpl extends Object implements FvGenerator
Guarded.EnsureThat, Guarded.New
FloatVectorMetricFactory.ToLinenote<C>
Modifier and Type | Method and Description |
---|---|
FloatVectorComparisonContextFactory |
comparisonContextFactory()
Get an unguarded context factory.
|
Linenote<DescriptorComparator<FloatVectorDescriptor>> |
comparisonLinenote()
Gets the string based parameterization description.
|
DescriptorComparator<FloatVectorDescriptor> |
defaultComparison()
Default comparator.
|
DescriptorComparator<FloatVectorDescriptor> |
forFloatMetrics(FloatVectorMetrics comparator)
Creates a new Comparator instance according to the given metric.
|
DescriptorComparator<FloatVectorDescriptor> |
forTversky(TverskyParameters tverskyParamaters)
Creates a new Comparator instance according to the given Tversky metric parameters.
|
DescriptorComparator<FloatVectorDescriptor> |
forTverskyCoefficients(double coeffQuery,
double coeffTarget)
Creates a new Comparator instance according to the given Tversky metric parameters.
|
FloatVectorDescriptor |
fromByteArray(byte[] desc)
Builds a descriptor from its byte array representation.
|
FloatVectorDescriptor |
fromFloats(float[] floats)
Create a descriptor from a custom representation.
|
FloatVectorDescriptor |
fromString(String desc)
Builds a descriptor from its string representation.
|
FloatVectorDescriptor |
generateDescriptor(Molecule mol)
Calculates the associated descriptor for the given Molecule.
|
FloatVectorDescriptor |
getBareDescriptor(FloatVectorDescriptor descriptor)
Get bare-only form of a descriptor.
|
DescriptorComparator<FloatVectorDescriptor> |
getDefaultComparator()
Gets the default comparator object.
|
DescriptorComparator<FloatVectorDescriptor> |
getFloatMetricsComparator(FloatVectorMetrics comparator)
Deprecated.
|
Object |
getGuardObject()
Gets the guard object associated to the generated descriptors/utilities.
|
DescriptorParameters |
getParameters()
Gets the parameter object.
|
boolean |
serializerIsEqualWith(DescriptorSerializer other)
Check strict equivalence of serializers.
|
byte[] |
toByteArray(FloatVectorDescriptor desc)
Creates the byte array representation of a descriptor object.
|
String |
toString() |
String |
toString(FloatVectorDescriptor desc)
Creates the String representation of a descriptor object.
|
public FloatVectorDescriptor generateDescriptor(Molecule mol)
DescriptorGenerator
Note that different descriptors/application scenarios might need different structure standardization.
Currently structure standardization is generally not in the scope of the responsibilities of
DescriptorGenerator
to the possible maximal extent.
Since the returned descriptor might contain additional data (reference to input Molecule
, etc) if
it is stored for later comparison it is recommended to use the bare-only representation returned by
DescriptorGenerator.getBareDescriptor(com.chemaxon.descriptors.common.Descriptor)
.
generateDescriptor
in interface DescriptorGenerator<FloatVectorDescriptor>
mol
- Input moleculeDescriptorGenerator.getBareDescriptor(com.chemaxon.descriptors.common.Descriptor)
on either the rich or the
bare representation.public FloatVectorDescriptor getBareDescriptor(FloatVectorDescriptor descriptor)
DescriptorGenerator
getBareDescriptor
in interface DescriptorGenerator<FloatVectorDescriptor>
descriptor
- A descriptor's rich or bare formpublic byte[] toByteArray(FloatVectorDescriptor desc)
DescriptorSerializer
The descriptors bare form can be reconstructed using DescriptorSerializer.fromByteArray(byte[])
.
toByteArray
in interface DescriptorSerializer<FloatVectorDescriptor>
desc
- Descriptor (only bare form is considered)public String toString(FloatVectorDescriptor desc)
DescriptorSerializer
The descriptors bare form can be reconstructed using DescriptorSerializer.fromString(java.lang.String)
.
toString
in interface DescriptorSerializer<FloatVectorDescriptor>
desc
- Descriptor (only bare form is considered)public FloatVectorDescriptor fromString(String desc)
DescriptorSerializer
Please note that the compatibility of this (the reconstructing) DescriptorGenerator
, regarding to the
serializing generator (on which DescriptorSerializer.toString(com.chemaxon.descriptors.common.Descriptor)
was called to construct the String form) is not checked; compatibility must be ensured by the user application.
fromString
in interface DescriptorSerializer<FloatVectorDescriptor>
desc
- String representationpublic FloatVectorDescriptor fromByteArray(byte[] desc)
DescriptorSerializer
Please note that the compatibility of this (the reconstructing) DescriptorGenerator
, regarding to the
serializing generator (on which
DescriptorSerializer.toByteArray(com.chemaxon.descriptors.common.Descriptor)
was called to construct the
byte array form) is not checked; compatibility must be ensured by the user application.
fromByteArray
in interface DescriptorSerializer<FloatVectorDescriptor>
desc
- Byte array of the descriptorpublic DescriptorComparator<FloatVectorDescriptor> getDefaultComparator()
DescriptorGenerator
getDefaultComparator
in interface DescriptorGenerator<FloatVectorDescriptor>
public DescriptorComparator<FloatVectorDescriptor> forFloatMetrics(FloatVectorMetrics comparator)
FloatVectorMetricFactory
forFloatMetrics
in interface FloatVectorMetricFactory<DescriptorComparator<FloatVectorDescriptor>>
comparator
- binary metricpublic DescriptorParameters getParameters()
DescriptorGenerator
getParameters
in interface DescriptorGenerator<FloatVectorDescriptor>
public FloatVectorDescriptor fromFloats(float[] floats)
FvGenerator
fromFloats
in interface FvGenerator
floats
- Values to representpublic 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
.public FloatVectorComparisonContextFactory comparisonContextFactory()
DescriptorGenerator
byte []
serialization based unguarded representation.
Implementations are expected to provide additional factory methods for unguarded and plain descriptor comparators for implemented metrics.
comparisonContextFactory
in interface DescriptorGenerator<FloatVectorDescriptor>
public DescriptorComparator<FloatVectorDescriptor> defaultComparison()
DescriptorGenerator
defaultComparison
in interface DescriptorGenerator<FloatVectorDescriptor>
defaultComparison
in interface MetricFactory<DescriptorComparator<FloatVectorDescriptor>>
public DescriptorComparator<FloatVectorDescriptor> forTversky(TverskyParameters tverskyParamaters)
FloatVectorMetricFactory
forTversky
in interface FloatVectorMetricFactory<DescriptorComparator<FloatVectorDescriptor>>
tverskyParamaters
- parameters for the comparatorpublic DescriptorComparator<FloatVectorDescriptor> forTverskyCoefficients(double coeffQuery, double coeffTarget)
FloatVectorMetricFactory
forTverskyCoefficients
in interface FloatVectorMetricFactory<DescriptorComparator<FloatVectorDescriptor>>
coeffQuery
- Query side coefficientcoeffTarget
- Target side coefficient@Deprecated public DescriptorComparator<FloatVectorDescriptor> getFloatMetricsComparator(FloatVectorMetrics comparator)
FvGenerator
getFloatMetricsComparator
in interface FvGenerator
comparator
- Metricspublic Linenote<DescriptorComparator<FloatVectorDescriptor>> comparisonLinenote()
MetricFactory
comparisonLinenote
in interface MetricFactory<DescriptorComparator<FloatVectorDescriptor>>
public boolean serializerIsEqualWith(DescriptorSerializer other)
DescriptorSerializer
serializerIsEqualWith
in interface DescriptorSerializer<FloatVectorDescriptor>
other
- Other serializertrue
when and only when the two serializers (this
and other
) are the same thus
interchangeable. Implementations typically check class equivalence, guard object match and parameter match.