org.antlr.runtime
Class BitSet

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

public class BitSet
extends java.lang.Object
implements java.lang.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
protected  long[] bits
          The actual data bits
protected static int BITS
           
protected static int LOG_BITS
           
protected static int MOD_MASK
           
 
Constructor Summary
BitSet()
          Construct a bitset of size one word (64 bits)
BitSet(int nbits)
          Construct a bitset given the size
BitSet(java.util.List items)
          Construction from a list of integers
BitSet(long[] bits_)
          Construction from a static array of longs
 
Method Summary
 void add(int el)
          or this element into this set (grow as necessary to accommodate)
 java.lang.Object clone()
           
 boolean equals(java.lang.Object other)
           
 void growToInclude(int bit)
          Grows the set to a larger number of bits.
 boolean isNil()
           
 int lengthInLongWords()
          return how much space is being used by the bits array not how many actually have member bits on.
 boolean member(int el)
           
 int numBits()
           
static BitSet of(int el)
           
static BitSet of(int a, int b)
           
static BitSet of(int a, int b, int c)
           
static BitSet of(int a, int b, int c, int d)
           
 BitSet or(BitSet a)
          return this | a in a new set
 void orInPlace(BitSet a)
           
 void remove(int el)
           
 int size()
           
 int[] toArray()
          Is this contained within a?
 long[] toPackedArray()
           
 java.lang.String toString()
           
 java.lang.String toString(java.lang.String[] tokenNames)
           
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

BITS

protected static final int BITS
See Also:
Constant Field Values

LOG_BITS

protected static final int LOG_BITS
See Also:
Constant Field Values

MOD_MASK

protected static final int MOD_MASK
See Also:
Constant Field Values

bits

protected long[] bits
The actual data bits

Constructor Detail

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(java.util.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 Detail

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)

clone

public java.lang.Object clone()
Overrides:
clone in class java.lang.Object

size

public int size()

equals

public boolean equals(java.lang.Object other)
Overrides:
equals in class java.lang.Object

member

public boolean member(int el)

remove

public void remove(int el)

isNil

public boolean isNil()

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()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

toString

public java.lang.String toString(java.lang.String[] tokenNames)


Copyright © 2011. All Rights Reserved.