|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectat.dms.compiler.tools.antlr.runtime.BitSet
public class BitSet
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.
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()
Construct a bitset of size one word (64 bits) |
|
BitSet(int nbits)
Construct a bitset given the size |
|
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) |
BitSet |
and(BitSet a)
|
void |
andInPlace(BitSet a)
|
void |
clear()
|
void |
clear(int el)
|
Object |
clone()
|
int |
degree()
|
boolean |
equals(Object obj)
code "inherited" from java.util.BitSet |
void |
growToInclude(int bit)
Grows the set to a larger number of bits. |
boolean |
member(int el)
|
boolean |
nil()
|
BitSet |
not()
|
void |
notInPlace()
|
void |
notInPlace(int maxBit)
complement bits in the range 0..maxBit. |
void |
notInPlace(int minBit,
int maxBit)
complement bits in the range minBit..maxBit. |
static BitSet |
of(int el)
|
BitSet |
or(BitSet a)
return this | a in a new set |
void |
orInPlace(BitSet a)
|
void |
remove(int el)
|
int |
size()
|
boolean |
subset(BitSet a)
Is this contained within a? |
void |
subtractInPlace(BitSet a)
Subtract the elements of 'a' from 'this' in-place. |
int[] |
toArray()
|
String |
toString()
|
String |
toString(String separator)
Transform a bit set into a string by formatting each element as an integer |
String |
toString(String separator,
CharFormatter formatter)
Transform a bit set into a string of characters. |
String |
toString(String separator,
Vector vocabulary)
Create a string representation where instead of integer elements, the ith element of vocabulary is displayed instead. |
String |
toStringOfHalfWords()
Dump a comma-separated list of the words making up the bit set. |
String |
toStringOfWords()
Dump a comma-separated list of the words making up the bit set. |
String |
toStringWithRanges(String separator,
CharFormatter formatter)
Print out the bit set but collapse char ranges. |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected static final int BITS
protected static final int NIBBLE
protected static final int LOG_BITS
protected static final int MOD_MASK
protected long[] bits
Constructor Detail |
---|
public BitSet()
public BitSet(long[] bits_)
public BitSet(int nbits)
nbits
- The size of the bitset in bitsMethod Detail |
---|
public void add(int el)
public BitSet and(BitSet a)
public void andInPlace(BitSet a)
public void clear()
public void clear(int el)
public Object clone()
clone
in class Object
public int degree()
public boolean equals(Object obj)
equals
in class Object
public void growToInclude(int bit)
bit
- element that must fit in setpublic boolean member(int el)
public boolean nil()
public BitSet not()
public void notInPlace()
public void notInPlace(int maxBit)
public void notInPlace(int minBit, int maxBit)
public static BitSet of(int el)
public BitSet or(BitSet a)
public void orInPlace(BitSet a)
public void remove(int el)
public int size()
public boolean subset(BitSet a)
public void subtractInPlace(BitSet a)
public int[] toArray()
public String toString()
toString
in class Object
public String toString(String separator)
separator
- The string to put in between elements
public String toString(String separator, CharFormatter formatter)
separator
- The string to put in between elementsformatter
- An object implementing the CharFormatter interface.
public String toString(String separator, Vector vocabulary)
separator
- The string to put in between elements
public String toStringOfHalfWords()
public String toStringOfWords()
public String toStringWithRanges(String separator, CharFormatter formatter)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |