Package org.redisson.api
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 Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
and(String... bitSetNames)
Executes AND operation over this object and specified bitsets.BitSet
asBitSet()
long
cardinality()
Returns the number of bits set to one.void
clear()
Set all bits to zeroboolean
clear(long bitIndex)
Set bit to zero at specifiedbitIndex
void
clear(long fromIndex, long toIndex)
Set all bits to zero fromfromIndex
(inclusive) totoIndex
(exclusive)boolean
get(long bitIndex)
Returnstrue
if bit set to one andfalse
overwise.byte
getByte(long offset)
Returns byte number at specifiedoffset
int
getInteger(long offset)
Returns integer number at specifiedoffset
long
getLong(long offset)
Returns long number at specifiedoffset
short
getShort(long offset)
Returns short number at specifiedoffset
long
getSigned(int size, long offset)
Returns signed number at specifiedoffset
andsize
long
getUnsigned(int size, long offset)
Returns unsigned number at specifiedoffset
andsize
byte
incrementAndGetByte(long offset, byte increment)
Increments current byte value on definedincrement
value at specifiedoffset
and returns result.int
incrementAndGetInteger(long offset, int increment)
Increments current integer value on definedincrement
value at specifiedoffset
and returns result.long
incrementAndGetLong(long offset, long increment)
Increments current long value on definedincrement
value at specifiedoffset
and returns result.short
incrementAndGetShort(long offset, short increment)
Increments current short value on definedincrement
value at specifiedoffset
and returns result.long
incrementAndGetSigned(int size, long offset, long increment)
Increments current signed value by definedincrement
value andsize
at specifiedoffset
and returns result.long
incrementAndGetUnsigned(int size, long offset, long increment)
Increments current unsigned value by definedincrement
value andsize
at specifiedoffset
and returns result.long
length()
Returns "logical size" = index of highest set bit plus one.void
not()
Executes NOT operation over all bitsvoid
or(String... bitSetNames)
Executes OR operation over this object and specified bitsets.boolean
set(long bitIndex)
Set bit to one at specified bitIndexboolean
set(long bitIndex, boolean value)
Set bit tovalue
at specifiedbitIndex
void
set(long fromIndex, long toIndex)
Set all bits to one fromfromIndex
(inclusive) totoIndex
(exclusive)void
set(long fromIndex, long toIndex, boolean value)
Set all bits tovalue
fromfromIndex
(inclusive) totoIndex
(exclusive)void
set(BitSet bs)
Copy bits state of source BitSet object to this objectbyte
setByte(long offset, byte value)
Returns previous value of byte number and replaces it with definedvalue
at specifiedoffset
int
setInteger(long offset, int value)
Returns previous value of integer number and replaces it with definedvalue
at specifiedoffset
long
setLong(long offset, long value)
Returns previous value of long number and replaces it with definedvalue
at specifiedoffset
short
setShort(long offset, short value)
Returns previous value of short number and replaces it with definedvalue
at specifiedoffset
long
setSigned(int size, long offset, long value)
Returns previous value of signed number and replaces it with definedvalue
at specifiedoffset
long
setUnsigned(int size, long offset, long value)
Returns previous value of unsigned number and replaces it with definedvalue
at specifiedoffset
long
size()
Returns number of set bits.byte[]
toByteArray()
void
xor(String... bitSetNames)
Executes XOR operation over this object and specified bitsets.-
Methods inherited from interface org.redisson.api.RBitSetAsync
andAsync, cardinalityAsync, clearAsync, clearAsync, clearAsync, getAsync, getByteAsync, getIntegerAsync, getLongAsync, getShortAsync, getSignedAsync, getUnsignedAsync, incrementAndGetByteAsync, incrementAndGetIntegerAsync, incrementAndGetLongAsync, incrementAndGetShortAsync, incrementAndGetSignedAsync, incrementAndGetUnsignedAsync, lengthAsync, notAsync, orAsync, setAsync, setAsync, setAsync, setAsync, setAsync, setByteAsync, setIntegerAsync, setLongAsync, setShortAsync, setSignedAsync, setUnsignedAsync, sizeAsync, toByteArrayAsync, xorAsync
-
Methods inherited from interface org.redisson.api.RExpirable
clearExpire, expire, expire, expireAt, expireAt, remainTimeToLive
-
Methods inherited from interface org.redisson.api.RExpirableAsync
clearExpireAsync, expireAsync, expireAsync, expireAtAsync, expireAtAsync, remainTimeToLiveAsync
-
Methods inherited from interface org.redisson.api.RObject
addListener, copy, delete, dump, getCodec, getIdleTime, getName, isExists, migrate, move, removeListener, rename, renamenx, restore, restore, restoreAndReplace, restoreAndReplace, sizeInMemory, touch, unlink
-
Methods inherited from interface org.redisson.api.RObjectAsync
addListenerAsync, copyAsync, deleteAsync, dumpAsync, getIdleTimeAsync, isExistsAsync, migrateAsync, moveAsync, removeListenerAsync, renameAsync, renamenxAsync, restoreAndReplaceAsync, restoreAndReplaceAsync, restoreAsync, restoreAsync, sizeInMemoryAsync, touchAsync, unlinkAsync
-
-
-
-
Method Detail
-
getSigned
long getSigned(int size, long offset)
Returns signed number at specifiedoffset
andsize
- Parameters:
size
- - size of signed number up to 64 bitsoffset
- - 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 definedvalue
at specifiedoffset
- Parameters:
size
- - size of signed number up to 64 bitsoffset
- - offset of signed numbervalue
- - value of signed number- Returns:
- previous value of signed number
-
incrementAndGetSigned
long incrementAndGetSigned(int size, long offset, long increment)
Increments current signed value by definedincrement
value andsize
at specifiedoffset
and returns result.- Parameters:
size
- - size of signed number up to 64 bitsoffset
- - offset of signed numberincrement
- - increment value- Returns:
- result value
-
getUnsigned
long getUnsigned(int size, long offset)
Returns unsigned number at specifiedoffset
andsize
- Parameters:
size
- - size of unsigned number up to 64 bitsoffset
- - 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 definedvalue
at specifiedoffset
- Parameters:
size
- - size of unsigned number up to 64 bitsoffset
- - offset of unsigned numbervalue
- - value of unsigned number- Returns:
- previous value of unsigned number
-
incrementAndGetUnsigned
long incrementAndGetUnsigned(int size, long offset, long increment)
Increments current unsigned value by definedincrement
value andsize
at specifiedoffset
and returns result.- Parameters:
size
- - size of unsigned number up to 64 bitsoffset
- - offset of unsigned numberincrement
- - increment value- Returns:
- result value
-
getByte
byte getByte(long offset)
Returns byte number at specifiedoffset
- Parameters:
offset
- - offset of number- Returns:
- number
-
setByte
byte setByte(long offset, byte value)
Returns previous value of byte number and replaces it with definedvalue
at specifiedoffset
- Parameters:
offset
- - offset of numbervalue
- - value of number- Returns:
- previous value of number
-
incrementAndGetByte
byte incrementAndGetByte(long offset, byte increment)
Increments current byte value on definedincrement
value at specifiedoffset
and returns result.- Parameters:
offset
- - offset of numberincrement
- - increment value- Returns:
- result value
-
getShort
short getShort(long offset)
Returns short number at specifiedoffset
- Parameters:
offset
- - offset of number- Returns:
- number
-
setShort
short setShort(long offset, short value)
Returns previous value of short number and replaces it with definedvalue
at specifiedoffset
- Parameters:
offset
- - offset of numbervalue
- - value of number- Returns:
- previous value of number
-
incrementAndGetShort
short incrementAndGetShort(long offset, short increment)
Increments current short value on definedincrement
value at specifiedoffset
and returns result.- Parameters:
offset
- - offset of numberincrement
- - increment value- Returns:
- result value
-
getInteger
int getInteger(long offset)
Returns integer number at specifiedoffset
- Parameters:
offset
- - offset of number- Returns:
- number
-
setInteger
int setInteger(long offset, int value)
Returns previous value of integer number and replaces it with definedvalue
at specifiedoffset
- Parameters:
offset
- - offset of numbervalue
- - value of number- Returns:
- previous value of number
-
incrementAndGetInteger
int incrementAndGetInteger(long offset, int increment)
Increments current integer value on definedincrement
value at specifiedoffset
and returns result.- Parameters:
offset
- - offset of numberincrement
- - increment value- Returns:
- result value
-
getLong
long getLong(long offset)
Returns long number at specifiedoffset
- Parameters:
offset
- - offset of number- Returns:
- number
-
setLong
long setLong(long offset, long value)
Returns previous value of long number and replaces it with definedvalue
at specifiedoffset
- Parameters:
offset
- - offset of numbervalue
- - value of number- Returns:
- previous value of number
-
incrementAndGetLong
long incrementAndGetLong(long offset, long increment)
Increments current long value on definedincrement
value at specifiedoffset
and returns result.- Parameters:
offset
- - offset of numberincrement
- - 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 tovalue
fromfromIndex
(inclusive) totoIndex
(exclusive)- Parameters:
fromIndex
- inclusivetoIndex
- exclusivevalue
- true = 1, false = 0
-
clear
void clear(long fromIndex, long toIndex)
Set all bits to zero fromfromIndex
(inclusive) totoIndex
(exclusive)- Parameters:
fromIndex
- inclusivetoIndex
- exclusive
-
set
void set(BitSet bs)
Copy bits state of source BitSet object to this object- Parameters:
bs
- - BitSet source
-
not
void not()
Executes NOT operation over all bits
-
set
void set(long fromIndex, long toIndex)
Set all bits to one fromfromIndex
(inclusive) totoIndex
(exclusive)- Parameters:
fromIndex
- inclusivetoIndex
- exclusive
-
size
long size()
Returns number of set bits.- Returns:
- number of set bits.
-
get
boolean get(long bitIndex)
Returnstrue
if bit set to one andfalse
overwise.- Parameters:
bitIndex
- - index of bit- Returns:
true
if bit set to one andfalse
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 tovalue
at specifiedbitIndex
- Parameters:
bitIndex
- - index of bitvalue
- 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 specifiedbitIndex
- 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
-
-