Class BitVector

    • Constructor Detail

      • BitVector

        public BitVector()
      • BitVector

        public BitVector​(int nbits)
        Creates an empty string with the specified size.
        Parameters:
        nbits - the size of the string
      • BitVector

        public BitVector​(BitVector s)
        Creates a copy of a Bit String
        Parameters:
        s - the string to copy
        Throws:
        java.lang.IllegalArgumentException - if s is null
    • Method Detail

      • set

        public final void set​(int bit)
        Sets a bit.
        Specified by:
        set in class BitVectorBase<BitVector>
        Parameters:
        bit - the bit to be set
      • clear

        public final void clear​(int bit)
        Clears a bit.
        Specified by:
        clear in class BitVectorBase<BitVector>
        Parameters:
        bit - the bit to be cleared
      • get

        public final boolean get​(int bit)
        Gets a bit.
        Specified by:
        get in class BitVectorBase<BitVector>
        Parameters:
        bit - the bit to be gotten
      • and

        public final void and​(BitVector set)
        Logically ANDs this bit set with the specified set of bits.
        Specified by:
        and in class BitVectorBase<BitVector>
        Parameters:
        set - the bit set to be ANDed with
      • or

        public final void or​(BitVector set)
        Logically ORs this bit set with the specified set of bits.
        Specified by:
        or in class BitVectorBase<BitVector>
        Parameters:
        set - the bit set to be ORed with
      • orWithDelta

        public final int orWithDelta​(BitVector set)
        Logically ORs this bit set with the specified set of bits. This is performance-critical, and so, a little ugly in an attempt to help out the compiler.
        Parameters:
        set -
        Returns:
        the number of bits added to this.
        Throws:
        java.lang.IllegalArgumentException - if set is null
      • xor

        public final void xor​(BitVector set)
        Logically XORs this bit set with the specified set of bits.
        Specified by:
        xor in class BitVectorBase<BitVector>
        Parameters:
        set - the bit set to be XORed with
        Throws:
        java.lang.IllegalArgumentException - if set is null
      • intersectionEmpty

        public final boolean intersectionEmpty​(BitVector other)
        Check if the intersection of the two sets is empty
        Specified by:
        intersectionEmpty in class BitVectorBase<BitVector>
        Parameters:
        other - the set to check intersection with
        Throws:
        java.lang.IllegalArgumentException - if other is null
      • length

        public final int length()
        Calculates and returns the set's size in bits. The maximum element in the set is the size - 1st element.
        Specified by:
        length in class BitVectorBase<BitVector>
      • sameBits

        public final boolean sameBits​(BitVector B)
        Compares this object against the specified object.
        Specified by:
        sameBits in class BitVectorBase<BitVector>
        Parameters:
        B - the object to compare with
        Returns:
        true if the objects are the same; false otherwise.
      • equals

        public boolean equals​(java.lang.Object obj)
        Compares this object against the specified object.
        Overrides:
        equals in class java.lang.Object
        Parameters:
        obj - the object to compare with
        Returns:
        true if the objects are the same; false otherwise.
      • setAll

        public final void setAll()
        Sets all bits.
      • not

        public final void not()
        Logically NOT this bit string