示例#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 OR of the bits provided by the
 ///  iterator.
 /// </summary>
 public void Or(DocIdSetIterator iter)
 {
     if (iter is OpenBitSetIterator && iter.DocID() == -1)
     {
         OpenBitSetIterator obs = (OpenBitSetIterator)iter;
         Or(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;
         Or(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)
         {
             Set(doc);
         }
     }
 }
示例#3
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);
         }
     }
 }