Class BitSetList

    • Field Detail

      • wrapped

        private BitSet wrapped
      • size

        private int size
    • Constructor Detail

      • BitSetList

        public BitSetList()
        Creates a new BitSetList instance.
      • BitSetList

        public BitSetList​(Collection<? extends Integer> coll)
        Creates a new BitSetList instance.
        Parameters:
        coll - a collection which may not contain null pointers.
        Throws:
        NullPointerException - if coll contains a null pointer.
        IllegalArgumentException - if coll contains an Integer object other than 0 or 1.
      • BitSetList

        public BitSetList​(int initialCapacity)
    • Method Detail

      • bool2int

        private static Integer bool2int​(boolean bool)
        Returns the C-representation of the given boolean as an int.
        Parameters:
        bool - a boolean value.
        Returns:
        an int representation of bool:
        • 1 if bool == true .
        • 0 if bool == false.
        See Also:
        int2bool(int)
      • int2bool

        private static boolean int2bool​(int num)
        Converts the given C-style-representation of a boolean.
        Returns:
        an bool representation of num:
        • true if num == 1.
        • false if num == 0.
        Throws:
        IllegalArgumentException - if num is neither 0 nor 1.
        See Also:
        bool2int(boolean)
      • cardinality

        public int cardinality()
      • sizeInternally

        public int sizeInternally()
      • length1

        public int length1()
        Returns the "logical size" of this List: The index of the highest digit 1 in the List plus one. Returns zero if the List contains 0's only.
        Returns:
        the logical size of this List.
      • setW

        public void setW​(int index)
      • hashCode

        public int hashCode()
        Returns the hash code value for this cyclic list. The hash code of a list is defined to be the result of the following calculation:
          hashCode = 1;
          Iterator i = list.iterator();
          while (i.hasNext()) {
              Object obj = i.next();
              hashCode = 31*hashCode + (obj==null ? 0 : obj.hashCode());
          }
         
        This ensures that list1.equals(list2) implies that list1.hashCode()==list2.hashCode() for any two lists, list1 and list2, as required by the general contract of Object.hashCode.

        Note that this list does not allow null-elements and the hash code of an element is its value.

        Specified by:
        hashCode in interface Collection<Integer>
        Specified by:
        hashCode in interface List<Integer>
        Overrides:
        hashCode in class AbstractList<Integer>
        Returns:
        the hash code value for this list.
        See Also:
        List.hashCode(), Object.equals(Object), equals(Object)
      • add

        public void add​(int index,
                        Integer integer)
        Describe add method here.
        Specified by:
        add in interface List<Integer>
        Overrides:
        add in class AbstractList<Integer>
        Parameters:
        index - an int value
        integer - an Integer value
      • get

        public Integer get​(int index)
        Describe get method here.
        Specified by:
        get in interface List<Integer>
        Specified by:
        get in class AbstractList<Integer>
        Parameters:
        index - an int value
        Returns:
        an Object value
      • set

        public Integer set​(int index,
                           Integer integer)
        Describe set method here.
        Specified by:
        set in interface List<Integer>
        Overrides:
        set in class AbstractList<Integer>
        Parameters:
        index - an int value
        integer - an Object value
        Returns:
        an Object value