Thumbnail file hits. Based on a patch from D Bera
[beagle.git] / beagled / Lucene.Net / Index / TermEnum.cs
blob03c4283e61625b939244525d4fe047f3a2381832
1 /*
2 * Copyright 2004 The Apache Software Foundation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 using System;
17 namespace Lucene.Net.Index
20 /// <summary>Abstract class for enumerating terms.
21 /// <p>Term enumerations are always ordered by Term.compareTo(). Each term in
22 /// the enumeration is greater than all that precede it.
23 /// </summary>
25 public abstract class TermEnum
27 /// <summary>Increments the enumeration to the next element. True if one exists.</summary>
28 public abstract bool Next();
30 /// <summary>Returns the current Term in the enumeration.</summary>
31 public abstract Term Term();
33 /// <summary>Returns the docFreq of the current Term in the enumeration.</summary>
34 public abstract int DocFreq();
36 /// <summary>Closes the enumeration to further activity, freeing resources. </summary>
37 public abstract void Close();
39 // Term Vector support
41 /// <summary>Skips terms to the first beyond the current whose value is
42 /// greater or equal to <i>target</i>. <p>Returns true iff there is such
43 /// an entry. <p>Behaves as if written: <pre>
44 /// public boolean skipTo(Term target) {
45 /// do {
46 /// if (!next())
47 /// return false;
48 /// } while (target > term());
49 /// return true;
50 /// }
51 /// </pre>
52 /// Some implementations are considerably more efficient than that.
53 /// </summary>
54 public virtual bool SkipTo(Term target)
56 do
58 if (!Next())
59 return false;
61 while (target.CompareTo(Term()) > 0);
62 return true;