ComboBitset: Add Javadoc

Change-Id: I799991327cadf646329eacbac40d41cb1b3391ad
This commit is contained in:
Han-Wen Nienhuys 2023-07-31 20:02:56 +02:00 committed by Ivan Frade
parent c46b54eeac
commit ac70632f51
1 changed files with 8 additions and 0 deletions

View File

@ -86,6 +86,11 @@ int findOrInsert(AnyObjectId objectId, int type) {
return position;
}
/**
* A bitset for representing small changes (set/remove individual bits)
* relative to an existing EWAH bitmap. Executing bit-vector operations will
* materialize the changes into a fresh EWAH bitmap
*/
private static final class ComboBitset {
private InflatingBitSet inflatingBitmap;
@ -121,18 +126,21 @@ EWAHCompressedBitmap combine() {
return inflatingBitmap.getBitmap();
}
/* In-place or operation */
void or(EWAHCompressedBitmap inbits) {
if (toRemove != null)
combine();
inflatingBitmap = inflatingBitmap.or(inbits);
}
/* In-place andNot operation */
void andNot(EWAHCompressedBitmap inbits) {
if (toAdd != null || toRemove != null)
combine();
inflatingBitmap = inflatingBitmap.andNot(inbits);
}
/* In-place xor operation. */
void xor(EWAHCompressedBitmap inbits) {
if (toAdd != null || toRemove != null)
combine();