Class FixedSizeBitVector

    • Constructor Detail

      • FixedSizeBitVector

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

      • setAll

        public void setAll()
        Sets all bits.
      • set

        public void set​(int bit)
        Sets a bit.
        Parameters:
        bit - the bit to be set
      • clearAll

        public void clearAll()
        Clears all bits.
      • clear

        public void clear​(int bit)
        Clears a bit.
        Parameters:
        bit - the bit to be cleared
      • get

        public boolean get​(int bit)
        Gets a bit.
        Parameters:
        bit - the bit to be gotten
      • not

        public void not()
        Logically NOT this bit string
      • and

        public void and​(FixedSizeBitVector set)
        Logically ANDs this bit set with the specified set of bits.
        Parameters:
        set - the bit set to be ANDed with
      • intersectionEmpty

        public boolean intersectionEmpty​(FixedSizeBitVector other)
        Check if the intersection of the two sets is empty
        Parameters:
        other - the set to check intersection with
      • copyBits

        public void copyBits​(FixedSizeBitVector set)
        Copies the values of the bits in the specified set into this set.
        Parameters:
        set - the bit set to copy the bits from
        Throws:
        IllegalArgumentException - if set is null
      • hashCode

        public int hashCode()
        Gets the hashcode.
        Overrides:
        hashCode in class Object
      • populationCount

        public int populationCount()
        How many bits are set?
      • length

        public int length()
        Calculates and returns the set's size in bits. The maximum element in the set is the size - 1st element.
      • equals

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

        public boolean isZero()
      • clone

        public Object clone()
        Clones the FixedSizeBitVector.
        Overrides:
        clone in class Object
      • toString

        public String toString()
        Converts the FixedSizeBitVector to a String.
        Overrides:
        toString in class Object