Ejemplo n.º 1
0
        /// <summary>
        /// Perform an inplace NOT with the doc ids from a given <see cref="DocIdSetIterator"/>,
        /// clearing all the bits for each such doc id.
        /// These doc ids should be smaller than the maximum size passed to the
        /// constructor.
        /// </summary>
        public virtual void InPlaceNot(DocIdSetIterator disi)
        {
            int  doc;
            long size = Length; // LUCENENET specific - using Length in place of Size (since they are the same)

            while ((doc = disi.NextDoc()) < size)
            {
                FastClear(doc);
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Encode the document ids from a DocIdSetIterator. </summary>
 /// <param name="disi"> This DocIdSetIterator should provide document ids that are consistent
 ///              with <c>numValues</c> and <c>upperBound</c> as provided to the constructor.   </param>
 public virtual void EncodeFromDisi(DocIdSetIterator disi)
 {
     while (efEncoder.numEncoded < efEncoder.numValues)
     {
         int x = disi.NextDoc();
         if (x == DocIdSetIterator.NO_MORE_DOCS)
         {
             throw new System.ArgumentException("disi: " + disi.ToString() + "\nhas " + efEncoder.numEncoded + " docs, but at least " + efEncoder.numValues + " are required.");
         }
         efEncoder.EncodeNext(x);
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Perform an inplace AND with the doc ids from a given <see cref="DocIdSetIterator"/>,
        /// leaving only the bits set for which the doc ids are in common.
        /// These doc ids should be smaller than the maximum size passed to the
        /// constructor.
        /// </summary>
        public virtual void InPlaceAnd(DocIdSetIterator disi)
        {
            int bitSetDoc = NextSetBit(0);
            int disiDoc;

            while (bitSetDoc != -1 && (disiDoc = disi.Advance(bitSetDoc)) != DocIdSetIterator.NO_MORE_DOCS)
            {
                Clear(bitSetDoc, disiDoc);
                bitSetDoc = NextSetBit(disiDoc + 1);
            }
            if (bitSetDoc != -1)
            {
                Clear(bitSetDoc, Length); // LUCENENET specific - using Length in place of Size (since they are the same)
            }
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Construct an <see cref="OpenBitSetDISI"/> with its bits set
 /// from the doc ids of the given <see cref="DocIdSetIterator"/>.
 /// Also give a maximum size one larger than the largest doc id for which a
 /// bit may ever be set on this <see cref="OpenBitSetDISI"/>.
 /// </summary>
 public OpenBitSetDISI(DocIdSetIterator disi, int maxSize)
     : base(maxSize)
 {
     InPlaceOr(disi);
 }