Class Set_Std_Swap

  • All Implemented Interfaces:
    Iterable<Integer>, ISet

    public class Set_Std_Swap
    extends Set_Swap
    Set of integers based on BipartiteSet implementation BEWARE : CANNOT BOTH ADD AND REMOVE ELEMENTS DURING SEARCH (add only or remove only) add : O(1) testPresence: O(1) remove: O(1) iteration : O(m)
    Author:
    : Jean-Guillaume Fages
    • Constructor Detail

      • Set_Std_Swap

        public Set_Std_Swap​(IEnvironment e,
                            int offSet)
        Creates an empty bipartite set having numbers greater or equal than offSet (possibly < 0)
        Parameters:
        e - backtracking environment
        offSet - smallest allowed value in this set (possibly < 0)
    • Method Detail

      • size

        public int size()
        Specified by:
        size in interface ISet
        Overrides:
        size in class Set_Swap
        Returns:
        the number of elements in the set
      • setSize

        protected void setSize​(int s)
        Overrides:
        setSize in class Set_Swap
      • addSize

        protected void addSize​(int delta)
        Overrides:
        addSize in class Set_Swap