Class ImmutableBitSet.Builder

java.lang.Object
org.apache.calcite.util.ImmutableBitSet.Builder
Enclosing class:
ImmutableBitSet

public static class ImmutableBitSet.Builder extends Object
Builder.
  • Method Details

    • build

      public ImmutableBitSet build()
      Builds an ImmutableBitSet from the contents of this Builder.

      After calling this method, the Builder cannot be used again.

    • buildAndReset

      public ImmutableBitSet buildAndReset()
      Builds an ImmutableBitSet from the contents of this Builder.

      After calling this method, the Builder may 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)
    • get

      public boolean get(int bitIndex)
    • 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.
    • combine

      Merges another builder. Does not modify the other builder.
    • addAll

      public ImmutableBitSet.Builder addAll(ImmutableBitSet bitSet)
      Sets all bits in a given bit set.
    • addAll

      public ImmutableBitSet.Builder addAll(Iterable<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 of ints.
    • 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, from from to to - 1.
    • isEmpty

      public boolean isEmpty()
    • intersect

      public void intersect(ImmutableBitSet that)