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 it's authors.
19   *
20   * ID: $Id:DefaultSearchModifier.java 984 2006-01-23 14:18:33 -0500 (Mon, 23 Jan 2006) dmsmith $
21   */
22  package org.crosswire.jsword.index.search;
23  
24  /**
25   * The DefaultSearchModifier provides a simple implementation of a
26   * SearchModifier.
27   * 
28   * @see gnu.lgpl.License for license details.<br>
29   *      The copyright to this program is held by it's authors.
30   * @author DM Smith
31   */
32  
33  public class DefaultSearchModifier implements SearchModifier {
34  
35      /**
36       * A default SearchModifier that returns all hits and does not rank the
37       * results.
38       */
39      public DefaultSearchModifier() {
40          ranked = false;
41          maxResults = Integer.MAX_VALUE;
42      }
43  
44      /*
45       * (non-Javadoc)
46       * 
47       * @see org.crosswire.jsword.index.search.SearchModifier#isRanked()
48       */
49      public boolean isRanked() {
50          return ranked;
51      }
52  
53      /**
54       * Set whether or not the search should be ranked.
55       * 
56       * @param newRanked
57       *            true if the search should be ranked
58       */
59      public void setRanked(boolean newRanked) {
60          ranked = newRanked;
61      }
62  
63      /*
64       * (non-Javadoc)
65       * 
66       * @see org.crosswire.jsword.index.search.SearchModifier#getMaxResults()
67       */
68      public int getMaxResults() {
69          return maxResults;
70      }
71  
72      /**
73       * The maximum number of results to provide. A value of Integer.MAX_VALUE,
74       * the default, means get all results.
75       * 
76       * @param newMaxResults
77       *            the maxResults to set
78       */
79      public void setMaxResults(int newMaxResults) {
80          maxResults = newMaxResults;
81      }
82  
83      /**
84       * The indicator of whether the request should be ranked.
85       */
86      private boolean ranked;
87  
88      /**
89       * The indicator of whether the request should be ranked.
90       */
91      private int maxResults;
92  
93      /**
94       * Serialization ID
95       */
96      private static final long serialVersionUID = 0L;
97  }
98