| |
|
| java.lang.Object org.antlr.misc.BitSet
BitSet | public class BitSet implements IntSet,Cloneable(Code) | | A BitSet to replace java.util.BitSet.
Primary differences are that most set operators return new sets
as opposed to oring and anding "in place". Further, a number of
operations were added. I cannot contain a BitSet because there
is no way to access the internal bits (which I need for speed)
and, because it is final, I cannot subclass to add functionality.
Consider defining set degree. Without access to the bits, I must
call a method n times to test the ith bit...ack!
Also seems like or() from util is wrong when size of incoming set is bigger
than this.bits.length.
author: Terence Parr |
Field Summary | |
final protected static int | BITS | final protected static int | LOG_BITS | final protected static int | MOD_MASK | protected long | bits |
BITS | final protected static int BITS(Code) | | |
LOG_BITS | final protected static int LOG_BITS(Code) | | |
MOD_MASK | final protected static int MOD_MASK(Code) | | |
bits | protected long bits(Code) | | The actual data bits
|
BitSet | public BitSet()(Code) | | Construct a bitset of size one word (64 bits)
|
BitSet | public BitSet(long[] bits_)(Code) | | Construction from a static array of longs
|
BitSet | public BitSet(int nbits)(Code) | | Construct a bitset given the size
Parameters: nbits - The size of the bitset in bits |
add | public void add(int el)(Code) | | or this element into this set (grow as necessary to accommodate)
|
addAll | public void addAll(int[] elements)(Code) | | |
clear | public void clear()(Code) | | |
clear | public void clear(int el)(Code) | | |
getSingleElement | public int getSingleElement()(Code) | | Get the first element you find and return it. Return Label.INVALID
otherwise.
|
growToInclude | public void growToInclude(int bit)(Code) | | Grows the set to a larger number of bits.
Parameters: bit - element that must fit in set |
isNil | public boolean isNil()(Code) | | |
lengthInLongWords | public int lengthInLongWords()(Code) | | return how much space is being used by the bits array not
how many actually have member bits on.
|
member | public boolean member(int el)(Code) | | |
notInPlace | public void notInPlace()(Code) | | |
notInPlace | public void notInPlace(int maxBit)(Code) | | complement bits in the range 0..maxBit.
|
notInPlace | public void notInPlace(int minBit, int maxBit)(Code) | | complement bits in the range minBit..maxBit.
|
numBits | public int numBits()(Code) | | |
remove | public void remove(int el)(Code) | | |
subset | public boolean subset(BitSet a)(Code) | | Is this contained within a?
|
subtractInPlace | public void subtractInPlace(BitSet a)(Code) | | 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()(Code) | | |
toPackedArray | public long[] toPackedArray()(Code) | | |
toString | public String toString(Grammar g)(Code) | | Transform a bit set into a string by formatting each element as an integer
separator The string to put in between elements
A commma-separated list of values |
toString | public String toString(String separator, List vocabulary)(Code) | | Create a string representation where instead of integer elements, the
ith element of vocabulary is displayed instead. Vocabulary is a Vector
of Strings.
separator The string to put in between elements
A commma-separated list of character constants. |
toStringOfHalfWords | public String toStringOfHalfWords()(Code) | | 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()(Code) | | 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.
|
|
|
|