View Javadoc

1   /*
2    * Copyright 2003-2005 Michael Franken, Zilverline.
3    *
4    * The contents of this file, or the files included with this file, are subject to
5    * the current version of ZILVERLINE Collaborative Source License for the
6    * Zilverline Search Engine (the "License"); You may not use this file except in
7    * compliance with the License.
8    *
9    * You may obtain a copy of the License at
10   *
11   *     http://www.zilverline.org.
12   *
13   * See the License for the rights, obligations and
14   * limitations governing use of the contents of the file.
15   *
16   * The Original and Upgraded Code is the Zilverline Search Engine. The developer of
17   * the Original and Upgraded Code is Michael Franken. Michael Franken owns the
18   * copyrights in the portions it created. All Rights Reserved.
19   *
20   */
21  
22  package org.zilverline.core;
23  
24  /***
25   * The SearchResult represent the result of a Search. It contains the number of hits and the results, as well as the starting and
26   * ending number of the result. So possibly an Array of 20 results, from 234 hits, results 21 to 40.
27   * 
28   * @author Michael Franken
29   * @version $Revision: 1.4 $
30   * 
31   * @see org.zilverline.core.FileSystemCollection
32   */
33  public final class SearchResult {
34  
35      /***
36       * Create a SearchResult with the number of hits and the results, as well as the starting and ending number of the result. So
37       * possibly an Array of 20 results, from 234 hits, results 21 to 40.
38       * 
39       * @param thisResults the array of Results
40       * @param thisNumberOfHits the total number of Hits, probably larger than the results
41       * @param thisStartAt the first results 'offset' into all hits
42       * @param thisEndAt the last results 'offset' into all hits
43       */
44      public SearchResult(final Result[] thisResults, final int thisNumberOfHits, final int thisStartAt, final int thisEndAt) {
45          results = thisResults;
46          numberOfHits = thisNumberOfHits;
47          startAt = thisStartAt;
48          endAt = thisEndAt;
49      }
50  
51      /*** The results. */
52      private Result[] results;
53  
54      /*** The number of results. */
55      private int numberOfHits;
56  
57      /*** The first results 'offset' into all hits. */
58      private int endAt;
59  
60      /*** The last results 'offset' into all hits. */
61      private int startAt;
62  
63      /***
64       * Returns the the total number of Hits. Probably larger than the size if results
65       * 
66       * @return numberOfHits
67       */
68      public int getNumberOfHits() {
69          return numberOfHits;
70      }
71  
72      /***
73       * Returns the results as an Array.
74       * 
75       * @return results
76       */
77      public Result[] getResults() {
78          return results;
79      }
80  
81      /***
82       * Returns offset into all Hits of the last Result.
83       * 
84       * @return Returns the endAt.
85       */
86      public int getEndAt() {
87          return endAt;
88      }
89  
90      /***
91       * Returns offset into all Hits of the first Result.
92       * 
93       * @return Returns the startAt.
94       */
95      public int getStartAt() {
96          return startAt;
97      }
98  }