Package org.apache.calcite.util
Class ImmutableBitSet.Builder
- java.lang.Object
-
- org.apache.calcite.util.ImmutableBitSet.Builder
-
- Direct Known Subclasses:
ImmutableBitSet.Rebuilder
- Enclosing class:
- ImmutableBitSet
public static class ImmutableBitSet.Builder extends java.lang.Object
Builder.
-
-
Field Summary
Fields Modifier and Type Field Description private long[]
words
-
Constructor Summary
Constructors Modifier Constructor Description private
Builder(long[] words)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ImmutableBitSet.Builder
addAll(java.lang.Iterable<java.lang.Integer> integers)
Sets all bits in a given list of bits.ImmutableBitSet.Builder
addAll(ImmutableBitSet bitSet)
Sets all bits in a given bit set.ImmutableBitSet.Builder
addAll(ImmutableIntList integers)
Sets all bits in a given list ofint
s.ImmutableBitSet
build()
Builds an ImmutableBitSet from the contents of this Builder.ImmutableBitSet
build(ImmutableBitSet bitSet)
Builds an ImmutableBitSet from the contents of this Builder, using an existing ImmutableBitSet if it happens to have the same contents.int
cardinality()
Returns the number of set bits.ImmutableBitSet.Builder
clear(int bit)
void
intersect(ImmutableBitSet that)
boolean
isEmpty()
ImmutableBitSet.Builder
removeAll(ImmutableBitSet bitSet)
Clears all bits in a given bit set.ImmutableBitSet.Builder
set(int bit)
ImmutableBitSet.Builder
set(int fromIndex, int toIndex)
Sets a range of bits, fromfrom
toto
- 1.private void
trim(int wordCount)
boolean
wouldEqual(ImmutableBitSet bitSet)
Returns whether the bit set that would be created by this Builder would equal a given bit set.
-
-
-
Method Detail
-
build
public ImmutableBitSet build()
Builds an ImmutableBitSet from the contents of this Builder.After calling this method, the Builder cannot be used again.
-
build
public ImmutableBitSet build(ImmutableBitSet bitSet)
Builds an ImmutableBitSet from the contents of this Builder, using an existing ImmutableBitSet if it happens to have the same contents.Supplying the existing bit set if useful for set operations, where there is a significant chance that the original bit set is unchanged. We save memory because we use the same copy. For example:
ImmutableBitSet primeNumbers; ImmutableBitSet hundreds = ImmutableBitSet.of(100, 200, 300); return primeNumbers.except(hundreds);
After calling this method, the Builder cannot be used again.
-
set
public ImmutableBitSet.Builder set(int bit)
-
trim
private void trim(int wordCount)
-
clear
public ImmutableBitSet.Builder clear(int bit)
-
wouldEqual
public boolean wouldEqual(ImmutableBitSet bitSet)
Returns whether the bit set that would be created by this Builder would equal a given bit set.
-
cardinality
public int cardinality()
Returns the number of set bits.
-
addAll
public ImmutableBitSet.Builder addAll(ImmutableBitSet bitSet)
Sets all bits in a given bit set.
-
addAll
public ImmutableBitSet.Builder addAll(java.lang.Iterable<java.lang.Integer> integers)
Sets all bits in a given list of bits.
-
addAll
public ImmutableBitSet.Builder addAll(ImmutableIntList integers)
Sets all bits in a given list ofint
s.
-
removeAll
public ImmutableBitSet.Builder removeAll(ImmutableBitSet bitSet)
Clears all bits in a given bit set.
-
set
public ImmutableBitSet.Builder set(int fromIndex, int toIndex)
Sets a range of bits, fromfrom
toto
- 1.
-
isEmpty
public boolean isEmpty()
-
intersect
public void intersect(ImmutableBitSet that)
-
-