public abstract class MetaObjectFixedWeightedSum extends MetaObjectFixed
MetaObjectFixed
that implements the distance
as a weighted sum of the encapsulated objects.LocalAbstractObject.DataEqualObject, LocalAbstractObject.TextStreamFactory<T extends LocalAbstractObject>, LocalAbstractObject.TrivialDistanceFunction
counterDistanceComputations, counterLowerBoundDistanceComputations, counterPrecomputedDistanceSavings, counterUpperBoundDistanceComputations, MAX_DISTANCE, MIN_DISTANCE, suppData, trivialDistanceFunction, UNKNOWN_DISTANCE
Modifier | Constructor and Description |
---|---|
protected |
MetaObjectFixedWeightedSum()
Creates a new instance of MetaObjectFixedWeightedSum.
|
protected |
MetaObjectFixedWeightedSum(AbstractObjectKey objectKey)
Creates a new instance of MetaObjectFixedWeightedSum.
|
protected |
MetaObjectFixedWeightedSum(BinaryInput input,
BinarySerializator serializator)
Creates a new instance of MetaObjectFixedWeightedSum loaded from binary input.
|
protected |
MetaObjectFixedWeightedSum(java.lang.String locatorURI)
Creates a new instance of MetaObjectFixedWeightedSum.
|
Modifier and Type | Method and Description |
---|---|
protected float |
getDistanceImpl(LocalAbstractObject obj,
float[] metaDistances,
float distThreshold)
The actual implementation of the metric function.
|
protected float |
getDistanceObjectImpl(int index,
MetaObjectFixed obj,
float distThreshold)
Computes the distance of the
index th fixed encapsulated object of this metaobject
to the index th fixed encapsulated object of the given obj . |
float |
getMaxDistance()
Returns a maximal possible distance for this class.
|
protected abstract float |
getWeight(int index)
Returns the weight used for the
index th encapsulated object distance in the overall distance sum. |
binarySerialize, getBinarySize, getObject, getObject, getObjectCount, getObjectMap, getObjectName, getObjectNames, getObjectNamesCount, getObjects, readObjects, readObjectsBinary, writeData
clearSurplusData, containsObject, createMetaDistancesHolder, createSearchMetaObject, dataEquals, dataHashCode, fillMetaDistances, fillMetaDistances, getDistanceImpl, getObjectFromMap, getSize, implementationGetDistance, readObject, readObject, readObjects, readObjects, readObjectsHeader, toString, writeObjects, writeObjectsHeader
clone, clone, cloneRandomlyModify, create, create, excludeUsingPrecompDist, getDistance, getDistance, getDistance, getDistanceFilter, getDistanceFilter, getDistanceFilter, getDistanceFilter, getDistanceLowerBound, getDistanceLowerBoundImpl, getDistanceStorePrecomputed, getDistanceStorePrecomputed, getDistanceStorePrecomputed, getDistanceUpperBound, getDistanceUpperBoundImpl, getFieldsForNames, getNormDistance, getPrecomputedDistance, getPrecomputedDistance, getRandomChar, getRandomNormal, chainDestroy, chainFilter, includeUsingPrecompDist, isDistanceCompatible, parseObjectComment, peekNextChar, readAttributesFromStream, readObjectComments, readObjectCommentsWithoutData, unchainFilter, write, write, writeAttributesToStream, writeObjectComment
clone, getLocatorURI, getNoDataObject, getObjectKey, getObjectKey, getObjectLocatorURI, setObjectKey
protected MetaObjectFixedWeightedSum()
protected MetaObjectFixedWeightedSum(AbstractObjectKey objectKey)
objectKey
- the key to be associated with this objectprotected MetaObjectFixedWeightedSum(java.lang.String locatorURI)
AbstractObjectKey
is generated for
the specified locatorURI
.locatorURI
- the locator URI for the new objectprotected MetaObjectFixedWeightedSum(BinaryInput input, BinarySerializator serializator) throws java.io.IOException
input
- the input to read the MetaObject fromserializator
- the serializator used to write objectsjava.io.IOException
- if there was an I/O error reading from the bufferMetaObjectFixed.readObjectsBinary(messif.objects.nio.BinaryInput, messif.objects.nio.BinarySerializator, java.lang.Class<? extends messif.objects.LocalAbstractObject>[])
protected abstract float getWeight(int index)
index
th encapsulated object distance in the overall distance sum.index
- the fixed index of the object the weight of which to getindex
th encapsulated objectprotected float getDistanceObjectImpl(int index, MetaObjectFixed obj, float distThreshold)
index
th fixed encapsulated object of this metaobject
to the index
th fixed encapsulated object of the given obj
.
If the distance cannot be measured, the LocalAbstractObject.UNKNOWN_DISTANCE
is returned.index
- the index of the fixed encapsulated object for which to get the distanceobj
- the other MetaObjectFixed
the fixed encapsulated object of which to measuredistThreshold
- the threshold value on the distance (the query radius from the example above)public float getMaxDistance()
LocalAbstractObject
LocalAbstractObject.MAX_DISTANCE
.getMaxDistance
in class LocalAbstractObject
protected float getDistanceImpl(LocalAbstractObject obj, float[] metaDistances, float distThreshold)
MetaObject
metaDistances
parameter is not null, it should be filled
with the distances to the respective encapsulated objects (method
fillMetaDistances
can be used).getDistanceImpl
in class MetaObject
obj
- the object to compute distance tometaDistances
- the array that is filled with the distances of the respective encapsulated objects, if it is not nulldistThreshold
- the threshold value on the distanceLocalAbstractObject.getDistance(messif.objects.LocalAbstractObject)