Class BitKey.Mid128

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<BitKey>, java.lang.Iterable<java.lang.Integer>, BitKey
    Enclosing interface:
    BitKey

    public static class BitKey.Mid128
    extends BitKey.AbstractBitKey
    Implementation of BitKey good for sizes less than 128.
    See Also:
    Serialized Form
    • 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 java.util.BitSet toBitSet()
        Description copied from interface: BitKey
        Returns a BitSet with the same contents as this BitKey.
      • iterator

        public java.util.Iterator<java.lang.Integer> iterator()
        Description copied from interface: BitKey
        An Iterator over the bit positions. For example, if the BitKey had positions 3 and 4 set, then the Iterator would return the values 3 and then 4. The bit positions returned by the iterator are in the order, from smallest to largest, as they are set in the BitKey.
      • 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
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • 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.
      • compareTo

        public int compareTo​(BitKey bitKey)
      • compareToBig

        int compareToBig​(BitKey.Big that)