|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.googlecode.javaewah.datastructure.StaticBitSet
public class StaticBitSet
This is an optimized version of Java's BitSet.
Constructor Summary | |
---|---|
StaticBitSet(int sizeinbits)
Construct a bitset with the specified number of bits (initially all false). |
Method Summary | |
---|---|
int |
cardinality()
Compute the number of bits set to 1 |
void |
clear()
Reset all bits to false |
boolean |
get(int i)
|
int |
nextSetBit(int i)
Usage: for(int i=bs.nextSetBit(0); i>=0; i=bs.nextSetBit(i+1)) { operate on index i here } |
int |
nextUnsetBit(int i)
Usage: for(int i=bs.nextUnsetBit(0); i>=0; i=bs.nextUnsetBit(i+1)) { operate on index i here } |
void |
resize(int sizeinbits)
Resize the bitset |
void |
set(int i)
Set to true |
void |
set(int i,
boolean b)
|
int |
size()
Query the size |
void |
unset(int i)
Set to false |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public StaticBitSet(int sizeinbits)
sizeinbits
- the size in bitsMethod Detail |
---|
public int size()
public void resize(int sizeinbits)
sizeinbits
- new number of bitspublic void clear()
public int cardinality()
public boolean get(int i)
i
- index
public void set(int i)
i
- index of the bitpublic void unset(int i)
i
- index of the bitpublic void set(int i, boolean b)
i
- indexb
- value of the bitpublic int nextSetBit(int i)
i
- current set bit
public int nextUnsetBit(int i)
i
- current unset bit
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |