Package org.antlr.runtime
Class BitSet
java.lang.Object
org.antlr.runtime.BitSet
- All Implemented Interfaces:
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 Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(int el) or this element into this set (grow as necessary to accommodate)private static final longbitMask(int bitNumber) clone()booleanvoidgrowToInclude(int bit) Grows the set to a larger number of bits.booleanisNil()intreturn how much space is being used by the bits array not how many actually have member bits on.booleanmember(int el) intnumBits()private final intnumWordsToHold(int el) static BitSetof(int el) static BitSetof(int a, int b) static BitSetof(int a, int b, int c) static BitSetof(int a, int b, int c, int d) return this | a in a new setvoidvoidremove(int el) private voidsetSize(int nwords) Sets the size of a set.intsize()int[]toArray()Is this contained within a?long[]toString()private static final intwordNumber(int bit)
-
Field Details
-
BITS
protected static final int BITS- See Also:
-
LOG_BITS
protected static final int LOG_BITS- See Also:
-
MOD_MASK
protected static final int MOD_MASK- See Also:
-
bits
protected long[] bitsThe actual data bits
-
-
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
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
-
of
-
of
-
of
-
or
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
-
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
-
size
public int size() -
equals
-
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
-
toString
-