| |
|
| java.lang.Object antlr.collections.impl.BitSet
BitSet | public class BitSet implements 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 author: Pete Wells |
Field Summary | |
final protected static int | BITS | final protected static int | LOG_BITS | final protected static int | MOD_MASK | final protected static int | NIBBLE | 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) | | |
NIBBLE | final protected static int NIBBLE(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)
|
clear | public void clear()(Code) | | |
clear | public void clear(int el)(Code) | | |
degree | public int degree()(Code) | | |
equals | public boolean equals(Object obj)(Code) | | code "inherited" from java.util.BitSet
|
getRanges | public static Vector getRanges(int[] elems)(Code) | | Find ranges in a set element array. @param elems The array of
elements representing the set, usually from Bit Set.toArray().
Vector of ranges. |
growToInclude | public void growToInclude(int bit)(Code) | | Grows the set to a larger number of bits.
Parameters: bit - element that must fit in set |
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.
|
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(String separator)(Code) | | Transform a bit set into a string by formatting each element as an integer
A commma-separated list of values |
toString | public String toString(String separator, CharFormatter formatter)(Code) | | Transform a bit set into a string of characters.
Parameters: formatter - An object implementing the CharFormatter interface. A commma-separated list of character constants. |
toString | public String toString(String separator, Vector 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.
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.
|
|
|
|