|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.qtunes.db.spi.simple.WAHBitSet
public class WAHBitSet
WAHBitSet implements the Word-Aligned Hybrid compressed BitSet. Using WAH as the compression scheme the class achieves both compressaion and performance on bitset operations.
Nested Class Summary | |
---|---|
class |
WAHBitSet.IndexSet
The IndexSet stores positions of bits that are one. |
Constructor Summary | |
---|---|
WAHBitSet()
Create an empty bitset. |
|
WAHBitSet(BitSet set)
Initialize the compressed bitset withn an uncompressed bitset. |
Method Summary | |
---|---|
WAHBitSet |
and(WAHBitSet other)
Returns a new WAH compressed bitset after anding the current bitset with the other bitset. |
int |
andSize(WAHBitSet other)
This is an optimization over the and function. |
int |
cardinality()
Returns the number of 1 bits in the bitset. |
boolean |
get(int i)
Checks if the bit is set in the compressed bitset. |
BitSet |
getBitSet(BitSet set)
Return a BitSet which has the same values set as this WAHBitSet |
WAHBitSet.IndexSet |
getIndexSet()
Returns an index set for the set bits in the bitset. |
Iterator |
iterator()
Returns an iterator for the set bits in the bitset. |
long |
memSize()
Returns the amount of memory used by the compressed bit set |
WAHBitSet |
or(WAHBitSet other)
Returns a new WAH compressed bitset after oring the current bitset with the other bitset. |
void |
set(int i)
Sets the index i to one. expands the bitset if required. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public WAHBitSet()
public WAHBitSet(BitSet set)
set
- the uncompressed bitset.Method Detail |
---|
public BitSet getBitSet(BitSet set)
set
- the Set to populate and return - if null, a new BitSet is createdpublic void set(int i)
i
- the index to set as 1.public boolean get(int i)
i
- the index where bit is checked.
public int cardinality()
public Iterator iterator()
public WAHBitSet.IndexSet getIndexSet()
public long memSize()
public WAHBitSet and(WAHBitSet other)
other
- the bitset to and with
public WAHBitSet or(WAHBitSet other)
other
- the bitset to or with
public int andSize(WAHBitSet other)
other
- the bitset to and with.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |