Class ConstraintSplitterMapper
java.lang.Object
org.btrplace.scheduler.runner.disjoint.splitter.ConstraintSplitterMapper
public class ConstraintSplitterMapper extends Object
A customizable bridge to indicate which
ConstraintSplitter
to use
for a given constraint.- Author:
- Fabien Hermenier
-
Constructor Summary
Constructors Constructor Description ConstraintSplitterMapper()
Make a new bridge. -
Method Summary
Modifier and Type Method Description ConstraintSplitter<? extends Constraint>
getSplitter(Class<? extends Constraint> c)
Get the splitter associated to aConstraint
.boolean
isRegistered(Class<? extends Constraint> c)
Check if aConstraintSplitter
is registered for a givenConstraint
.static ConstraintSplitterMapper
newBundle()
Make a new bridge and register every splitters supported by default.boolean
register(ConstraintSplitter<? extends Constraint> ccb)
Register a splitter.boolean
split(Constraint c, Instance i, List<Instance> partitions, gnu.trove.map.hash.TIntIntHashMap vmPartition, gnu.trove.map.hash.TIntIntHashMap nodePosition)
Split a givenConstraint
using the associated splitter, if exists.boolean
unRegister(Class<? extends Constraint> c)
Un-register the splitter associated to a givenConstraint
if exists.
-
Constructor Details
-
ConstraintSplitterMapper
public ConstraintSplitterMapper()Make a new bridge.
-
-
Method Details
-
newBundle
Make a new bridge and register every splitters supported by default.- Returns:
- the fulfilled bridge.
-
register
Register a splitter.- Parameters:
ccb
- the splitter to register- Returns:
true
if no splitter previously registered for the given constraint was deleted
-
unRegister
Un-register the splitter associated to a givenConstraint
if exists.- Parameters:
c
- the class of theConstraint
to un-register- Returns:
true
if a builder was registered
-
isRegistered
Check if aConstraintSplitter
is registered for a givenConstraint
.- Parameters:
c
- the constraint to check- Returns:
true
iff a builder is registered
-
getSplitter
Get the splitter associated to aConstraint
.- Parameters:
c
- the constraint- Returns:
- the associated builder if exists.
null
otherwise
-
split
public boolean split(Constraint c, Instance i, List<Instance> partitions, gnu.trove.map.hash.TIntIntHashMap vmPartition, gnu.trove.map.hash.TIntIntHashMap nodePosition)Split a givenConstraint
using the associated splitter, if exists.- Parameters:
c
- the constraint to mapi
- the original instance to splitpartitions
- the partitions splitting the original instancevmPartition
- the partition associated to each VMnodePosition
- the partition associated to each node- Returns:
false
iff this leads to a problem without solutions.
-