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 |
Constructor and Description |
---|
BitSet()
Construct a bitset of size one word (64 bits)
|
BitSet(int nbits)
Construct a bitset given the size
|
BitSet(java.util.List items)
Construction from a list of integers
|
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)
|
private static long |
bitMask(int bitNumber) |
java.lang.Object |
clone() |
boolean |
equals(java.lang.Object other) |
void |
growToInclude(int bit)
Grows the set to a larger number of bits.
|
boolean |
isNil() |
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) |
int |
numBits() |
private int |
numWordsToHold(int el) |
static BitSet |
of(int el) |
static BitSet |
of(int a,
int b) |
static BitSet |
of(int a,
int b,
int c) |
static BitSet |
of(int a,
int b,
int c,
int d) |
BitSet |
or(BitSet a)
return this | a in a new set
|
void |
orInPlace(BitSet a) |
void |
remove(int el) |
private void |
setSize(int nwords)
Sets the size of a set.
|
int |
size() |
int[] |
toArray()
Is this contained within a?
|
long[] |
toPackedArray() |
java.lang.String |
toString() |
java.lang.String |
toString(java.lang.String[] tokenNames) |
private static int |
wordNumber(int bit) |
protected static final int BITS
protected static final int LOG_BITS
protected static final int MOD_MASK
protected long[] bits
public BitSet()
public BitSet(long[] bits_)
public BitSet(java.util.List items)
public BitSet(int nbits)
nbits
- The size of the bitset in bitspublic static BitSet of(int el)
public static BitSet of(int a, int b)
public static BitSet of(int a, int b, int c)
public static BitSet of(int a, int b, int c, int d)
public void add(int el)
public void growToInclude(int bit)
bit
- element that must fit in setpublic void orInPlace(BitSet a)
private void setSize(int nwords)
nwords
- how many words the new set should beprivate static final long bitMask(int bitNumber)
public java.lang.Object clone()
clone
in class java.lang.Object
public int size()
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public boolean member(int el)
public void remove(int el)
public boolean isNil()
private final int numWordsToHold(int el)
public int numBits()
public int lengthInLongWords()
public int[] toArray()
public long[] toPackedArray()
private static final int wordNumber(int bit)
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toString(java.lang.String[] tokenNames)