|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmessif.objects.PrecomputedDistancesFilter
messif.objects.PrecomputedDistancesFixedArrayFilter
public class PrecomputedDistancesFixedArrayFilter
Precomputed distance filter that has a fixed array of distances. While filtering, this filter uses one stored distance after the other and matches it agains the opposite object's distance.
Field Summary | |
---|---|
protected int |
actualSize
The actual size of precompDist (if it was pre-buffered) |
protected float[] |
precompDist
The list of precomputed distances |
Fields inherited from class messif.objects.PrecomputedDistancesFilter |
---|
counterPrecomputedDistanceSavings |
Constructor Summary | |
---|---|
|
PrecomputedDistancesFixedArrayFilter()
Creates a new instance of PrecomputedDistancesFixedArrayFilter. |
protected |
PrecomputedDistancesFixedArrayFilter(BinaryInput input,
BinarySerializator serializator)
Creates a new instance of PrecomputedDistancesFixedArrayFilter loaded from binary input. |
|
PrecomputedDistancesFixedArrayFilter(int initialSize)
Creates a new instance of PrecomputedDistancesFixedArrayFilter. |
|
PrecomputedDistancesFixedArrayFilter(LocalAbstractObject object)
Creates a new instance of PrecomputedDistancesFixedArrayFilter. |
|
PrecomputedDistancesFixedArrayFilter(LocalAbstractObject object,
int initialSize)
Creates a new instance of PrecomputedDistancesFixedArrayFilter |
|
PrecomputedDistancesFixedArrayFilter(java.lang.String distancesString)
Creates a new instance of PrecomputedDistancesFixedArrayFilter from a string. |
Method Summary | |
---|---|
int |
addPrecompDist(AbstractObjectList<LocalAbstractObject> pivots,
LocalAbstractObject obj)
Add distances at the end of internal list of precomputed distances. |
int |
addPrecompDist(float dist)
Add distance at the end of internal list of precomputed distances. |
int |
addPrecompDist(float[] dists)
Add the passed distances at the end of internal list of precomputed distances. |
int |
addPrecompDist(LocalAbstractObject[] pivots,
LocalAbstractObject obj)
Add distances at the end of internal list of precomputed distances. |
float |
addPrecompDist(LocalAbstractObject p,
LocalAbstractObject o)
Add distance at the end of internal list of precomputed distances. |
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. |
protected boolean |
excludeUsingPrecompDistImpl(PrecomputedDistancesFilter targetFilter,
float radius)
Returns true if object associated with targetFilter filter can be excluded (filtered out) using this precomputed distances. |
protected boolean |
excludeUsingPrecompDistImpl(PrecomputedDistancesFixedArrayFilter targetFilter,
float radius)
Return true if the obj has been filtered out using stored precomputed distance. |
int |
getBinarySize(BinarySerializator serializator)
Returns the exact size of the binary-serialized version of this object in bytes. |
float[] |
getPrecompDist()
Return the whole array of precomputed distances. |
float |
getPrecompDist(int position)
Returns the precomputed distance at the specified index. |
int |
getPrecompDistSize()
Returns the number of stored precomputed distance. |
protected float |
getPrecomputedDistanceImpl(LocalAbstractObject obj)
Implement this method to return the precomputed distance to an object. |
protected boolean |
includeUsingPrecompDistImpl(PrecomputedDistancesFilter targetFilter,
float radius)
Returns true if object associated with targetFilter filter can be included using this precomputed distances. |
protected boolean |
includeUsingPrecompDistImpl(PrecomputedDistancesFixedArrayFilter targetFilter,
float radius)
Returns true if object associated with targetFilter filter can be included using this precomputed distances. |
void |
insertPrecompDist(int pos,
float dist)
Insert distance into internal list of precomputed distances at the specified position. |
float |
insertPrecompDist(int pos,
LocalAbstractObject p,
LocalAbstractObject o)
Insert distance into internal list of precomputed distances at the specified position. |
protected boolean |
isDataWritable()
Returns whether this filter's data can be written to a text stream. |
boolean |
isGetterSupported()
Returns true if this object supports PrecomputedDistancesFilter.getPrecomputedDistance(messif.objects.LocalAbstractObject) method. |
void |
removeLastPrecompDists(int cnt)
Removes the requested number of distances from the end of the array. |
void |
removePrecompDist(int pos)
Remove distance at the specified index from the internal list of precomputed distances. |
void |
resetAllPrecompDist()
Removes all precomputed distances and sets the actual array size to zero (the maximal size stays). |
protected void |
resizePrecompDistArray(int newSize)
Resize the internal precomputed distances array to the newSize. |
void |
setFixedPivotsPrecompDist(float[] precompDist)
Replaces the current array of precomputed distances with the values passed in the argument. |
void |
setPrecompDist(int pos,
float dist)
Set distance in the internal list of precomputed distances at the specified position. |
float |
setPrecompDist(int pos,
LocalAbstractObject p,
LocalAbstractObject o)
Set distance at the end of internal list of precomputed distances. |
protected void |
writeData(java.io.OutputStream stream)
Store this filter's data to a text stream. |
Methods inherited from class messif.objects.PrecomputedDistancesFilter |
---|
excludeUsingPrecompDist, getNextFilter, getPrecomputedDistance, includeUsingPrecompDist, write |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected float[] precompDist
protected int actualSize
Constructor Detail |
---|
public PrecomputedDistancesFixedArrayFilter()
public PrecomputedDistancesFixedArrayFilter(LocalAbstractObject object)
object
- the object to which to add this filterpublic PrecomputedDistancesFixedArrayFilter(int initialSize)
initialSize
- the initial size for this filter's internal array of distancespublic PrecomputedDistancesFixedArrayFilter(LocalAbstractObject object, int initialSize)
object
- the object to which to add this filterinitialSize
- the initial size for this filter's internal array of distancespublic PrecomputedDistancesFixedArrayFilter(java.lang.String distancesString) throws java.lang.IllegalArgumentException
distancesString
- string to create the filter from
java.lang.IllegalArgumentException
- if the string is of inappropriate formatprotected PrecomputedDistancesFixedArrayFilter(BinaryInput input, BinarySerializator serializator) throws java.io.IOException
input
- the input to read the PrecomputedDistancesFixedArrayFilter fromserializator
- the serializator used to write objects
java.io.IOException
- if there was an I/O error reading from the inputMethod Detail |
---|
protected boolean isDataWritable()
PrecomputedDistancesFilter
PrecomputedDistancesFilter.writeData(java.io.OutputStream)
should
provide a valid writing implementation.
isDataWritable
in class PrecomputedDistancesFilter
protected void writeData(java.io.OutputStream stream) throws java.io.IOException
PrecomputedDistancesFilter
writeData
in class PrecomputedDistancesFilter
stream
- the stream to store this object to
java.io.IOException
- if there was an error while writing to streampublic int addPrecompDist(float dist)
dist
- distance to append
public int addPrecompDist(float[] dists)
dists
- array of distances to append
public float addPrecompDist(LocalAbstractObject p, LocalAbstractObject o)
p
- first object (usually pivot)o
- second object
LocalAbstractObject.UNKNOWN_DISTANCE
is returned if any of objects passed is null.public int addPrecompDist(AbstractObjectList<LocalAbstractObject> pivots, LocalAbstractObject obj)
o
.
If pivots
or o
is null, no change is done.
pivots
- list of objects (usually pivots)obj
- second object
public int addPrecompDist(LocalAbstractObject[] pivots, LocalAbstractObject obj)
o
.
If pivots
or o
is null, no change is done.
pivots
- list of objects (usually pivots)obj
- second object
public void insertPrecompDist(int pos, float dist) throws java.lang.IndexOutOfBoundsException
pos
- the index to insert the distance atdist
- the distance to insert
java.lang.IndexOutOfBoundsException
- is thrown when pos
is out of bounds.public float insertPrecompDist(int pos, LocalAbstractObject p, LocalAbstractObject o) throws java.lang.IndexOutOfBoundsException
pos
- the index to insert the distance atp
- first object (usually pivot)o
- second object
LocalAbstractObject.UNKNOWN_DISTANCE
is returned if any of objects passed is null.
java.lang.IndexOutOfBoundsException
- is thrown when pos
is out of bounds.public void setPrecompDist(int pos, float dist) throws java.lang.IndexOutOfBoundsException
pos
- the index to set the distance atdist
- the distance to set
java.lang.IndexOutOfBoundsException
- is thrown when pos
is out of bounds.public float setPrecompDist(int pos, LocalAbstractObject p, LocalAbstractObject o) throws java.lang.IndexOutOfBoundsException
pos
- the index to insert the distance atp
- first object (usually pivot)o
- second object
LocalAbstractObject.UNKNOWN_DISTANCE
is returned if any of objects passed is null.
java.lang.IndexOutOfBoundsException
- is thrown when pos
is out of bounds.public void removePrecompDist(int pos) throws java.lang.IndexOutOfBoundsException
pos
- the index to remove the distance at
java.lang.IndexOutOfBoundsException
- is thrown when pos
is out of bounds.public void removeLastPrecompDists(int cnt) throws java.lang.IndexOutOfBoundsException
cnt
- the number of distances to remove
java.lang.IndexOutOfBoundsException
- is thrown when the list of precomputed distance is already empty.public void setFixedPivotsPrecompDist(float[] precompDist)
precompDist
- an array of new distancespublic int getPrecompDistSize()
public void resetAllPrecompDist()
public boolean isGetterSupported()
PrecomputedDistancesFilter.getPrecomputedDistance(messif.objects.LocalAbstractObject)
method.
isGetterSupported
in class PrecomputedDistancesFilter
PrecomputedDistancesFilter.getPrecomputedDistance(messif.objects.LocalAbstractObject)
methodpublic float getPrecompDist(int position)
position
the function returns LocalAbstractObject.UNKNOWN_DISTANCE
.
position
- the index to retrieve the distance from
public float[] getPrecompDist()
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class PrecomputedDistancesFilter
java.lang.CloneNotSupportedException
- if this object cannot be cloned.protected final boolean excludeUsingPrecompDistImpl(PrecomputedDistancesFilter targetFilter, float radius)
PrecomputedDistancesFilter
LocalAbstractObject.excludeUsingPrecompDist(messif.objects.LocalAbstractObject, float)
for full explanation.
excludeUsingPrecompDistImpl
in class PrecomputedDistancesFilter
targetFilter
- the target precomputed distancesradius
- the radius to check the precomputed distances for
protected boolean excludeUsingPrecompDistImpl(PrecomputedDistancesFixedArrayFilter targetFilter, float radius)
targetFilter
- the target precomputed distancesradius
- the radius to check the precomputed distances for
protected final boolean includeUsingPrecompDistImpl(PrecomputedDistancesFilter targetFilter, float radius)
PrecomputedDistancesFilter
LocalAbstractObject.includeUsingPrecompDist(messif.objects.LocalAbstractObject, float)
for full explanation.
includeUsingPrecompDistImpl
in class PrecomputedDistancesFilter
targetFilter
- the target precomputed distancesradius
- the radius to check the precomputed distances for
protected boolean includeUsingPrecompDistImpl(PrecomputedDistancesFixedArrayFilter 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 float getPrecomputedDistanceImpl(LocalAbstractObject obj)
PrecomputedDistancesFilter
UNKNOWN_DISTANCE
.
getPrecomputedDistanceImpl
in class PrecomputedDistancesFilter
obj
- the object for which the precomputed distance is returned
protected void resizePrecompDistArray(int newSize)
newSize
- the new size for the precomputed arraypublic int binarySerialize(BinaryOutput output, BinarySerializator serializator) throws java.io.IOException
output
.
binarySerialize
in interface BinarySerializable
binarySerialize
in class PrecomputedDistancesFilter
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
getBinarySize
in class PrecomputedDistancesFilter
serializator
- the serializator used to write objects
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |