messif.buckets.split.impl
Class SplitPolicyGeneralizedHyperplane

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

public class SplitPolicyGeneralizedHyperplane
extends SplitPolicy

This class defines a policy for bucket splitting based on the generalized hyperplane partitioning. The objects are split according to two pivots - object closer to the left pivot stays while the one closer to the right pivot moves.


Nested Class Summary
 
Nested classes/interfaces inherited from class messif.buckets.split.SplitPolicy
SplitPolicy.ParameterField
 
Field Summary
protected  float halfPivotDistance
          The distance between the pivots divided by two.
protected  float leftDist
          The distance to the left pivot computed by the last call to match(Region).
protected  LocalAbstractObject leftPivot
          Policy parameter left pivot
static int PART_ID_LEFT
          Identification of the left partition.
static int PART_ID_RIGHT
          Identification of the right partition.
protected  float rightDist
          The distance to the right pivot computed by the last call to match(Region).
protected  LocalAbstractObject rightPivot
          Policy parameter right pivot
 
Fields inherited from class messif.buckets.split.SplitPolicy
PART_ID_ANY
 
Constructor Summary
SplitPolicyGeneralizedHyperplane()
          Creates a new instance of SplitPolicyBallPartitioning
 
Method Summary
 float getDistanceToLeftPivot()
          Returns the distance to the left pivot which might have been computed by the last call to match(Region).
 float getDistanceToRightPivot()
          Returns the distance to the right pivot which might have been computed by the last call to match(Region).
 LocalAbstractObject getLeftPivot()
          Returns the first pivot for generalized hyperplane partitioning.
 int getPartitionsCount()
          Returns the number of partitions of this policy.
 LocalAbstractObject getRightPivot()
          Returns the second pivot for generalized hyperplane partitioning.
 int match(BallRegion region)
          Returns the group (partition) to which the whole ball region belongs.
 int match(LocalAbstractObject object)
          Returns 0 for objects near the left pivot defined by this policy (or exactly in the middle) and 1 for objects near the right pivot.
 void setLeftPivot(LocalAbstractObject leftPivot)
          Sets the first pivot for generalized hyperplane partitioning.
 void setParameter(java.lang.String parameter, java.lang.Object value)
          Use this method to set the policy parameter.
 void setRightPivot(LocalAbstractObject rightPivot)
          Sets the second pivot for generalized hyperplane partitioning.
 
Methods inherited from class messif.buckets.split.SplitPolicy
getBucketBallRegion, getParameter, getParameterNames, getParameterType, isComplete, isParameterFilled, isParameterLocked, lockParameter, match
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

leftPivot

protected LocalAbstractObject leftPivot
Policy parameter left pivot


rightPivot

protected LocalAbstractObject rightPivot
Policy parameter right pivot


halfPivotDistance

protected float halfPivotDistance
The distance between the pivots divided by two. If both the pivots are not set yet, LocalAbstractObject.UNKNOWN_DISTANCE is held.


leftDist

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


rightDist

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


PART_ID_LEFT

public static final int PART_ID_LEFT
Identification of the left partition. Equal to 0

See Also:
Constant Field Values

PART_ID_RIGHT

public static final int PART_ID_RIGHT
Identification of the right partition. Equal to 1

See Also:
Constant Field Values
Constructor Detail

SplitPolicyGeneralizedHyperplane

public SplitPolicyGeneralizedHyperplane()
Creates a new instance of SplitPolicyBallPartitioning

Method Detail

setLeftPivot

public void setLeftPivot(LocalAbstractObject leftPivot)
Sets the first pivot for generalized hyperplane partitioning.

Parameters:
leftPivot - the pivot

getLeftPivot

public LocalAbstractObject getLeftPivot()
Returns the first pivot for generalized hyperplane partitioning.

Returns:
the first pivot for generalized hyperplane partitioning

setRightPivot

public void setRightPivot(LocalAbstractObject rightPivot)
Sets the second pivot for generalized hyperplane partitioning.

Parameters:
rightPivot - the pivot

getRightPivot

public LocalAbstractObject getRightPivot()
Returns the second pivot for generalized hyperplane partitioning.

Returns:
the second pivot for generalized hyperplane partitioning

setParameter

public void setParameter(java.lang.String parameter,
                         java.lang.Object value)
                  throws java.lang.IllegalStateException,
                         java.util.NoSuchElementException,
                         java.lang.NullPointerException
Use this method to set the policy parameter.

Overrides:
setParameter in class SplitPolicy
Parameters:
parameter - the name of the policy parameter
value - new value for the parameter
Throws:
java.lang.IllegalStateException - if the specified parameter is locked
java.util.NoSuchElementException - if there is no parameter for the specified name
java.lang.NullPointerException - if the specified value is null

getDistanceToLeftPivot

public float getDistanceToLeftPivot()
Returns the distance to the left 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 left pivot

getDistanceToRightPivot

public float getDistanceToRightPivot()
Returns the distance to the right 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 right pivot

match

public int match(LocalAbstractObject object)
Returns 0 for objects near the left pivot defined by this policy (or exactly in the middle) and 1 for objects near the right pivot.

Specified by:
match in interface ObjectMatcher<LocalAbstractObject>
Specified by:
match in class SplitPolicy
Parameters:
object - an object that is tested for partition
Returns:
0 for objects near the left pivot defined by this policy (or exactly in the middle) and 1 for objects near the right pivot

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 group (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(messif.objects.LocalAbstractObject) method.

Specified by:
match in class SplitPolicy
Parameters:
region - a ball region that is tested for the matching condition
Returns:
the group (partition) to which the whole ball region belongs or -1 if it is uncertain