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.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 bitIndexvoid
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 objectlong
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, lengthAsync, notAsync, orAsync, setAsync, setAsync, setAsync, setAsync, setAsync, sizeAsync, toByteArrayAsync, xorAsync
-
Methods inherited from interface org.redisson.api.RExpirable
clearExpire, expire, expireAt, expireAt, remainTimeToLive
-
Methods inherited from interface org.redisson.api.RExpirableAsync
clearExpireAsync, expireAsync, expireAtAsync, expireAtAsync, remainTimeToLiveAsync
-
Methods inherited from interface org.redisson.api.RObject
copy, delete, dump, getCodec, getName, isExists, migrate, move, rename, renamenx, restore, restore, restoreAndReplace, restoreAndReplace, touch, unlink
-
Methods inherited from interface org.redisson.api.RObjectAsync
copyAsync, deleteAsync, dumpAsync, isExistsAsync, migrateAsync, moveAsync, renameAsync, renamenxAsync, restoreAndReplaceAsync, restoreAndReplaceAsync, restoreAsync, restoreAsync, touchAsync, unlinkAsync
-
-
-
-
Method Detail
-
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
void set(long bitIndex, boolean value)
Set bit tovalue
at specifiedbitIndex
- Parameters:
bitIndex
- - index of bitvalue
- true = 1, false = 0
-
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
-
-