|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmessif.objects.PrecomputedDistancesFilter
public abstract class PrecomputedDistancesFilter
This class provides a framework for metric-distance filtering techniques. Using a triangle inequality prperty of the metric space, some distance calculations can be avoided provided there is some additional information - the precomputed distances.
A filter is added to a LocalAbstractObject
via its
chainFilter
method. Objects can have
several filters chained - if the first filter fails to avoid the computation,
the next is used and so on. The filters are then used automatically whenever a
distance computation
is evaluated.
Field Summary | |
---|---|
protected static StatisticCounter |
counterPrecomputedDistanceSavings
Global counter for saving distance computations by using precomputed |
Constructor Summary | |
---|---|
protected |
PrecomputedDistancesFilter()
Creates a new instance of PrecomputedDistancesFilter. |
protected |
PrecomputedDistancesFilter(BinaryInput input,
BinarySerializator serializator)
Creates a new instance of PrecomputedDistancesFilter loaded from binary input. |
Method Summary | |
---|---|
int |
binarySerialize(BinaryOutput output,
BinarySerializator serializator)
Binary-serialize this object into the output . |
java.lang.Object |
clone()
Creates and returns a copy of this object. |
boolean |
excludeUsingPrecompDist(PrecomputedDistancesFilter targetFilter,
float radius)
Returns true if object associated with targetFilter filter can be excluded (filtered out) using this precomputed distances. |
protected abstract boolean |
excludeUsingPrecompDistImpl(PrecomputedDistancesFilter targetFilter,
float radius)
Returns true if object associated with targetFilter filter can be excluded (filtered out) using this precomputed distances. |
int |
getBinarySize(BinarySerializator serializator)
Returns the exact size of the binary-serialized version of this object in bytes. |
PrecomputedDistancesFilter |
getNextFilter()
Returns the next filter in this filter's chain. |
float |
getPrecomputedDistance(LocalAbstractObject obj)
Returns the precomputed distance to an object. |
protected abstract float |
getPrecomputedDistanceImpl(LocalAbstractObject obj)
Implement this method to return the precomputed distance to an object. |
boolean |
includeUsingPrecompDist(PrecomputedDistancesFilter targetFilter,
float radius)
Returns true if object associated with targetFilter filter can be included using this precomputed distances. |
protected abstract boolean |
includeUsingPrecompDistImpl(PrecomputedDistancesFilter targetFilter,
float radius)
Returns true if object associated with targetFilter filter can be included using this precomputed distances. |
protected abstract boolean |
isDataWritable()
Returns whether this filter's data can be written to a text stream. |
abstract boolean |
isGetterSupported()
Returns true if this object supports getPrecomputedDistance(messif.objects.LocalAbstractObject) method. |
void |
write(java.io.OutputStream stream)
Writes this distances filter into the output text stream. |
protected abstract void |
writeData(java.io.OutputStream stream)
Store this filter's data to a text stream. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static StatisticCounter counterPrecomputedDistanceSavings
Constructor Detail |
---|
protected PrecomputedDistancesFilter()
protected PrecomputedDistancesFilter(BinaryInput input, BinarySerializator serializator) throws java.io.IOException
input
- the input to read the PrecomputedDistancesFilter fromserializator
- the serializator used to write objects
java.io.IOException
- if there was an I/O error reading from the inputMethod Detail |
---|
public PrecomputedDistancesFilter getNextFilter()
public final float getPrecomputedDistance(LocalAbstractObject obj)
UNKNOWN_DISTANCE
.
obj
- the object for which the precomputed distance is returned
public abstract boolean isGetterSupported()
getPrecomputedDistance(messif.objects.LocalAbstractObject)
method.
getPrecomputedDistance(messif.objects.LocalAbstractObject)
methodprotected abstract float getPrecomputedDistanceImpl(LocalAbstractObject obj)
UNKNOWN_DISTANCE
.
obj
- the object for which the precomputed distance is returned
public final boolean excludeUsingPrecompDist(PrecomputedDistancesFilter targetFilter, float radius)
LocalAbstractObject.excludeUsingPrecompDist(messif.objects.LocalAbstractObject, float)
for full explanation.
targetFilter
- the target precomputed distancesradius
- the radius to check the precomputed distances for
public final boolean includeUsingPrecompDist(PrecomputedDistancesFilter targetFilter, float radius)
LocalAbstractObject.includeUsingPrecompDist(messif.objects.LocalAbstractObject, float)
for full explanation.
targetFilter
- the target precomputed distancesradius
- the radius to check the precomputed distances for
protected abstract boolean excludeUsingPrecompDistImpl(PrecomputedDistancesFilter targetFilter, float radius)
LocalAbstractObject.excludeUsingPrecompDist(messif.objects.LocalAbstractObject, float)
for full explanation.
targetFilter
- the target precomputed distancesradius
- the radius to check the precomputed distances for
protected abstract boolean includeUsingPrecompDistImpl(PrecomputedDistancesFilter targetFilter, float radius)
LocalAbstractObject.includeUsingPrecompDist(messif.objects.LocalAbstractObject, float)
for full explanation.
targetFilter
- the target precomputed distancesradius
- the radius to check the precomputed distances for
public final void write(java.io.OutputStream stream) throws java.io.IOException
#filter filterClass filter value
stream
- the stream to write the key to
java.io.IOException
- if any problem occures during comment writingprotected abstract void writeData(java.io.OutputStream stream) throws java.io.IOException
stream
- the stream to store this object to
java.io.IOException
- if there was an error while writing to streamprotected abstract boolean isDataWritable()
writeData(java.io.OutputStream)
should
provide a valid writing implementation.
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
- if this object cannot be cloned.public int binarySerialize(BinaryOutput output, BinarySerializator serializator) throws java.io.IOException
output
.
binarySerialize
in interface BinarySerializable
output
- the output that this object is binary-serialized intoserializator
- the serializator used to write objects
java.io.IOException
- if there was an I/O error during serializationpublic int getBinarySize(BinarySerializator serializator)
getBinarySize
in interface BinarySerializable
serializator
- the serializator used to write objects
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |