예제 #1
0
 /// <summary>
 /// Does in-place AND NOT of the bits provided by the
 /// iterator.
 /// </summary>
 public void AndNot(DocIdSetIterator iter)
 {
     if (iter is OpenBitSetIterator && iter.DocID == -1)
     {
         OpenBitSetIterator obs = (OpenBitSetIterator)iter;
         AndNot(obs.arr, obs.words);
         // advance after last doc that would be accepted if standard
         // iteration is used (to exhaust it):
         obs.Advance(numBits);
     }
     else if (iter is FixedBitSetIterator && iter.DocID == -1)
     {
         FixedBitSetIterator fbs = (FixedBitSetIterator)iter;
         AndNot(fbs.bits, fbs.numWords);
         // advance after last doc that would be accepted if standard
         // iteration is used (to exhaust it):
         fbs.Advance(numBits);
     }
     else
     {
         int doc;
         while ((doc = iter.NextDoc()) < numBits)
         {
             Clear(doc);
         }
     }
 }
예제 #2
0
 /// <summary>
 /// Does in-place AND of the bits provided by the
 /// iterator.
 /// </summary>
 public void And(DocIdSetIterator iter)
 {
     if (iter is OpenBitSetIterator && iter.DocID == -1)
     {
         OpenBitSetIterator obs = (OpenBitSetIterator)iter;
         And(obs.arr, obs.words);
         // advance after last doc that would be accepted if standard
         // iteration is used (to exhaust it):
         obs.Advance(numBits);
     }
     else if (iter is FixedBitSetIterator && iter.DocID == -1)
     {
         FixedBitSetIterator fbs = (FixedBitSetIterator)iter;
         And(fbs.bits, fbs.numWords);
         // advance after last doc that would be accepted if standard
         // iteration is used (to exhaust it):
         fbs.Advance(numBits);
     }
     else
     {
         if (numBits == 0)
         {
             return;
         }
         int disiDoc, bitSetDoc = NextSetBit(0);
         while (bitSetDoc != -1 && (disiDoc = iter.Advance(bitSetDoc)) < numBits)
         {
             Clear(bitSetDoc, disiDoc);
             disiDoc++;
             bitSetDoc = (disiDoc < numBits) ? NextSetBit(disiDoc) : -1;
         }
         if (bitSetDoc != -1)
         {
             Clear(bitSetDoc, numBits);
         }
     }
 }