public class BallRegion extends LocalAbstractObject
LocalAbstractObject.DataEqualObject, LocalAbstractObject.TextStreamFactory<T extends LocalAbstractObject>, LocalAbstractObject.TrivialDistanceFunction
Modifier and Type | Field and Description |
---|---|
protected LocalAbstractObject |
pivot
Center of the ball region
|
protected float |
radius
Radius of this region
|
counterDistanceComputations, counterLowerBoundDistanceComputations, counterPrecomputedDistanceSavings, counterUpperBoundDistanceComputations, MAX_DISTANCE, MIN_DISTANCE, suppData, trivialDistanceFunction, UNKNOWN_DISTANCE
Constructor and Description |
---|
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
|
Modifier and Type | Method and Description |
---|---|
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.
|
binarySerialize, clearSurplusData, clone, clone, create, create, createMetaDistancesHolder, excludeUsingPrecompDist, getBinarySize, getDistance, getDistance, getDistance, getDistanceFilter, getDistanceFilter, getDistanceFilter, getDistanceFilter, getDistanceLowerBound, getDistanceLowerBoundImpl, getDistanceStorePrecomputed, getDistanceStorePrecomputed, getDistanceStorePrecomputed, getDistanceUpperBound, getDistanceUpperBoundImpl, getFieldsForNames, getMaxDistance, 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, toString
protected LocalAbstractObject pivot
protected float radius
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 fromjava.io.IOException
- if an error occurs during reading from the streamjava.lang.NumberFormatException
- if the stream's object is not valid ball regionjava.lang.IllegalArgumentException
- if the stream's object is not valid ball regionjava.lang.ClassNotFoundException
- if the stream's object is not valid ball regionprotected void writeData(java.io.OutputStream stream) throws java.io.IOException
writeData
in class LocalAbstractObject
stream
- the stream to store this object tojava.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 radiusjava.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 distancepublic float getDistanceRegion(BallRegion region, float distThreshold)
region
- the ball region to compute distance todistThreshold
- the threshold value on the distancepublic 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 distanceprotected float getDistanceRegionImpl(BallRegion region, float distThreshold)
region
- the ball region to compute distance todistThreshold
- the threshold value on the distanceprotected float getDistanceRegionImpl(float regionsPivotDistance, float regionRadius)
regionsPivotDistance
- the distance of the regions' pivotsregionRadius
- the radius of the ball region to compute distance topublic 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 forpublic 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 areapublic 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 areapublic 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 ignoredjava.lang.UnsupportedOperationException
- always