messif.buckets.split
Class BucketBallRegion

java.lang.Object
  extended by messif.objects.UniqueID
      extended by messif.objects.AbstractObject
          extended by messif.objects.LocalAbstractObject
              extended by messif.objects.BallRegion
                  extended by messif.buckets.split.BucketBallRegion
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<UniqueID>, BucketFilter, BucketFilterAfterAdd, BucketFilterAfterRemove, Clearable

public class BucketBallRegion
extends BallRegion
implements BucketFilterAfterAdd, BucketFilterAfterRemove

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class messif.objects.LocalAbstractObject
LocalAbstractObject.DataEqualObject
 
Field Summary
protected  LocalBucket bucket
          The bucket on which this ball region should be maintained
protected  boolean needsAdjusting
          The flag if there was a modification to bucket
 
Fields inherited from class messif.objects.BallRegion
pivot, radius
 
Fields inherited from class messif.objects.LocalAbstractObject
counterDistanceComputations, counterLowerBoundDistanceComputations, counterUpperBoundDistanceComputations, MAX_DISTANCE, MIN_DISTANCE, suppData, UNKNOWN_DISTANCE
 
Constructor Summary
BucketBallRegion(LocalBucket bucket)
          Creates a new instance of BucketBallRegion.
BucketBallRegion(LocalBucket bucket, boolean registerAsFilter)
          Creates a new instance of BucketBallRegion.
BucketBallRegion(LocalBucket bucket, boolean registerAsFilter, LocalAbstractObject pivot)
          Creates a new instance of BucketBallRegion.
BucketBallRegion(LocalBucket bucket, boolean registerAsFilter, LocalAbstractObject pivot, float radius)
          Creates a new instance of BucketBallRegion with specified pivot and radius.
 
Method Summary
 void adjustRadius()
          Adjust the radius according to objects in the underlying bucket.
 void filterAfterAdd(LocalAbstractObject object, LocalBucket bucket)
          Adjust this ball region whenever an object is inserted into a bucket.
 void filterAfterRemove(LocalAbstractObject object, LocalBucket bucket)
          Filter object after its removal from a bucket.
 LocalBucket getBucket()
          Returns the bucket associated with this ball region.
 float getRadius()
          Returns current radius of this ball region.
 boolean needsAdjusting()
          Returns true if the underlying bucket has changed without adjusting the radius.
 void setPivot(LocalAbstractObject pivot, boolean updateRadius)
          Sets the pivot for this ball region.
 void setRadius(float radius)
          Sets the radius for this ball region.
 
Methods inherited from class messif.objects.BallRegion
cloneRandomlyModify, dataEquals, dataHashCode, getDistanceImpl, getDistanceRegion, getDistanceRegion, getDistanceRegionImpl, getDistanceRegionImpl, getOverlapWith, getPivot, getSize, isCoveredByRegion, isCoveringRegion, writeData
 
Methods inherited from class messif.objects.LocalAbstractObject
binarySerialize, chainDestroy, chainFilter, clearSurplusData, clone, clone, create, create, createMetaDistancesHolder, excludeUsingPrecompDist, getBinarySize, getDistance, getDistance, getDistance, getDistanceFilter, getDistanceFilter, getDistanceFilter, getDistanceLowerBound, getDistanceUpperBound, getMaxDistance, getNormDistance, getRandomChar, getRandomNormal, includeUsingPrecompDist, readObjectComments, unchainFilter, write, write
 
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

bucket

protected final LocalBucket bucket
The bucket on which this ball region should be maintained


needsAdjusting

protected boolean needsAdjusting
The flag if there was a modification to bucket

Constructor Detail

BucketBallRegion

public BucketBallRegion(LocalBucket bucket)
Creates a new instance of BucketBallRegion.

Parameters:
bucket - the bucket on which the ball region should be maintained

BucketBallRegion

public BucketBallRegion(LocalBucket bucket,
                        boolean registerAsFilter)
Creates a new instance of BucketBallRegion.

Parameters:
bucket - the bucket on which the ball region should be maintained
registerAsFilter - specifies if the automatic registration as bucket filter is desirable

BucketBallRegion

public BucketBallRegion(LocalBucket bucket,
                        boolean registerAsFilter,
                        LocalAbstractObject pivot)
Creates a new instance of BucketBallRegion.

Parameters:
bucket - the bucket on which the ball region should be maintained
registerAsFilter - specifies if the automatic registration as bucket filter is desirable
pivot - the pivot for the new ball region

BucketBallRegion

public BucketBallRegion(LocalBucket bucket,
                        boolean registerAsFilter,
                        LocalAbstractObject pivot,
                        float radius)
Creates a new instance of BucketBallRegion with specified pivot and radius.

Parameters:
bucket - the bucket on which the ball region should be maintained
registerAsFilter - specifies if the automatic registration as bucket filter is desirable
pivot - the pivot for the new ball region
radius - the radius for the new ball region
Method Detail

getBucket

public LocalBucket getBucket()
Returns the bucket associated with this ball region.

Returns:
the bucket associated with this ball region

getRadius

public float getRadius()
Returns current radius of this ball region.

Overrides:
getRadius in class BallRegion
Returns:
current radius of this ball region

setRadius

public void setRadius(float radius)
               throws java.lang.IllegalArgumentException
Sets the radius for this ball region.

Overrides:
setRadius in class BallRegion
Parameters:
radius - the new radius
Throws:
java.lang.IllegalArgumentException - if the specified radius is negative

setPivot

public void setPivot(LocalAbstractObject pivot,
                     boolean updateRadius)
Sets the pivot for this ball region. Note, that the radius is set to LocalAbstractObject.MAX_DISTANCE if updateRadius is true.

Overrides:
setPivot in class BallRegion
Parameters:
pivot - the new pivot
updateRadius - specifies whether to update the region's radius or not

needsAdjusting

public boolean needsAdjusting()
Returns true if the underlying bucket has changed without adjusting the radius. However, the returned value is just a hint and can be inaccurate.

Returns:
true if the underlying bucket has changed without adjusting the radius

adjustRadius

public void adjustRadius()
Adjust the radius according to objects in the underlying bucket.


filterAfterAdd

public void filterAfterAdd(LocalAbstractObject object,
                           LocalBucket bucket)
Adjust this ball region whenever an object is inserted into a bucket.

Specified by:
filterAfterAdd in interface BucketFilterAfterAdd
Parameters:
object - the inserted object
bucket - the bucket where the object will was inserted

filterAfterRemove

public void filterAfterRemove(LocalAbstractObject object,
                              LocalBucket bucket)
Description copied from interface: BucketFilterAfterRemove
Filter object after its removal from a bucket.

Specified by:
filterAfterRemove in interface BucketFilterAfterRemove
Parameters:
object - the removed object
bucket - bucket, where the object has been stored