Class BitKey.Small

    • Method Detail

      • set

        public void set​(int pos)
        Description copied from interface: BitKey
        Sets the bit at the specified index to true.
      • get

        public boolean get​(int pos)
        Description copied from interface: BitKey
        Returns the value of the bit with the specified index. The value is true if the bit with the index bitIndex is currently set in this BitKey; otherwise, the result is false.
      • clear

        public void clear​(int pos)
        Description copied from interface: BitKey
        Sets the bit specified by the index to false.
      • clear

        public void clear()
        Description copied from interface: BitKey
        Sets all of the bits in this BitKey to false.
      • cardinality

        public int cardinality()
        Description copied from interface: BitKey
        Returns the number of bits set.
        Returns:
        Number of bits set
      • or

        public BitKey or​(BitKey bitKey)
        Description copied from interface: BitKey
        Or the parameter BitKey with this.
        Parameters:
        bitKey - Bit key
      • orNot

        public BitKey orNot​(BitKey bitKey)
        Description copied from interface: BitKey
        XOr the parameter BitKey with this.
        Parameters:
        bitKey - Bit key
      • and

        public BitKey and​(BitKey bitKey)
        Description copied from interface: BitKey
        Returns the boolean AND of this bitkey and the given bitkey.
        Parameters:
        bitKey - Bit key
      • andNot

        public BitKey andNot​(BitKey bitKey)
        Description copied from interface: BitKey
        Returns a BitKey containing all of the bits in this BitSet whose corresponding bit is NOT set in the specified BitSet.
      • isSuperSetOf

        public boolean isSuperSetOf​(BitKey bitKey)
        Description copied from interface: BitKey
        Is every bit set in the parameter bitKey also set in this. If one switches this with the parameter bitKey one gets the equivalent of isSubSetOf.
        Parameters:
        bitKey - Bit key
      • intersects

        public boolean intersects​(BitKey bitKey)
        Description copied from interface: BitKey
        Returns whether this BitKey has any bits in common with a given BitKey.
      • toBitSet

        public BitSet toBitSet()
        Description copied from interface: BitKey
        Returns a BitSet with the same contents as this BitKey.
      • iterator

        public Iterator<Integer> iterator()
        To say that I am happy about this algorithm (or the variations of the algorithm used for the Mid128 and Big BitKey implementations) would be a stretch. It works but there has to be a more elegant and faster one but this is the best I could come up with in a couple of hours.
      • nextSetBit

        public int nextSetBit​(int fromIndex)
        Description copied from interface: BitKey
        Returns the index of the first bit that is set to true that occurs on or after the specified starting index. If no such bit exists then -1 is returned. To iterate over the true bits in a BitKey, use the following loop:
         for (int i = bk.nextSetBit(0); i >= 0; i = bk.nextSetBit(i + 1)) {
             // operate on index i here
         }
        Parameters:
        fromIndex - the index to start checking from (inclusive)
        Returns:
        the index of the next set bit
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • compareTo

        public int compareTo​(BitKey bitKey)
      • compareToBig

        protected int compareToBig​(BitKey.Big that)
      • copy

        public BitKey copy()
        Description copied from interface: BitKey
        Returns a copy of this BitKey.
        Returns:
        copy of BitKey
      • emptyCopy

        public BitKey emptyCopy()
        Description copied from interface: BitKey
        Returns an empty BitKey of the same type. This is the same as calling BitKey.copy() followed by BitKey.clear().
        Returns:
        BitKey of same type
      • isEmpty

        public boolean isEmpty()
        Description copied from interface: BitKey
        Returns true if this BitKey contains no bits that are set to true.