Class IntSetUtil


  • public class IntSetUtil
    extends java.lang.Object
    Utilities for dealing with IntSets
    • Field Detail

      • INT_SET_FACTORY_CONFIG_PROPERTY_NAME

        public static final java.lang.String INT_SET_FACTORY_CONFIG_PROPERTY_NAME
        See Also:
        Constant Field Values
    • Method Detail

      • make

        public static IntSet make​(java.util.Set<java.lang.Integer> x)
      • makeMutableCopy

        public static MutableIntSet makeMutableCopy​(IntSet set)
                                             throws java.lang.IllegalArgumentException,
                                                    UnimplementedError
        This method constructs an appropriate mutable copy of set.
        Returns:
        a new MutableIntSet object with the same value as set
        Throws:
        UnimplementedError - if we haven't supported the set type yet.
        java.lang.IllegalArgumentException - if set == null
      • diff

        public static IntSet diff​(IntSet A,
                                  IntSet B)
        Compute the asymmetric difference of two sets, a \ b.
      • removeAll

        public static MutableIntSet removeAll​(MutableIntSet A,
                                              IntSet B)
                                       throws java.lang.IllegalArgumentException
        Subtract two sets, i.e. a = a \ b.
        Throws:
        java.lang.IllegalArgumentException - if B == null
      • binarySearch

        public static int binarySearch​(int[] data,
                                       int key,
                                       int low,
                                       int high)
                                throws java.lang.IllegalArgumentException
        Returns:
        index \in [low,high] s.t. data[index] = key, or -1 if not found
        Throws:
        java.lang.IllegalArgumentException
      • getDefaultIntSetFactory

        public static MutableIntSetFactory<?> getDefaultIntSetFactory()
        Returns:
        Returns the defaultIntSetFactory.
      • setDefaultIntSetFactory

        public static void setDefaultIntSetFactory​(MutableIntSetFactory<?> defaultIntSetFactory)
        Parameters:
        defaultIntSetFactory - The defaultIntSetFactory to set.
      • add

        public static IntSet add​(IntSet s,
                                 int j)
                          throws java.lang.IllegalArgumentException
        Returns:
        a new sparse int set which adds j to s
        Throws:
        java.lang.IllegalArgumentException - if s == null
      • toArray

        public static int[] toArray​(IntSet s)