Class BitSet

java.lang.Object
org.antlr.runtime.BitSet
All Implemented Interfaces:
Cloneable

public class BitSet extends Object implements Cloneable
A stripped-down version of org.antlr.misc.BitSet that is just good enough to handle runtime requirements such as FOLLOW sets for automatic error recovery.
  • Field Details

  • Constructor Details

    • BitSet

      public BitSet()
      Construct a bitset of size one word (64 bits)
    • BitSet

      public BitSet(long[] bits_)
      Construction from a static array of longs
    • BitSet

      public BitSet(List items)
      Construction from a list of integers
    • BitSet

      public BitSet(int nbits)
      Construct a bitset given the size
      Parameters:
      nbits - The size of the bitset in bits
  • Method Details

    • of

      public static BitSet of(int el)
    • of

      public static BitSet of(int a, int b)
    • of

      public static BitSet of(int a, int b, int c)
    • of

      public static BitSet of(int a, int b, int c, int d)
    • or

      public BitSet or(BitSet a)
      return this | a in a new set
    • add

      public void add(int el)
      or this element into this set (grow as necessary to accommodate)
    • growToInclude

      public void growToInclude(int bit)
      Grows the set to a larger number of bits.
      Parameters:
      bit - element that must fit in set
    • orInPlace

      public void orInPlace(BitSet a)
    • setSize

      private void setSize(int nwords)
      Sets the size of a set.
      Parameters:
      nwords - how many words the new set should be
    • bitMask

      private static final long bitMask(int bitNumber)
    • clone

      public Object clone()
      Overrides:
      clone in class Object
    • size

      public int size()
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • member

      public boolean member(int el)
    • remove

      public void remove(int el)
    • isNil

      public boolean isNil()
    • numWordsToHold

      private final int numWordsToHold(int el)
    • numBits

      public int numBits()
    • lengthInLongWords

      public int lengthInLongWords()
      return how much space is being used by the bits array not how many actually have member bits on.
    • toArray

      public int[] toArray()
      Is this contained within a?
    • toPackedArray

      public long[] toPackedArray()
    • wordNumber

      private static final int wordNumber(int bit)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toString

      public String toString(String[] tokenNames)