public class BitSet
extends java.lang.Object
implements java.lang.Cloneable
Modifier and Type | Field and Description |
---|---|
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 and Description |
---|
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
|
Modifier and Type | Method and Description |
---|---|
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) |
java.lang.Object |
clone() |
int |
degree() |
boolean |
equals(java.lang.Object obj)
code "inherited" from java.util.BitSet
|
static Vector |
getRanges(int[] elems)
Find ranges in a set element array.
|
void |
growToInclude(int bit)
Grows the set to a larger number of bits.
|
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) |
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() |
long[] |
toPackedArray() |
java.lang.String |
toString() |
java.lang.String |
toString(java.lang.String separator)
Transform a bit set into a string by formatting each element as an integer
|
java.lang.String |
toString(java.lang.String separator,
CharFormatter formatter)
Transform a bit set into a string of characters.
|
java.lang.String |
toString(java.lang.String separator,
Vector vocabulary)
Create a string representation where instead of integer elements, the
ith element of vocabulary is displayed instead.
|
java.lang.String |
toStringOfHalfWords()
Dump a comma-separated list of the words making up the bit set.
|
java.lang.String |
toStringOfWords()
Dump a comma-separated list of the words making up the bit set.
|
java.lang.String |
toStringWithRanges(java.lang.String separator,
CharFormatter formatter)
Print out the bit set but collapse char ranges.
|
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
public BitSet()
public BitSet(long[] bits_)
public BitSet(int nbits)
nbits
- The size of the bitset in bitspublic void add(int el)
public void andInPlace(BitSet a)
public void clear()
public void clear(int el)
public java.lang.Object clone()
clone
in class java.lang.Object
public int degree()
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public static Vector getRanges(int[] elems)
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 void orInPlace(BitSet a)
public void remove(int el)
public int size()
public int lengthInLongWords()
public boolean subset(BitSet a)
public void subtractInPlace(BitSet a)
public int[] toArray()
public long[] toPackedArray()
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toString(java.lang.String separator)
public java.lang.String toString(java.lang.String separator, CharFormatter formatter)
formatter
- An object implementing the CharFormatter interface.public java.lang.String toString(java.lang.String separator, Vector vocabulary)
public java.lang.String toStringOfHalfWords()
public java.lang.String toStringOfWords()
public java.lang.String toStringWithRanges(java.lang.String separator, CharFormatter formatter)