Package com.alibaba.graphscope.utils
Class ThreadSafeBitSet
- java.lang.Object
-
- com.alibaba.graphscope.utils.ThreadSafeBitSet
-
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_LOG2_SEGMENT_SIZE_IN_BITS
-
Constructor Summary
Constructors Constructor Description ThreadSafeBitSet()
ThreadSafeBitSet(int log2SegmentSizeInBits)
ThreadSafeBitSet(int log2SegmentSizeInBits, int numBitsToPreallocate)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ThreadSafeBitSet
andNot(ThreadSafeBitSet other)
Return a new bit set which contains all bits which are contained in this bit set, and which are NOT contained in theother
bit set.int
cardinality()
void
clear(int position)
void
clearAll()
Clear all bits to 0.int
currentCapacity()
boolean
equals(Object obj)
boolean
get(int position)
long[]
getWords()
int
hashCode()
long
maxSetBit()
int
nextSetBit(int fromIndex)
static ThreadSafeBitSet
orAll(ThreadSafeBitSet... bitSets)
Return a new bit set which contains all bits which are contained in *any* of the specified bit sets.void
serializeBitsTo(DataOutputStream os)
void
set(int position)
void
setUntil(int position)
BitSet
toBitSet()
String
toString()
-
-
-
Field Detail
-
DEFAULT_LOG2_SEGMENT_SIZE_IN_BITS
public static final int DEFAULT_LOG2_SEGMENT_SIZE_IN_BITS
- See Also:
- Constant Field Values
-
-
Method Detail
-
set
public void set(int position)
-
setUntil
public void setUntil(int position)
-
clear
public void clear(int position)
-
get
public boolean get(int position)
-
maxSetBit
public long maxSetBit()
-
nextSetBit
public int nextSetBit(int fromIndex)
-
cardinality
public int cardinality()
- Returns:
- the number of bits which are set in this bit set.
-
getWords
public long[] getWords()
-
currentCapacity
public int currentCapacity()
- Returns:
- the number of bits which are current specified by this bit set. This is the maximum value to which you might need to iterate, if you were to iterate over all bits in this set.
-
clearAll
public void clearAll()
Clear all bits to 0.
-
andNot
public ThreadSafeBitSet andNot(ThreadSafeBitSet other)
Return a new bit set which contains all bits which are contained in this bit set, and which are NOT contained in theother
bit set.In other words, return a new bit set, which is a bitwise and with the bitwise not of the other bit set.
- Parameters:
other
- the other bit set- Returns:
- the resulting bit set
-
orAll
public static ThreadSafeBitSet orAll(ThreadSafeBitSet... bitSets)
Return a new bit set which contains all bits which are contained in *any* of the specified bit sets.- Parameters:
bitSets
- the other bit sets- Returns:
- the resulting bit set
-
serializeBitsTo
public void serializeBitsTo(DataOutputStream os) throws IOException
- Throws:
IOException
-
toBitSet
public BitSet toBitSet()
- Returns:
- a new BitSet with same bits set
-
-