2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
20 using DocIdSetIterator = Mono.Lucene.Net.Search.DocIdSetIterator;
22 namespace Mono.Lucene.Net.Util
26 public class OpenBitSetDISI:OpenBitSet
29 /// <summary>Construct an OpenBitSetDISI with its bits set
30 /// from the doc ids of the given DocIdSetIterator.
31 /// Also give a maximum size one larger than the largest doc id for which a
32 /// bit may ever be set on this OpenBitSetDISI.
34 public OpenBitSetDISI(DocIdSetIterator disi, int maxSize):base(maxSize)
39 /// <summary>Construct an OpenBitSetDISI with no bits set, and a given maximum size
40 /// one larger than the largest doc id for which a bit may ever be set
41 /// on this OpenBitSetDISI.
43 public OpenBitSetDISI(int maxSize):base(maxSize)
47 /// <summary> Perform an inplace OR with the doc ids from a given DocIdSetIterator,
48 /// setting the bit for each such doc id.
49 /// These doc ids should be smaller than the maximum size passed to the
52 public virtual void InPlaceOr(DocIdSetIterator disi)
56 while ((doc = disi.NextDoc()) < size)
62 /// <summary> Perform an inplace AND with the doc ids from a given DocIdSetIterator,
63 /// leaving only the bits set for which the doc ids are in common.
64 /// These doc ids should be smaller than the maximum size passed to the
67 public virtual void InPlaceAnd(DocIdSetIterator disi)
69 int bitSetDoc = NextSetBit(0);
71 while (bitSetDoc != - 1 && (disiDoc = disi.Advance(bitSetDoc)) != DocIdSetIterator.NO_MORE_DOCS)
73 Clear(bitSetDoc, disiDoc);
74 bitSetDoc = NextSetBit(disiDoc + 1);
78 Clear(bitSetDoc, Size());
82 /// <summary> Perform an inplace NOT with the doc ids from a given DocIdSetIterator,
83 /// clearing all the bits for each such doc id.
84 /// These doc ids should be smaller than the maximum size passed to the
87 public virtual void InPlaceNot(DocIdSetIterator disi)
91 while ((doc = disi.NextDoc()) < size)
97 /// <summary> Perform an inplace XOR with the doc ids from a given DocIdSetIterator,
98 /// flipping all the bits for each such doc id.
99 /// These doc ids should be smaller than the maximum size passed to the
102 public virtual void InPlaceXor(DocIdSetIterator disi)
106 while ((doc = disi.NextDoc()) < size)