Class SetFactory


  • public class SetFactory
    extends Object
    Factory for creating sets
    Since:
    Oct 2012
    Author:
    Jean-Guillaume Fages
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static boolean HARD_CODED  
    • Constructor Summary

      Constructors 
      Constructor Description
      SetFactory()  
    • Field Detail

      • HARD_CODED

        public static boolean HARD_CODED
    • Constructor Detail

      • SetFactory

        public SetFactory()
    • Method Detail

      • makeStoredSet

        public static ISet makeStoredSet​(SetType type,
                                         int offSet,
                                         Model model)
        Creates a stored set of integers greater or equal than offSet Such a set is restored after a backtrack
        Parameters:
        type - of set data structure
        offSet - smallest value allowed in the set (possibly < 0)
        model - model providing the backtracking environment
        Returns:
        a new set which can be restored upon backtrack
      • makeSet

        public static ISet makeSet​(SetType type,
                                   int offSet)
        Creates an empty set of integers greater or equal than offSet
        Parameters:
        type - implementation type
        offSet - smallest value allowed in the set (possibly < 0)
        Returns:
        a new set
      • makeRangeSet

        public static ISet makeRangeSet()
        Creates a set based on an ordered list of ranges
        Returns:
        a new set
      • makeLinkedList

        public static ISet makeLinkedList()
        Creates a set based on a linked list appropriate when the set has only a few elements
        Returns:
        a new set
      • makeBitSet

        public static ISet makeBitSet​(int offSet)
        Creates a set of integers, based on an offseted BitSet, Supports integers greater or equal than offSet
        Parameters:
        offSet - smallest value allowed in the set (possibly < 0)
        Returns:
        a new set
      • makeBipartiteSet

        public static ISet makeBipartiteSet​(int offSet)
        Creates a set of integers, based on an offseted bipartite set, Supports integers greater or equal than offSet Optimal complexity
        Parameters:
        offSet - smallest value allowed in the set (possibly < 0)
        Returns:
        a new bipartite set
      • makeSmallBipartiteSet

        public static ISet makeSmallBipartiteSet()
        Creates a set of integers, based on an offseted bipartite set, for small sets (arraylist inside to consume less memory)
        Returns:
        a new bipartite set
      • makeConstantSet

        public static ISet makeConstantSet​(int[] cst)
        Creates a fixed set of integers, equal to cst
        Parameters:
        cst - set value
        Returns:
        a fixed set
      • makeConstantSet

        public static ISet makeConstantSet​(int lb,
                                           int ub)
        Creates a constant set of integers represented with an interval [lb, ub]
        Returns:
        a new interval (constant)