CheckedRemove removes the integer x from the bitmap and return true if the integer was effectively removed (and false if the integer was not present)
(x uint32)
| 1221 | |
| 1222 | // CheckedRemove removes the integer x from the bitmap and return true if the integer was effectively removed (and false if the integer was not present) |
| 1223 | func (rb *Bitmap) CheckedRemove(x uint32) bool { |
| 1224 | // TODO: add unit tests for this method |
| 1225 | hb := highbits(x) |
| 1226 | i := rb.highlowcontainer.getIndex(hb) |
| 1227 | if i >= 0 { |
| 1228 | C := rb.highlowcontainer.getWritableContainerAtIndex(i) |
| 1229 | oldcard := C.getCardinality() |
| 1230 | C = C.iremoveReturnMinimized(lowbits(x)) |
| 1231 | rb.highlowcontainer.setContainerAtIndex(i, C) |
| 1232 | if rb.highlowcontainer.getContainerAtIndex(i).isEmpty() { |
| 1233 | rb.highlowcontainer.removeAtIndex(i) |
| 1234 | return true |
| 1235 | } |
| 1236 | return C.getCardinality() < oldcard |
| 1237 | } |
| 1238 | return false |
| 1239 | } |
| 1240 | |
| 1241 | // IsEmpty returns true if the Bitmap is empty (it is faster than doing (GetCardinality() == 0)) |
| 1242 | func (rb *Bitmap) IsEmpty() bool { |
nothing calls this directly
no test coverage detected