func (ls *LevelDBStore) bitsetToDocs(bs *bitset.BitSet) ([]string, error) { var err error var docs []string for i, e := bs.NextSet(0); e; i, e = bs.NextSet(i + 1) { name, err := ls.DocumentIDToName(uint64(i)) if err != nil { break } docs = append(docs, name) } return docs, err }
func equalsBitSet(a *bitset.BitSet, b *Bitmap) bool { for i, e := a.NextSet(0); e; i, e = a.NextSet(i + 1) { if !b.ContainsInt(int(i)) { return false } } i := b.Iterator() for i.HasNext() { if !a.Test(uint(i.Next())) { return false } } return true }
func (p *smatPair) equalsBitSet(a *bitset.BitSet, b *Bitmap) bool { for i, e := a.NextSet(0); e; i, e = a.NextSet(i + 1) { if !b.ContainsInt(int(i)) { fmt.Printf("in a bitset, not b bitmap, i: %d\n", i) fmt.Printf(" a bitset: %s\n b bitmap: %s\n", a.String(), b.String()) return false } } i := b.Iterator() for i.HasNext() { v := i.Next() if !a.Test(uint(v)) { fmt.Printf("in b bitmap, not a bitset, v: %d\n", v) fmt.Printf(" a bitset: %s\n b bitmap: %s\n", a.String(), b.String()) return false } } return true }