Ejemplo n.º 1
0
            public override int Advance(int target)
            {
                int d = BitSetSupport.NextSetBit(bitSet, target);

                // -1 returned by BitSet.nextSetBit() when exhausted
                docId = d == -1?NO_MORE_DOCS:d;
                return(docId);
            }
Ejemplo n.º 2
0
            public override int NextDoc()
            {
                // (docId + 1) on next line requires -1 initial value for docNr:
                int d = BitSetSupport.NextSetBit(bitSet, docId + 1);

                // -1 returned by BitSet.nextSetBit() when exhausted
                docId = d == -1?NO_MORE_DOCS:d;
                return(docId);
            }
Ejemplo n.º 3
0
 public virtual void  Collect(int doc, float score)
 {
     pos = BitSetSupport.NextSetBit(answer, pos + 1);
     if (pos != doc + docBase)
     {
         throw new System.SystemException("Expected doc " + pos + " but got " + doc + docBase);
     }
     base.Collect(doc);
 }
Ejemplo n.º 4
0
        internal virtual void  DoNextSetBit(System.Collections.BitArray a, OpenBitSet b)
        {
            int aa = -1, bb = -1;

            do
            {
                aa = BitSetSupport.NextSetBit(a, aa + 1);
                bb = b.NextSetBit(bb + 1);
                Assert.AreEqual(aa, bb);
            }while (aa >= 0);
        }
Ejemplo n.º 5
0
        internal virtual void  DoIterate2(System.Collections.BitArray a, OpenBitSet b)
        {
            int aa = -1, bb = -1;
            OpenBitSetIterator iterator = new OpenBitSetIterator(b);

            do
            {
                aa = BitSetSupport.NextSetBit(a, aa + 1);
                bb = rand.NextDouble() > 0.5 ? iterator.NextDoc(null) : iterator.Advance(bb + 1, null);
                Assert.AreEqual(aa == -1?DocIdSetIterator.NO_MORE_DOCS:aa, bb);
            }while (aa >= 0);
        }
Ejemplo n.º 6
0
        /// <summary> Create a SortedVIntList from a BitSet.</summary>
        /// <param name="bits"> A bit set representing a set of integers.
        /// </param>
        public SortedVIntList(System.Collections.BitArray bits)
        {
            SortedVIntListBuilder builder = new SortedVIntListBuilder(this);
            int nextInt = BitSetSupport.NextSetBit(bits, 0);

            while (nextInt != -1)
            {
                builder.AddInt(nextInt);
                nextInt = BitSetSupport.NextSetBit(bits, nextInt + 1);
            }
            builder.Done();
        }