|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmessif.objects.UniqueID
messif.objects.AbstractObject
messif.objects.LocalAbstractObject
messif.objects.BallRegion
public class BallRegion
This class represents a ball region, i.e. a partition of the metric space that holds objects that are within a specified radius from the central object (pivot). The distance function is compatible if and only if the pivot distance function is compatible.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class messif.objects.LocalAbstractObject |
---|
LocalAbstractObject.DataEqualObject |
Field Summary | |
---|---|
protected LocalAbstractObject |
pivot
Center of the ball region |
protected float |
radius
Radius of this region |
Fields inherited from class messif.objects.LocalAbstractObject |
---|
counterDistanceComputations, counterLowerBoundDistanceComputations, counterUpperBoundDistanceComputations, MAX_DISTANCE, MIN_DISTANCE, suppData, UNKNOWN_DISTANCE |
Constructor Summary | |
---|---|
BallRegion()
Creates a new instance of BallRegion with initially empty ball region |
|
BallRegion(java.io.BufferedReader stream)
Creates a new instance of BallRegion from stream. |
|
BallRegion(LocalAbstractObject pivot,
float radius)
Creates a new instance of BallRegion with specified pivot and radius |
Method Summary | |
---|---|
LocalAbstractObject |
cloneRandomlyModify(java.lang.Object... args)
Random copy of ball region is not implemented, thus this method always throws an exception. |
boolean |
dataEquals(java.lang.Object obj)
Indicates whether some other object has the same data as this one. |
int |
dataHashCode()
Returns a hash code value for this ball region's data, i.e. the hash code of the pivot. |
protected float |
getDistanceImpl(LocalAbstractObject obj,
float distThreshold)
Metric distance function that measures the distance of an arbitrary object to this region. |
float |
getDistanceRegion(BallRegion region,
float distThreshold)
Metric distance function between two ball regions. |
float |
getDistanceRegion(LocalAbstractObject regionPivot,
float regionRadius,
float distThreshold)
Metric distance function between two ball regions. |
protected float |
getDistanceRegionImpl(BallRegion region,
float distThreshold)
Metric distance function between two ball regions. |
protected float |
getDistanceRegionImpl(float regionsPivotDistance,
float regionRadius)
Actual computation of the distance if the distance between regions' pivots is known. |
float |
getOverlapWith(LocalAbstractObject regionPivot,
float regionRadius)
Returns the covering overlap (as distance) between this region and the region specified by regionPivot and regionRadius . |
LocalAbstractObject |
getPivot()
Returns current pivot of this ball region. |
float |
getRadius()
Returns current radius of this ball region. |
int |
getSize()
Returns the size of this ball region in bytes. |
boolean |
isCoveredByRegion(LocalAbstractObject regionPivot,
float regionRadius,
float distThreshold)
Returns true if this ball region is covered by at least distThreshold area of the ball
region specified by regionPivot and regionRadius . |
boolean |
isCoveringRegion(LocalAbstractObject regionPivot,
float regionRadius,
float distThreshold)
Returns true if this ball region covers at least distThreshold area of the ball
region specified by regionPivot and regionRadius . |
void |
setPivot(LocalAbstractObject pivot,
boolean updateRadius)
Sets the pivot for this ball region. |
void |
setRadius(float radius)
Sets the radius for this ball region. |
protected void |
writeData(java.io.OutputStream stream)
Store this object's data to a text stream. |
Methods inherited from class messif.objects.AbstractObject |
---|
clone, getLocatorURI, getNoDataObject, getObjectID, getObjectKey, setObjectKey, toString |
Methods inherited from class messif.objects.UniqueID |
---|
compareTo, equals, hashCode |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected LocalAbstractObject pivot
protected float radius
Constructor Detail |
---|
public BallRegion()
public BallRegion(LocalAbstractObject pivot, float radius)
pivot
- the pivot for the new ball regionradius
- the radius for the new ball regionpublic BallRegion(java.io.BufferedReader stream) throws java.io.IOException, java.lang.NumberFormatException, java.lang.IllegalArgumentException, java.lang.ClassNotFoundException
stream
- the stream to load ball region from
java.io.IOException
- if an error occurs during reading from the stream
java.lang.NumberFormatException
- if the stream's object is not valid ball region
java.lang.IllegalArgumentException
- if the stream's object is not valid ball region
java.lang.ClassNotFoundException
- if the stream's object is not valid ball regionMethod Detail |
---|
protected void writeData(java.io.OutputStream stream) throws java.io.IOException
writeData
in class LocalAbstractObject
stream
- the stream to store this object to
java.io.IOException
- if there was an error while writing to streampublic float getRadius()
public LocalAbstractObject getPivot()
public void setRadius(float radius) throws java.lang.IllegalArgumentException
radius
- the new radius
java.lang.IllegalArgumentException
- if the specified radius is negativepublic void setPivot(LocalAbstractObject pivot, boolean updateRadius)
LocalAbstractObject.MAX_DISTANCE
if updateRadius
is true.
pivot
- the new pivotupdateRadius
- specifies whether to update the region's radius or notprotected float getDistanceImpl(LocalAbstractObject obj, float distThreshold)
getDistanceImpl
in class LocalAbstractObject
obj
- the object to compute distance todistThreshold
- the threshold value on the distance
public float getDistanceRegion(BallRegion region, float distThreshold)
region
- the ball region to compute distance todistThreshold
- the threshold value on the distance
public float getDistanceRegion(LocalAbstractObject regionPivot, float regionRadius, float distThreshold)
regionPivot
- the pivot (center) of the ball region to compute distance toregionRadius
- the radius of the ball region to compute distance todistThreshold
- the threshold value on the distance
protected float getDistanceRegionImpl(BallRegion region, float distThreshold)
region
- the ball region to compute distance todistThreshold
- the threshold value on the distance
protected float getDistanceRegionImpl(float regionsPivotDistance, float regionRadius)
regionsPivotDistance
- the distance of the regions' pivotsregionRadius
- the radius of the ball region to compute distance to
public float getOverlapWith(LocalAbstractObject regionPivot, float regionRadius)
regionPivot
and regionRadius
.
If the two regions touch but have no common area, zero is returned.
If the two regions do not even touch, this method returns negative value.
regionPivot
- the pivot (center) of the ball region to get the coverage forregionRadius
- the radius of the ball region to get the coverage for
public boolean isCoveringRegion(LocalAbstractObject regionPivot, float regionRadius, float distThreshold)
distThreshold
area of the ball
region specified by regionPivot
and regionRadius
.
The distThreshold
is the maximal distance that a region's object can be outside this region.
If the threshold is zero, the evaluated region must be fully within this one.
If the two regions do not even touch, this method returns false whatever the value of the threshold is.
regionPivot
- the pivot (center) of the ball region to get the coverage forregionRadius
- the radius of the ball region to get the coverage fordistThreshold
- the threshold distance value on the non-overlaping area
public boolean isCoveredByRegion(LocalAbstractObject regionPivot, float regionRadius, float distThreshold)
distThreshold
area of the ball
region specified by regionPivot
and regionRadius
.
The distThreshold
is the maximal distance that an object from this region can be outside the specified region.
If the threshold is zero, the this region must be fully within the specified region.
If the two regions do not even touch, this method returns false whatever the value of the threshold is.
regionPivot
- the pivot (center) of the ball region to get the coverage forregionRadius
- the radius of the ball region to get the coverage fordistThreshold
- the threshold distance value on the non-overlaping area
public int getSize()
getSize
in class LocalAbstractObject
public boolean dataEquals(java.lang.Object obj)
dataEquals
in class LocalAbstractObject
obj
- the reference object with which to compare.
true
if this object is the same as the obj
argument; false
otherwise.public int dataHashCode()
dataHashCode
in class LocalAbstractObject
public LocalAbstractObject cloneRandomlyModify(java.lang.Object... args) throws java.lang.UnsupportedOperationException
cloneRandomlyModify
in class LocalAbstractObject
args
- the value is ignored
java.lang.UnsupportedOperationException
- always
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |