Package org.apache.calcite.util
Class BitSets
java.lang.Object
org.apache.calcite.util.BitSets
Utility functions for 
BitSet.- 
Method SummaryModifier and TypeMethodDescriptionComputes the closure of a map from integers to bits.static booleanReturns true if all bits set in the second parameter are also set in the first.static booleancontains(BitSet set0, ImmutableBitSet set1) Returns true if all bits set in the second parameter are also set in the first.static BitSetof(int... bits) Creates a bitset with given bits set.static BitSetCreates a BitSet with given bits set.static BitSetCreates a BitSet with given bits set.static BitSetof(ImmutableIntList bits) Creates a BitSet with given bits set.static voidPopulates aBitSetfrom an iterable, such as a list of integer.static voidpopulate(BitSet bitSet, ImmutableIntList list) Populates aBitSetfrom anImmutableIntList.static intpreviousClearBit(BitSet bitSet, int fromIndex) Returns the previous clear bit.static BitSetrange(int toIndex) Creates a BitSet with bits between 0 andtoIndexset.static BitSetrange(int fromIndex, int toIndex) Creates a bitset with bits fromfromIndex(inclusive) to specifiedtoIndex(exclusive) set totrue.static voidSets all bits in a given BitSet corresponding to integers from a list.static int[]Converts a BitSet to an array.Returns an iterable over the bits in a bitmap that are set to '1'.toIter(ImmutableBitSet bitSet) Converts a bitset to a list.static BitSetReturns a BitSet that is the union of the given BitSets.
- 
Method Details- 
containsReturns true if all bits set in the second parameter are also set in the first. In other words, whether x is a super-set of y.- Parameters:
- set0- Containing bitmap
- set1- Bitmap to be checked
- Returns:
- Whether all bits in set1 are set in set0
 
- 
containsReturns true if all bits set in the second parameter are also set in the first. In other words, whether x is a super-set of y.- Parameters:
- set0- Containing bitmap
- set1- Bitmap to be checked
- Returns:
- Whether all bits in set1 are set in set0
 
- 
toIterReturns an iterable over the bits in a bitmap that are set to '1'.This allows you to iterate over a bit set using a 'foreach' construct. For instance: BitSet bitSet;
 for (int i : Util.toIter(bitSet)) {
 print(i);
 }- Parameters:
- bitSet- Bit set
- Returns:
- Iterable
 
- 
toIter
- 
toListConverts a bitset to a list.The list is mutable, and future changes to the list do not affect the contents of the bit set. - Parameters:
- bitSet- Bit set
- Returns:
- List of set bits
 
- 
toArrayConverts a BitSet to an array.- Parameters:
- bitSet- Bit set
- Returns:
- Array of set bits
 
- 
ofCreates a bitset with given bits set.For example, of(0, 3)returns a bit set with bits {0, 3} set.- Parameters:
- bits- Array of bits to set
- Returns:
- Bit set
 
- 
ofCreates a BitSet with given bits set.For example, of(new Integer[] {0, 3})returns a bit set with bits {0, 3} set.- Parameters:
- bits- Array of bits to set
- Returns:
- Bit set
 
- 
ofCreates a BitSet with given bits set.For example, of(Arrays.asList(0, 3))returns a bit set with bits {0, 3} set.- Parameters:
- bits- Collection of bits to set
- Returns:
- Bit set
 
- 
ofCreates a BitSet with given bits set.For example, of(ImmutableIntList.of(0, 3))returns a bit set with bits {0, 3} set.- Parameters:
- bits- Collection of bits to set
- Returns:
- Bit set
 
- 
rangeCreates a bitset with bits fromfromIndex(inclusive) to specifiedtoIndex(exclusive) set totrue.For example, range(0, 3)returns a bit set with bits {0, 1, 2} set.- Parameters:
- fromIndex- Index of the first bit to be set.
- toIndex- Index after the last bit to be set.
- Returns:
- Bit set
 
- 
rangeCreates a BitSet with bits between 0 andtoIndexset.
- 
setAllSets all bits in a given BitSet corresponding to integers from a list.
- 
unionReturns a BitSet that is the union of the given BitSets. Does not modify any of the inputs.
- 
previousClearBitReturns the previous clear bit.Has same behavior as BitSet.previousClearBit(int), but that method does not exist before 1.7.
- 
closureComputes the closure of a map from integers to bits.The input must have an entry for each position. Does not modify the input map or its bit sets. 
- 
populatePopulates aBitSetfrom an iterable, such as a list of integer.
- 
populatePopulates aBitSetfrom anImmutableIntList.
 
-