Package pascal.taie.util.collection
Class AbstractBitSet
java.lang.Object
pascal.taie.util.collection.AbstractBitSet
- All Implemented Interfaces:
Serializable
,IBitSet
,Copyable<IBitSet>
- Direct Known Subclasses:
RegularBitSet
,SparseBitSet
Provides common functionality for
IBitSet
implementations.
Especially, based on IBitSet.Action
, it implements some operations
on IBitSet
without the need to knowing its concrete type, so that
it support operations between bit sets of different types.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface pascal.taie.util.collection.IBitSet
IBitSet.Action<R>
-
Field Summary
Modifier and TypeFieldDescriptionprotected static final int
protected static final int
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Clears all of the bits in thisBitSet
whose corresponding bit is set in the specifiedBitSet
.boolean
Returnstrue
if thisBitSet
contains all set bits in the specifiedBitSet
.boolean
Returnsfalse
if the specifiedBitSet
has any bits set totrue
that are also set totrue
in thisBitSet
.boolean
intersects
(IBitSet set) Returnstrue
if the specifiedBitSet
has any bits set totrue
that are also set totrue
in thisBitSet
.boolean
Performs a logical OR of this bit set with the bit set argument.Performs a logical OR of this bit set with the bit set argument, computes and returns the difference set between given bit set and this set (before performing logical OR).boolean
set
(int bitIndex, boolean value) Sets the bit at the specified index to the specified value.void
Sets the content of this bit set to the same as specified bit set.toString()
Returns a string representation of this bit set.protected static int
wordIndex
(int bitIndex) Given a bit index, return word index containing it.boolean
Performs a logical XOR of this bit set with the bit set argument.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface pascal.taie.util.collection.IBitSet
and, cardinality, clear, clear, flip, get, isEmpty, iterateBits, length, nextClearBit, nextSetBit, previousClearBit, previousSetBit, set, size
-
Field Details
-
ADDRESS_BITS_PER_WORD
protected static final int ADDRESS_BITS_PER_WORD- See Also:
-
BITS_PER_WORD
protected static final int BITS_PER_WORD- See Also:
-
-
Constructor Details
-
AbstractBitSet
public AbstractBitSet()
-
-
Method Details
-
wordIndex
protected static int wordIndex(int bitIndex) Given a bit index, return word index containing it. -
set
public boolean set(int bitIndex, boolean value) Description copied from interface:IBitSet
Sets the bit at the specified index to the specified value. -
intersects
Description copied from interface:IBitSet
Returnstrue
if the specifiedBitSet
has any bits set totrue
that are also set totrue
in thisBitSet
.- Specified by:
intersects
in interfaceIBitSet
- Parameters:
set
-BitSet
to intersect with- Returns:
- boolean indicating whether this
BitSet
intersects the specifiedBitSet
-
disjoints
Description copied from interface:IBitSet
Returnsfalse
if the specifiedBitSet
has any bits set totrue
that are also set totrue
in thisBitSet
. -
contains
Description copied from interface:IBitSet
Returnstrue
if thisBitSet
contains all set bits in the specifiedBitSet
. -
andNot
Description copied from interface:IBitSet
Clears all of the bits in thisBitSet
whose corresponding bit is set in the specifiedBitSet
. -
or
Description copied from interface:IBitSet
Performs a logical OR of this bit set with the bit set argument. This bit set is modified so that a bit in it has the valuetrue
if and only if it either already had the valuetrue
or the corresponding bit in the bit set argument has the valuetrue
. -
orDiff
Description copied from interface:IBitSet
Performs a logical OR of this bit set with the bit set argument, computes and returns the difference set between given bit set and this set (before performing logical OR). -
xor
Description copied from interface:IBitSet
Performs a logical XOR of this bit set with the bit set argument. This bit set is modified so that a bit in it has the valuetrue
if and only if one of the following statements holds:- The bit initially has the value
true
, and the corresponding bit in the argument has the valuefalse
. - The bit initially has the value
false
, and the corresponding bit in the argument has the valuetrue
.
- The bit initially has the value
-
setTo
Description copied from interface:IBitSet
Sets the content of this bit set to the same as specified bit set. -
toString
Returns a string representation of this bit set. For every index for which thisBitSet
contains a bit in the set state, the decimal representation of that index is included in the result. Such indices are listed in order from lowest to highest, separated by ", " (a comma and a space) and surrounded by braces, resulting in the usual mathematical notation for a set of integers.Example:
BitSet drPepper = new BitSet();
NowdrPepper.toString()
returns "{}
".drPepper.set(2);
NowdrPepper.toString()
returns "{2}
".drPepper.set(4); drPepper.set(10);
NowdrPepper.toString()
returns "{2, 4, 10}
".
-