public class BvGeneratorImpl extends Object implements BvGenerator
Modifier and Type | Class and Description |
---|---|
static class |
BvGeneratorImpl.Service
Class wrapping constructor for DI.
|
Guarded.EnsureThat, Guarded.New
BinaryVectorMetricFactory.ToLinenote<C>
Modifier and Type | Method and Description |
---|---|
BinaryVectorComparisonContextFactory<long[]> |
comparisonContextFactory()
Get an unguarded context factory.
|
Linenote<DescriptorComparator<BinaryVectorDescriptor>> |
comparisonLinenote()
Gets the string based parameterization description.
|
DescriptorComparator<BinaryVectorDescriptor> |
defaultComparison()
Default comparator.
|
DescriptorComparator<BinaryVectorDescriptor> |
forBinaryMetrics(BinaryMetrics metrics)
Creates a new instance according to the given metric.
|
DescriptorComparator<BinaryVectorDescriptor> |
forTversky(TverskyParameters tverskyParamaters)
Creates a new Comparator instance according to the given Tversky metric parameters.
|
DescriptorComparator<BinaryVectorDescriptor> |
forTverskyCoefficients(double coeffQuery,
double coeffTarget)
Creates a new Comparator instance according to the given Tversky metric parameters.
|
BinaryVectorDescriptor |
fromBitSet(BitSet bits)
Create a descriptor from a BitSet representation.
|
BinaryVectorDescriptor |
fromByteArray(byte[] desc)
Builds a descriptor from its byte array representation.
|
BinaryVectorDescriptor |
fromString(String desc)
Builds a descriptor from its string representation.
|
BinaryVectorDescriptor |
generateDescriptor(Molecule mol)
Calculates the associated descriptor for the given Molecule.
|
BinaryVectorDescriptor |
getBareDescriptor(BinaryVectorDescriptor descriptor)
Get bare-only form of a descriptor.
|
DescriptorComparator<BinaryVectorDescriptor> |
getBinaryMetricsComparator(BinaryMetrics metrics)
Deprecated comparison method kept for compatibility reasons.
|
DescriptorComparator<BinaryVectorDescriptor> |
getDefaultComparator()
Gets the default comparator object.
|
Object |
getGuardObject()
Gets the guard object associated to the generated descriptors/utilities.
|
DescriptorParameters |
getParameters()
Gets the parameter object.
|
DescriptorComparator<BinaryVectorDescriptor> |
getTverskyComparator(double coeffQuery,
double coeffTarget)
Deprecated comparison method kept for compatibility reasons.
|
DescriptorComparator<BinaryVectorDescriptor> |
getTverskyComparator(TverskyParameters tverskyParamaters)
Deprecated comparison method kept for compatibility reasons.
|
boolean |
serializerIsEqualWith(DescriptorSerializer other)
Check strict equivalence of serializers.
|
byte[] |
toByteArray(BinaryVectorDescriptor desc)
Creates the byte array representation of a descriptor object.
|
String |
toString() |
String |
toString(BinaryVectorDescriptor desc)
Creates the String representation of a descriptor object.
|
public BinaryVectorDescriptor 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<BinaryVectorDescriptor>
mol
- Input moleculeDescriptorGenerator.getBareDescriptor(com.chemaxon.descriptors.common.Descriptor)
on either the rich or the
bare representation.public BinaryVectorDescriptor getBareDescriptor(BinaryVectorDescriptor descriptor)
DescriptorGenerator
getBareDescriptor
in interface DescriptorGenerator<BinaryVectorDescriptor>
descriptor
- A descriptor's rich or bare formpublic byte[] toByteArray(BinaryVectorDescriptor desc)
DescriptorSerializer
The descriptors bare form can be reconstructed using DescriptorSerializer.fromByteArray(byte[])
.
toByteArray
in interface DescriptorSerializer<BinaryVectorDescriptor>
desc
- Descriptor (only bare form is considered)public String toString(BinaryVectorDescriptor desc)
DescriptorSerializer
The descriptors bare form can be reconstructed using DescriptorSerializer.fromString(java.lang.String)
.
toString
in interface DescriptorSerializer<BinaryVectorDescriptor>
desc
- Descriptor (only bare form is considered)public BinaryVectorDescriptor 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<BinaryVectorDescriptor>
desc
- String representationpublic BinaryVectorDescriptor 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<BinaryVectorDescriptor>
desc
- Byte array of the descriptorpublic DescriptorComparator<BinaryVectorDescriptor> getDefaultComparator()
DescriptorGenerator
getDefaultComparator
in interface DescriptorGenerator<BinaryVectorDescriptor>
public DescriptorComparator<BinaryVectorDescriptor> forBinaryMetrics(BinaryMetrics metrics)
BinaryVectorMetricFactory
forBinaryMetrics
in interface BinaryVectorMetricFactory<DescriptorComparator<BinaryVectorDescriptor>>
metrics
- binary metricpublic DescriptorComparator<BinaryVectorDescriptor> forTversky(TverskyParameters tverskyParamaters)
BinaryVectorMetricFactory
forTversky
in interface BinaryVectorMetricFactory<DescriptorComparator<BinaryVectorDescriptor>>
tverskyParamaters
- parameters for the comparatorpublic DescriptorParameters getParameters()
DescriptorGenerator
getParameters
in interface DescriptorGenerator<BinaryVectorDescriptor>
public BinaryVectorDescriptor fromBitSet(BitSet bits)
BvGenerator
fromBitSet
in interface BvGenerator
bits
- Values to represent.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
.public BinaryVectorComparisonContextFactory<long[]> 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<BinaryVectorDescriptor>
public DescriptorComparator<BinaryVectorDescriptor> forTverskyCoefficients(double coeffQuery, double coeffTarget)
BinaryVectorMetricFactory
forTverskyCoefficients
in interface BinaryVectorMetricFactory<DescriptorComparator<BinaryVectorDescriptor>>
coeffQuery
- Query side coefficientcoeffTarget
- Target side coefficientpublic DescriptorComparator<BinaryVectorDescriptor> defaultComparison()
DescriptorGenerator
defaultComparison
in interface DescriptorGenerator<BinaryVectorDescriptor>
defaultComparison
in interface MetricFactory<DescriptorComparator<BinaryVectorDescriptor>>
public DescriptorComparator<BinaryVectorDescriptor> getBinaryMetricsComparator(BinaryMetrics metrics)
BvGenerator
getBinaryMetricsComparator
in interface BvGenerator
metrics
- Metricspublic DescriptorComparator<BinaryVectorDescriptor> getTverskyComparator(double coeffQuery, double coeffTarget)
BvGenerator
getTverskyComparator
in interface BvGenerator
coeffQuery
- Metric parametercoeffTarget
- Metric parameterpublic DescriptorComparator<BinaryVectorDescriptor> getTverskyComparator(TverskyParameters tverskyParamaters)
BvGenerator
getTverskyComparator
in interface BvGenerator
tverskyParamaters
- Metrics parameterpublic Linenote<DescriptorComparator<BinaryVectorDescriptor>> comparisonLinenote()
MetricFactory
comparisonLinenote
in interface MetricFactory<DescriptorComparator<BinaryVectorDescriptor>>
public boolean serializerIsEqualWith(DescriptorSerializer other)
DescriptorSerializer
serializerIsEqualWith
in interface DescriptorSerializer<BinaryVectorDescriptor>
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.