QueryResponses.cs, DumpIndex.cs, IQueryResult.cs, QueryExecutor.cs, QueryResult.cs...
[beagle.git] / beagled / Lucene.Net / Search / HitIterator.cs
blobb344a7fc15435be35351d06874fa400f70b8bca5
1 /*
2 * Copyright 2005 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.
17 using System;
19 namespace Lucene.Net.Search
22 /// <summary> An iterator over {@link Hits} that provides lazy fetching of each document.
23 /// {@link Hits#Iterator()} returns an instance of this class. Calls to {@link #next()}
24 /// return a {@link Hit} instance.
25 ///
26 /// </summary>
27 /// <author> Jeremy Rayner
28 /// </author>
29 public class HitIterator : System.Collections.IEnumerator
31 /// <summary> Returns a {@link Hit} instance representing the next hit in {@link Hits}.
32 ///
33 /// </summary>
34 /// <returns> Next {@link Hit}.
35 /// </returns>
36 public virtual System.Object Current
38 get
40 if (hitNumber == hits.Length())
41 throw new System.ArgumentOutOfRangeException();
43 System.Object next = new Hit(hits, hitNumber);
44 hitNumber++;
45 return next;
49 private Hits hits;
50 private int hitNumber = 0;
52 /// <summary> Constructed from {@link Hits#Iterator()}.</summary>
53 internal HitIterator(Hits hits)
55 this.hits = hits;
58 /// <returns> true if current hit is less than the total number of {@link Hits}.
59 /// </returns>
60 public virtual bool MoveNext()
62 return hitNumber < hits.Length();
65 /// <summary> Unsupported operation.
66 ///
67 /// </summary>
68 /// <throws> UnsupportedOperationException </throws>
69 public virtual void Remove()
71 throw new System.NotSupportedException();
74 /// <summary> Returns the total number of hits.</summary>
75 public virtual int Length()
77 return hits.Length();
79 //UPGRADE_TODO: The following method was automatically generated and it must be implemented in order to preserve the class logic. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1232'"
80 virtual public void Reset()