Interface RBitSet

All Superinterfaces:
RBitSetAsync, RExpirable, RExpirableAsync, RObject, RObjectAsync
All Known Implementing Classes:
RedissonBitSet

public interface RBitSet extends RExpirable, RBitSetAsync
Vector of bits that grows as needed.
Author:
Nikita Koksharov
  • Method Details

    • getSigned

      long getSigned(int size, long offset)
      Returns signed number at specified offset and size
      Parameters:
      size - - size of signed number up to 64 bits
      offset - - offset of signed number
      Returns:
      signed number
    • setSigned

      long setSigned(int size, long offset, long value)
      Returns previous value of signed number and replaces it with defined value at specified offset
      Parameters:
      size - - size of signed number up to 64 bits
      offset - - offset of signed number
      value - - value of signed number
      Returns:
      previous value of signed number
    • incrementAndGetSigned

      long incrementAndGetSigned(int size, long offset, long increment)
      Increments current signed value by defined increment value and size at specified offset and returns result.
      Parameters:
      size - - size of signed number up to 64 bits
      offset - - offset of signed number
      increment - - increment value
      Returns:
      result value
    • getUnsigned

      long getUnsigned(int size, long offset)
      Returns unsigned number at specified offset and size
      Parameters:
      size - - size of unsigned number up to 64 bits
      offset - - offset of unsigned number
      Returns:
      unsigned number
    • setUnsigned

      long setUnsigned(int size, long offset, long value)
      Returns previous value of unsigned number and replaces it with defined value at specified offset
      Parameters:
      size - - size of unsigned number up to 64 bits
      offset - - offset of unsigned number
      value - - value of unsigned number
      Returns:
      previous value of unsigned number
    • incrementAndGetUnsigned

      long incrementAndGetUnsigned(int size, long offset, long increment)
      Increments current unsigned value by defined increment value and size at specified offset and returns result.
      Parameters:
      size - - size of unsigned number up to 64 bits
      offset - - offset of unsigned number
      increment - - increment value
      Returns:
      result value
    • getByte

      byte getByte(long offset)
      Returns byte number at specified offset
      Parameters:
      offset - - offset of number
      Returns:
      number
    • setByte

      byte setByte(long offset, byte value)
      Returns previous value of byte number and replaces it with defined value at specified offset
      Parameters:
      offset - - offset of number
      value - - value of number
      Returns:
      previous value of number
    • incrementAndGetByte

      byte incrementAndGetByte(long offset, byte increment)
      Increments current byte value on defined increment value at specified offset and returns result.
      Parameters:
      offset - - offset of number
      increment - - increment value
      Returns:
      result value
    • getShort

      short getShort(long offset)
      Returns short number at specified offset
      Parameters:
      offset - - offset of number
      Returns:
      number
    • setShort

      short setShort(long offset, short value)
      Returns previous value of short number and replaces it with defined value at specified offset
      Parameters:
      offset - - offset of number
      value - - value of number
      Returns:
      previous value of number
    • incrementAndGetShort

      short incrementAndGetShort(long offset, short increment)
      Increments current short value on defined increment value at specified offset and returns result.
      Parameters:
      offset - - offset of number
      increment - - increment value
      Returns:
      result value
    • getInteger

      int getInteger(long offset)
      Returns integer number at specified offset
      Parameters:
      offset - - offset of number
      Returns:
      number
    • setInteger

      int setInteger(long offset, int value)
      Returns previous value of integer number and replaces it with defined value at specified offset
      Parameters:
      offset - - offset of number
      value - - value of number
      Returns:
      previous value of number
    • incrementAndGetInteger

      int incrementAndGetInteger(long offset, int increment)
      Increments current integer value on defined increment value at specified offset and returns result.
      Parameters:
      offset - - offset of number
      increment - - increment value
      Returns:
      result value
    • getLong

      long getLong(long offset)
      Returns long number at specified offset
      Parameters:
      offset - - offset of number
      Returns:
      number
    • setLong

      long setLong(long offset, long value)
      Returns previous value of long number and replaces it with defined value at specified offset
      Parameters:
      offset - - offset of number
      value - - value of number
      Returns:
      previous value of number
    • incrementAndGetLong

      long incrementAndGetLong(long offset, long increment)
      Increments current long value on defined increment value at specified offset and returns result.
      Parameters:
      offset - - offset of number
      increment - - increment value
      Returns:
      result value
    • length

      long length()
      Returns "logical size" = index of highest set bit plus one. Returns zero if there are no any set bit.
      Returns:
      "logical size" = index of highest set bit plus one
    • set

      void set(long fromIndex, long toIndex, boolean value)
      Set all bits to value from fromIndex (inclusive) to toIndex (exclusive)
      Parameters:
      fromIndex - inclusive
      toIndex - exclusive
      value - true = 1, false = 0
    • clear

      void clear(long fromIndex, long toIndex)
      Set all bits to zero from fromIndex (inclusive) to toIndex (exclusive)
      Parameters:
      fromIndex - inclusive
      toIndex - exclusive
    • set

      void set(BitSet bs)
      Copy bits state of source BitSet object to this object
      Parameters:
      bs - - BitSet source
    • set

      void set(long[] indexArray, boolean value)
      Set all bits to value which index in indexArray
      Parameters:
      indexArray - The index array of bits that needs to be set to value
      value - true = 1, false = 0
    • not

      void not()
      Executes NOT operation over all bits
    • set

      void set(long fromIndex, long toIndex)
      Set all bits to one from fromIndex (inclusive) to toIndex (exclusive)
      Parameters:
      fromIndex - inclusive
      toIndex - exclusive
    • size

      long size()
      Returns number of set bits.
      Returns:
      number of set bits.
    • get

      boolean get(long bitIndex)
      Returns true if bit set to one and false overwise.
      Parameters:
      bitIndex - - index of bit
      Returns:
      true if bit set to one and false overwise.
    • set

      boolean set(long bitIndex)
      Set bit to one at specified bitIndex
      Parameters:
      bitIndex - - index of bit
      Returns:
      true - if previous value was true, false - if previous value was false
    • set

      boolean set(long bitIndex, boolean value)
      Set bit to value at specified bitIndex
      Parameters:
      bitIndex - - index of bit
      value - true = 1, false = 0
      Returns:
      true - if previous value was true, false - if previous value was false
    • toByteArray

      byte[] toByteArray()
    • cardinality

      long cardinality()
      Returns the number of bits set to one.
      Returns:
      number of bits
    • clear

      boolean clear(long bitIndex)
      Set bit to zero at specified bitIndex
      Parameters:
      bitIndex - - index of bit
      Returns:
      true - if previous value was true, false - if previous value was false
    • clear

      void clear()
      Set all bits to zero
    • asBitSet

      BitSet asBitSet()
    • or

      void or(String... bitSetNames)
      Executes OR operation over this object and specified bitsets. Stores result into this object.
      Parameters:
      bitSetNames - - name of stored bitsets
    • and

      void and(String... bitSetNames)
      Executes AND operation over this object and specified bitsets. Stores result into this object.
      Parameters:
      bitSetNames - - name of stored bitsets
    • xor

      void xor(String... bitSetNames)
      Executes XOR operation over this object and specified bitsets. Stores result into this object.
      Parameters:
      bitSetNames - - name of stored bitsets