1   /**
2    * Distribution License:
3    * JSword is free software; you can redistribute it and/or modify it under
4    * the terms of the GNU Lesser General Public License, version 2.1 or later
5    * as published by the Free Software Foundation. This program is distributed
6    * in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
7    * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
8    * See the GNU Lesser General Public License for more details.
9    *
10   * The License is available on the internet at:
11   *       http://www.gnu.org/copyleft/lgpl.html
12   * or by writing to:
13   *      Free Software Foundation, Inc.
14   *      59 Temple Place - Suite 330
15   *      Boston, MA 02111-1307, USA
16   *
17   * Copyright: 2005
18   *     The copyright to this program is held by its authors.
19   */
20  package org.crosswire.jsword.index.search;
21  
22  /**
23   * The DefaultSearchModifier provides a simple implementation of a
24   * SearchModifier.
25   * 
26   * @see gnu.lgpl.License The GNU Lesser General Public License for details.
27   * @author DM Smith
28   */
29  
30  public class DefaultSearchModifier implements SearchModifier {
31  
32      /**
33       * A default SearchModifier that returns all hits and does not rank the
34       * results.
35       */
36      public DefaultSearchModifier() {
37          ranked = false;
38          maxResults = Integer.MAX_VALUE;
39      }
40  
41      /*
42       * (non-Javadoc)
43       * 
44       * @see org.crosswire.jsword.index.search.SearchModifier#isRanked()
45       */
46      public boolean isRanked() {
47          return ranked;
48      }
49  
50      /**
51       * Set whether or not the search should be ranked.
52       * 
53       * @param newRanked
54       *            true if the search should be ranked
55       */
56      public void setRanked(boolean newRanked) {
57          ranked = newRanked;
58      }
59  
60      /*
61       * (non-Javadoc)
62       * 
63       * @see org.crosswire.jsword.index.search.SearchModifier#getMaxResults()
64       */
65      public int getMaxResults() {
66          return maxResults;
67      }
68  
69      /**
70       * The maximum number of results to provide. A value of Integer.MAX_VALUE,
71       * the default, means get all results.
72       * 
73       * @param newMaxResults
74       *            the maxResults to set
75       */
76      public void setMaxResults(int newMaxResults) {
77          maxResults = newMaxResults;
78      }
79  
80      /**
81       * The indicator of whether the request should be ranked.
82       */
83      private boolean ranked;
84  
85      /**
86       * The indicator of whether the request should be ranked.
87       */
88      private int maxResults;
89  
90      /**
91       * Serialization ID
92       */
93      private static final long serialVersionUID = 0L;
94  }
95