Class BitSet<T>


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

      Constructors 
      Constructor Description
      BitSet​(OrdinalSetMapping<T> map)
      Constructor: create an empty set corresponding to a given mapping
    • Constructor Detail

      • BitSet

        public BitSet​(OrdinalSetMapping<T> map)
        Constructor: create an empty set corresponding to a given mapping
        Throws:
        java.lang.IllegalArgumentException - if map is null
    • Method Detail

      • createBitSet

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

        public void addAll​(BitSet<?> B)
        Add all elements in bitset B to this bit set
        Throws:
        java.lang.IllegalArgumentException - if B is null
      • 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 java.lang.String toString()
        Overrides:
        toString in class java.lang.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:
        java.lang.IllegalArgumentException - if other is null
      • sameBits

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

        public java.util.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:
        java.lang.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:
        java.lang.IllegalArgumentException - if other is null
      • isEmpty

        public boolean isEmpty()