Package com.alibaba.graphscope.utils
Class ThreadSafeBitSet
- java.lang.Object
-
- com.alibaba.graphscope.utils.ThreadSafeBitSet
-
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_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 ThreadSafeBitSetandNot(ThreadSafeBitSet other)Return a new bit set which contains all bits which are contained in this bit set, and which are NOT contained in theotherbit set.intcardinality()voidclear(int position)voidclearAll()Clear all bits to 0.intcurrentCapacity()booleanequals(Object obj)booleanget(int position)long[]getWords()inthashCode()longmaxSetBit()intnextSetBit(int fromIndex)static ThreadSafeBitSetorAll(ThreadSafeBitSet... bitSets)Return a new bit set which contains all bits which are contained in *any* of the specified bit sets.voidserializeBitsTo(DataOutputStream os)voidset(int position)voidsetUntil(int position)BitSettoBitSet()StringtoString()
-
-
-
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 theotherbit 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
-
-