Lucene.Net  3.0.3
Lucene.Net is a .NET port of the Java Lucene Indexing Library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties
OpenBitSetDISI.cs
Go to the documentation of this file.
1 /*
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
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
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.
16  */
17 
18 using System;
19 
20 using DocIdSetIterator = Lucene.Net.Search.DocIdSetIterator;
21 
22 namespace Lucene.Net.Util
23 {
24 
25  [Serializable]
27  {
28 
34  public OpenBitSetDISI(DocIdSetIterator disi, int maxSize):base(maxSize)
35  {
36  InPlaceOr(disi);
37  }
38 
43  public OpenBitSetDISI(int maxSize):base(maxSize)
44  {
45  }
46 
52  public virtual void InPlaceOr(DocIdSetIterator disi)
53  {
54  int doc;
55  long size = Size();
56  while ((doc = disi.NextDoc()) < size)
57  {
58  FastSet(doc);
59  }
60  }
61 
67  public virtual void InPlaceAnd(DocIdSetIterator disi)
68  {
69  int bitSetDoc = NextSetBit(0);
70  int disiDoc;
71  while (bitSetDoc != - 1 && (disiDoc = disi.Advance(bitSetDoc)) != DocIdSetIterator.NO_MORE_DOCS)
72  {
73  Clear(bitSetDoc, disiDoc);
74  bitSetDoc = NextSetBit(disiDoc + 1);
75  }
76  if (bitSetDoc != - 1)
77  {
78  Clear(bitSetDoc, Size());
79  }
80  }
81 
87  public virtual void InPlaceNot(DocIdSetIterator disi)
88  {
89  int doc;
90  long size = Size();
91  while ((doc = disi.NextDoc()) < size)
92  {
93  FastClear(doc);
94  }
95  }
96 
102  public virtual void InPlaceXor(DocIdSetIterator disi)
103  {
104  int doc;
105  long size = Size();
106  while ((doc = disi.NextDoc()) < size)
107  {
108  FastFlip(doc);
109  }
110  }
111  }
112 }