|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmessif.buckets.split.SplitPolicy
public abstract class SplitPolicy
This class defines an abstract policy for bucket splitting.
The policy is fully defined by the internal parameters, e.g. a policy for ball partitioning
requires a pivot and a radius. Each policy implements the object matcher
that decides the target partition of a given object according to this policy.
Some (or all) parameters can be unspecified when the policy is instantiated and can be provided through
setParameter(java.lang.String, java.lang.Object)
method later. However, the match
method returns
UnsupportedOperationException
until all the parameters are fully specified, i.e.
isComplete()
returns true).
If desired, some parameters can be locked, so they can't be changed anymore.
Nested Class Summary | |
---|---|
protected static interface |
SplitPolicy.ParameterField
Annotation of split policy parameter field. |
Field Summary | |
---|---|
static int |
PART_ID_ANY
Identification of any partition (returned if a region cannot fit a single partition). |
Constructor Summary | |
---|---|
protected |
SplitPolicy()
Creates a new instance of SplitPolicy. |
Method Summary | |
---|---|
protected BucketBallRegion |
getBucketBallRegion(LocalBucket bucket)
Returns the BucketBallRegion associated with the specified bucket. |
java.lang.Object |
getParameter(java.lang.String parameter)
Returns the value of the specified parameter. |
java.util.Set<java.lang.String> |
getParameterNames()
Returns all parameter names for this policy. |
java.lang.Class<?> |
getParameterType(java.lang.String parameter)
Returns the type of the specified policy parameter. |
abstract int |
getPartitionsCount()
Returns the number of partitions of this policy. |
boolean |
isComplete()
Returns true if this policy has all the arguments necessary for a split defined. |
boolean |
isParameterFilled(java.lang.String parameter)
Returns true if the specified parameter has a value set. |
boolean |
isParameterLocked(java.lang.String parameter)
Returns true if the specified parameter is locked. |
void |
lockParameter(java.lang.String parameter)
Locks the specified policy parameter. |
abstract int |
match(BallRegion region)
Returns the group (partition) to which the whole ball region belongs. |
abstract int |
match(LocalAbstractObject object)
Returns the group (partition) to which a given object belongs. |
int |
match(LocalBucket bucket)
Returns the group (partition) to which the whole bucket belongs. |
void |
setParameter(java.lang.String parameter,
java.lang.Object value)
Use this method to set the policy parameter. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int PART_ID_ANY
-1
Constructor Detail |
---|
protected SplitPolicy()
Method Detail |
---|
public abstract int match(BallRegion region)
match(messif.objects.BallRegion)
method.
region
- a ball region that is tested for the matching condition
public abstract int match(LocalAbstractObject object)
match
in interface ObjectMatcher<LocalAbstractObject>
object
- an object that is tested for the matching condition
protected BucketBallRegion getBucketBallRegion(LocalBucket bucket) throws java.util.NoSuchElementException
BucketBallRegion
associated with the specified bucket.
It must be registered in the bucket as filter, otherwise a NoSuchElementException is thrown.
bucket
- the bucket to get the region for
BucketBallRegion
associated with bucket
java.util.NoSuchElementException
- if there was no ball region associatedpublic int match(LocalBucket bucket)
match(messif.objects.BallRegion)
method.
If there is no BucketBallRegion
registered in the bucket, -1 is returned.
bucket
- a bucket that is tested for the matching condition
public boolean isComplete()
public java.util.Set<java.lang.String> getParameterNames()
public void setParameter(java.lang.String parameter, java.lang.Object value) throws java.lang.IllegalStateException, java.util.NoSuchElementException, java.lang.NullPointerException
parameter
- the name of the policy parametervalue
- new value for the parameter
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 nullpublic java.lang.Object getParameter(java.lang.String parameter) throws java.lang.IllegalStateException, java.util.NoSuchElementException
parameter
- the name of the policy parameter
java.lang.IllegalStateException
- if the parameter is not filled yet
java.util.NoSuchElementException
- if there is no parameter for the specified namepublic boolean isParameterLocked(java.lang.String parameter) throws java.util.NoSuchElementException
parameter
- the name of the policy parameter
java.util.NoSuchElementException
- if there is no parameter for the specified namepublic void lockParameter(java.lang.String parameter) throws java.util.NoSuchElementException
setParameter(java.lang.String, java.lang.Object)
method anymore.
parameter
- the name of the policy parameter
java.util.NoSuchElementException
- if there is no parameter for the specified namepublic boolean isParameterFilled(java.lang.String parameter) throws java.util.NoSuchElementException
setParameter(java.lang.String, java.lang.Object)
was called for the specified parameter.
parameter
- the name of the policy parameter
java.util.NoSuchElementException
- if there is no parameter for the specified namepublic java.lang.Class<?> getParameterType(java.lang.String parameter) throws java.util.NoSuchElementException
parameter
- the name of the policy parameter
java.util.NoSuchElementException
- if there is no parameter for the specified namepublic abstract int getPartitionsCount()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |