Class BitSet<T>


  • public final class BitSet<T>
    extends Object
    A bit set is a set of elements, each of which corresponds to a unique integer from [0,MAX].
    • Method Detail

      • createBitSet

        public static <T> BitSet<T> createBitSet​(BitSet<T> B)
      • addAll

        public void addAll​(BitVector B)
        Add all bits in BitVector B to this bit set
      • add

        public void add​(T o)
        Add an object to this bit set.
      • clear

        public void clear​(T o)
        Remove an object from this bit set.
        Parameters:
        o - the object to remove
      • contains

        public boolean contains​(T o)
        Does this set contain a certain object?
      • toString

        public String toString()
        Overrides:
        toString in class Object
        Returns:
        a String representation
      • copyBits

        public void copyBits​(BitSet<T> other)
        Method copy. Copies the bits in the bit vector, but only assigns the object map. No need to create a new object/bit bijection object.
        Throws:
        IllegalArgumentException - if other is null
      • sameBits

        public boolean sameBits​(BitSet<?> other)
        Does this object hold the same bits as other?
        Throws:
        IllegalArgumentException - if other is null
      • iterator

        public Iterator<T> iterator()
        Not very efficient.
      • size

        public int size()
      • length

        public int length()
      • clearAll

        public void clearAll()
        Set all the bits to 0.
      • setAll

        public void setAll()
        Set all the bits to 1.
      • intersect

        public void intersect​(BitSet<?> other)
        Perform intersection of two bitsets
        Parameters:
        other - the other bitset in the operation
        Throws:
        IllegalArgumentException - if other is null
      • difference

        public void difference​(BitSet<T> other)
        Perform the difference of two bit sets
        Parameters:
        other - the other bitset in the operation
        Throws:
        IllegalArgumentException - if other is null
      • isEmpty

        public boolean isEmpty()