messif.buckets.split.impl
Class SplitPolicyMultiWayBallPartitioning

java.lang.Object
  extended by messif.buckets.split.SplitPolicy
      extended by messif.buckets.split.impl.SplitPolicyMultiWayBallPartitioning
All Implemented Interfaces:
ObjectMatcher<LocalAbstractObject>

public class SplitPolicyMultiWayBallPartitioning
extends SplitPolicy

This class is a multi-way ball-partitioning policy for bucket splitting.

The policy is fully defined by:
LocalAbstractObject pivot
float[] list of radii

The number of partitions produced by this policy is defined by the length of radii array incremented by one.

The values of radii define the boundaries between two partitiongs. So, the first partition will contain objects within this range of distances from pivot: [0,radii[0]]. The second partition will contain objects within this range of distances from pivot: (radii[0],radii[1]]. Finally, the last partition will contain objects within this range of distances from pivot: (radii[last],infinity). The matcher returns the index of the corresponding partition starting from zero.


Nested Class Summary
 
Nested classes/interfaces inherited from class messif.buckets.split.SplitPolicy
SplitPolicy.ParameterField
 
Field Summary
protected  float dist
          The distance to the pivot computed by the last call to match(Region).
protected  LocalAbstractObject pivot
          Policy parameter pivot
protected  float[] radii
          Policy parameter radius
 
Fields inherited from class messif.buckets.split.SplitPolicy
PART_ID_ANY
 
Constructor Summary
SplitPolicyMultiWayBallPartitioning()
          Creates a new instance of SplitPolicyBallPartitioning
 
Method Summary
 float getDistanceToPivot()
          Returns the distance to the pivot which might have been computed by the last call to match(Region).
 int getPartitionsCount()
          Returns the number of partitions of this policy.
 LocalAbstractObject getPivot()
          Returns the pivot for ball partitioning.
 float[] getRadii()
          Returns the array of radii used for the multi-way ball partitioning.
 int match(BallRegion region)
          Returns the index of partition to which the whole ball region belongs.
 int match(LocalAbstractObject object)
          Returns the index of partition to which the object belongs.
 void setPivot(LocalAbstractObject pivot)
          Sets the pivot for ball partitioning.
 void setRadii(float[] radii)
          Sets the radii for multi-way ball partitioning.
 
Methods inherited from class messif.buckets.split.SplitPolicy
getBucketBallRegion, getParameter, getParameterNames, getParameterType, isComplete, isParameterFilled, isParameterLocked, lockParameter, match, setParameter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pivot

protected LocalAbstractObject pivot
Policy parameter pivot


radii

protected float[] radii
Policy parameter radius


dist

protected float dist
The distance to the pivot computed by the last call to match(Region).

Constructor Detail

SplitPolicyMultiWayBallPartitioning

public SplitPolicyMultiWayBallPartitioning()
Creates a new instance of SplitPolicyBallPartitioning

Method Detail

setPivot

public void setPivot(LocalAbstractObject pivot)
Sets the pivot for ball partitioning.

Parameters:
pivot - the pivot

getPivot

public LocalAbstractObject getPivot()
Returns the pivot for ball partitioning.

Returns:
the pivot for ball partitioning

setRadii

public void setRadii(float[] radii)
Sets the radii for multi-way ball partitioning.

Parameters:
radii - the array of radii

getRadii

public float[] getRadii()
Returns the array of radii used for the multi-way ball partitioning.

Returns:
the array of radii

getDistanceToPivot

public float getDistanceToPivot()
Returns the distance to the pivot which might have been computed by the last call to match(Region). If it is equal to LocalAbstractObject.UNKNOWN_DISTANCE, the distance was not evaluated.

Returns:
the distance to the pivot

match

public int match(LocalAbstractObject object)
Returns the index of partition to which the object belongs.

Specified by:
match in interface ObjectMatcher<LocalAbstractObject>
Specified by:
match in class SplitPolicy
Parameters:
object - an object that is tested for partition
Returns:
partition identification (index)

getPartitionsCount

public int getPartitionsCount()
Returns the number of partitions of this policy.

Specified by:
getPartitionsCount in class SplitPolicy
Returns:
the number of partitions of this policy

match

public int match(BallRegion region)
Returns the index of partition to which the whole ball region belongs. Returns -1 if not all objects from the specified ball region fall into just one partition or if this policy cannot decide. In that case, the ball region must be searched one object by one using the match(LocalAbstractObject) method.

Specified by:
match in class SplitPolicy
Parameters:
region - a ball region that is tested for the matching condition
Returns:
the index of partition in which the ball region is contained completely or -1 if it is uncertain