messif.pivotselection
Class CoveragePivotChooser.Ball

java.lang.Object
  extended by messif.pivotselection.CoveragePivotChooser.Ball
All Implemented Interfaces:
java.lang.Comparable<CoveragePivotChooser.Ball>
Enclosing class:
CoveragePivotChooser

protected class CoveragePivotChooser.Ball
extends java.lang.Object
implements java.lang.Comparable<CoveragePivotChooser.Ball>

Class encapsulating info about each cluster (ball region).


Field Summary
protected  int objects
          Number of objects covered by this ball and its neighborhood of size of clusterRadius
protected  LocalAbstractObject pivot
          Center of the ball
protected  int pivotIndex
          Index of the center in the precomputed distances cache
 
Constructor Summary
CoveragePivotChooser.Ball(LocalAbstractObject pivot, int pivotIndex, CoveragePivotChooser.PrecomputedDistances pd)
          Create a new Ball and compute the number of objects covered by the ball and its neighbohood, see objects for more information.
 
Method Summary
 int compareTo(CoveragePivotChooser.Ball b)
           
 int getObjects()
          Number of objects covered by this ball and its close neighborhood.
 LocalAbstractObject getPivot()
          Center of this ball.
 int getPivotIndex()
          Index of the enter of this ball in the precomputed distances cache
 boolean intersectsWith(CoveragePivotChooser.Ball b, CoveragePivotChooser.PrecomputedDistances pd)
          Checks if this ball and the passed ball intersect or not.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pivot

protected final LocalAbstractObject pivot
Center of the ball


pivotIndex

protected final int pivotIndex
Index of the center in the precomputed distances cache


objects

protected int objects
Number of objects covered by this ball and its neighborhood of size of clusterRadius

Constructor Detail

CoveragePivotChooser.Ball

public CoveragePivotChooser.Ball(LocalAbstractObject pivot,
                                 int pivotIndex,
                                 CoveragePivotChooser.PrecomputedDistances pd)
Create a new Ball and compute the number of objects covered by the ball and its neighbohood, see objects for more information.

Parameters:
pivot - object as the cluster (ball) center
pivotIndex - index of this pivot in precomputed distance cache
pd - cache of precomputed distance used to compute the number of objects covered by the ball
Method Detail

getObjects

public int getObjects()
Number of objects covered by this ball and its close neighborhood. In particular, the ball centered at pivot with the radius set to double value of CoveragePivotChooser.clusterRadius is used for this computation.

Returns:
number of objects

getPivot

public LocalAbstractObject getPivot()
Center of this ball.

Returns:
object that is the center of this ball

getPivotIndex

public int getPivotIndex()
Index of the enter of this ball in the precomputed distances cache

Returns:
index of the ball's center

compareTo

public int compareTo(CoveragePivotChooser.Ball b)
Specified by:
compareTo in interface java.lang.Comparable<CoveragePivotChooser.Ball>

intersectsWith

public boolean intersectsWith(CoveragePivotChooser.Ball b,
                              CoveragePivotChooser.PrecomputedDistances pd)
Checks if this ball and the passed ball intersect or not.

Parameters:
b - ball to check
pd - cache of precomputed distance used to obtain inter-ball-centers' distance
Returns:
true if the balls intersect, oterwise false.