antlr.collections.impl
Class BitSet

java.lang.Object
  |
  +--antlr.collections.impl.BitSet
All Implemented Interfaces:
Cloneable

public class BitSet
extends Object
implements Cloneable

Untamed:


Field Summary
protected  long[] bits
          The actual data bits
protected static int BITS
           
protected static int LOG_BITS
           
protected static int MOD_MASK
           
protected static int NIBBLE
           
 
Constructor Summary
BitSet()
          Enabled: Construct a bitset of size one word (64 bits)
BitSet(int nbits)
          Enabled: Construct a bitset given the size
BitSet(long[] bits_)
          Enabled: Construction from a static array of longs
 
Method Summary
 void add(int el)
          Enabled: or this element into this set (grow as necessary to accommodate)
 BitSet and(BitSet a)
          Enabled:
 void andInPlace(BitSet a)
          Enabled:
private static long bitMask(int bitNumber)
           
 void clear()
          Enabled:
 void clear(int el)
          Enabled:
 Object clone()
          Suppressed:
 int degree()
          Enabled:
 boolean equals(Object obj)
          Suppressed: code "inherited" from java.util.BitSet
static Vector getRanges(int[] elems)
          Enabled: Find ranges in a set element array.
 void growToInclude(int bit)
          Enabled: Grows the set to a larger number of bits.
 boolean member(int el)
          Enabled:
 boolean nil()
          Enabled:
 BitSet not()
          Enabled:
 void notInPlace()
          Enabled:
 void notInPlace(int maxBit)
          Enabled: complement bits in the range 0..maxBit.
 void notInPlace(int minBit, int maxBit)
          Enabled: complement bits in the range minBit..maxBit.
private  int numWordsToHold(int el)
           
static BitSet of(int el)
          Enabled:
 BitSet or(BitSet a)
          Enabled: return this | a in a new set
 void orInPlace(BitSet a)
          Enabled:
 void remove(int el)
          Enabled:
private  void setSize(int nwords)
          Sets the size of a set.
 int size()
          Enabled:
 boolean subset(BitSet a)
          Enabled: Is this contained within a?
 void subtractInPlace(BitSet a)
          Enabled: Subtract the elements of 'a' from 'this' in-place.
 int[] toArray()
          Enabled:
 String toString()
          Suppressed:
 String toString(String separator)
          Enabled: Transform a bit set into a string by formatting each element as an integer
 String toString(String separator, CharFormatter formatter)
          Enabled: Transform a bit set into a string of characters.
 String toString(String separator, Vector vocabulary)
          Enabled: Create a string representation where instead of integer elements, the ith element of vocabulary is displayed instead.
 String toStringOfHalfWords()
          Enabled: Dump a comma-separated list of the words making up the bit set.
 String toStringOfWords()
          Enabled: Dump a comma-separated list of the words making up the bit set.
 String toStringWithRanges(String separator, CharFormatter formatter)
          Enabled: Print out the bit set but collapse char ranges.
private static int wordNumber(int bit)
           
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

BITS

protected static final int BITS

NIBBLE

protected static final int NIBBLE

LOG_BITS

protected static final int LOG_BITS

MOD_MASK

protected static final int MOD_MASK

bits

protected long[] bits
The actual data bits

Constructor Detail

BitSet

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


BitSet

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


BitSet

public BitSet(int nbits)
Enabled: Construct a bitset given the size

Parameters:
nbits - The size of the bitset in bits
Method Detail

add

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


and

public BitSet and(BitSet a)
Enabled:


andInPlace

public void andInPlace(BitSet a)
Enabled:


bitMask

private static final long bitMask(int bitNumber)

clear

public void clear()
Enabled:


clear

public void clear(int el)
Enabled:


clone

public Object clone()
Suppressed:

Overrides:
clone in class Object
Returns:
a clone of this instance.
See Also:
java.lang.Cloneable

degree

public int degree()
Enabled:


equals

public boolean equals(Object obj)
Suppressed: code "inherited" from java.util.BitSet

Overrides:
equals in class Object
Parameters:
obj - the reference object with which to compare.
Returns:
true if this object is the same as the obj argument; false otherwise.
See Also:
Object.hashCode(), java.util.Hashtable

getRanges

public static Vector getRanges(int[] elems)
Enabled: Find ranges in a set element array. @param elems The array of elements representing the set, usually from Bit Set.toArray().

Returns:
Vector of ranges.

growToInclude

public void growToInclude(int bit)
Enabled: Grows the set to a larger number of bits.

Parameters:
bit - element that must fit in set

member

public boolean member(int el)
Enabled:


nil

public boolean nil()
Enabled:


not

public BitSet not()
Enabled:


notInPlace

public void notInPlace()
Enabled:


notInPlace

public void notInPlace(int maxBit)
Enabled: complement bits in the range 0..maxBit.


notInPlace

public void notInPlace(int minBit,
                       int maxBit)
Enabled: complement bits in the range minBit..maxBit.


numWordsToHold

private final int numWordsToHold(int el)

of

public static BitSet of(int el)
Enabled:


or

public BitSet or(BitSet a)
Enabled: return this | a in a new set


orInPlace

public void orInPlace(BitSet a)
Enabled:


remove

public void remove(int el)
Enabled:


setSize

private void setSize(int nwords)
Sets the size of a set.

Parameters:
nwords - how many words the new set should be

size

public int size()
Enabled:


subset

public boolean subset(BitSet a)
Enabled: Is this contained within a?


subtractInPlace

public void subtractInPlace(BitSet a)
Enabled: Subtract the elements of 'a' from 'this' in-place. Basically, just turn off all bits of 'this' that are in 'a'.


toArray

public int[] toArray()
Enabled:


toString

public String toString()
Suppressed:

Overrides:
toString in class Object
Returns:
a string representation of the object.

toString

public String toString(String separator)
Enabled: Transform a bit set into a string by formatting each element as an integer

Returns:
A commma-separated list of values

toString

public String toString(String separator,
                       CharFormatter formatter)
Enabled: Transform a bit set into a string of characters.

Parameters:
formatter - An object implementing the CharFormatter interface.
Returns:
A commma-separated list of character constants.

toString

public String toString(String separator,
                       Vector vocabulary)
Enabled: Create a string representation where instead of integer elements, the ith element of vocabulary is displayed instead. Vocabulary is a Vector of Strings.

Returns:
A commma-separated list of character constants.

toStringOfHalfWords

public String toStringOfHalfWords()
Enabled: Dump a comma-separated list of the words making up the bit set. Split each 64 bit number into two more manageable 32 bit numbers. This generates a comma-separated list of C++-like unsigned long constants.


toStringOfWords

public String toStringOfWords()
Enabled: Dump a comma-separated list of the words making up the bit set. This generates a comma-separated list of Java-like long int constants.


toStringWithRanges

public String toStringWithRanges(String separator,
                                 CharFormatter formatter)
Enabled: Print out the bit set but collapse char ranges.


wordNumber

private static final int wordNumber(int bit)


comments?