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 Details

  • Method Details

    • newBundle

      public static ConstraintSplitterMapper newBundle()
      Make a new bridge and register every splitters supported by default.
      Returns:
      the fulfilled bridge.
    • register

      public boolean register​(ConstraintSplitter<? extends Constraint> ccb)
      Register a splitter.
      Parameters:
      ccb - the splitter to register
      Returns:
      true if no splitter previously registered for the given constraint was deleted
    • unRegister

      public boolean unRegister​(Class<? extends Constraint> c)
      Un-register the splitter associated to a given Constraint if exists.
      Parameters:
      c - the class of the Constraint to un-register
      Returns:
      true if a builder was registered
    • isRegistered

      public boolean isRegistered​(Class<? extends Constraint> c)
      Check if a ConstraintSplitter is registered for a given Constraint.
      Parameters:
      c - the constraint to check
      Returns:
      true iff a builder is registered
    • getSplitter

      public ConstraintSplitter<? extends Constraint> getSplitter​(Class<? extends Constraint> c)
      Get the splitter associated to a Constraint.
      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 given Constraint using the associated splitter, if exists.
      Parameters:
      c - the constraint to map
      i - the original instance to split
      partitions - the partitions splitting the original instance
      vmPartition - the partition associated to each VM
      nodePosition - the partition associated to each node
      Returns:
      false iff this leads to a problem without solutions.