MCPcopy
hub / github.com/RoaringBitmap/roaring / IntersectsWithInterval

Method IntersectsWithInterval

roaring.go:1516–1535  ·  view source on GitHub ↗

IntersectsWithInterval checks whether a bitmap 'rb' and an open interval '[x,y)' intersect.

(x, y uint64)

Source from the content-addressed store, hash-verified

1514
1515// IntersectsWithInterval checks whether a bitmap 'rb' and an open interval '[x,y)' intersect.
1516func (rb *Bitmap) IntersectsWithInterval(x, y uint64) bool {
1517 if x >= y {
1518 return false
1519 }
1520 if x > MaxUint32 {
1521 return false
1522 }
1523
1524 it := intIterator{}
1525 it.Initialize(rb)
1526 it.AdvanceIfNeeded(uint32(x))
1527 if !it.HasNext() {
1528 return false
1529 }
1530 if uint64(it.Next()) >= y {
1531 return false
1532 }
1533
1534 return true
1535}
1536
1537// Intersects checks whether two bitmap intersects, bitmaps are not modified
1538func (rb *Bitmap) Intersects(x2 *Bitmap) bool {

Callers 1

Calls 4

InitializeMethod · 0.95
AdvanceIfNeededMethod · 0.95
HasNextMethod · 0.95
NextMethod · 0.95

Tested by 1