Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
DefaultSearchModifier |
|
| 1.0;1 |
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 | * © CrossWire Bible Society, 2005 - 2016 | |
18 | */ | |
19 | package org.crosswire.jsword.index.search; | |
20 | ||
21 | /** | |
22 | * The DefaultSearchModifier provides a simple implementation of a | |
23 | * SearchModifier. | |
24 | * | |
25 | * @see gnu.lgpl.License The GNU Lesser General Public License for details. | |
26 | * @author DM Smith | |
27 | */ | |
28 | ||
29 | public class DefaultSearchModifier implements SearchModifier { | |
30 | ||
31 | /** | |
32 | * A default SearchModifier that returns all hits and does not rank the | |
33 | * results. | |
34 | */ | |
35 | 0 | public DefaultSearchModifier() { |
36 | 0 | ranked = false; |
37 | 0 | maxResults = Integer.MAX_VALUE; |
38 | 0 | } |
39 | ||
40 | /* | |
41 | * (non-Javadoc) | |
42 | * | |
43 | * @see org.crosswire.jsword.index.search.SearchModifier#isRanked() | |
44 | */ | |
45 | public boolean isRanked() { | |
46 | 0 | return ranked; |
47 | } | |
48 | ||
49 | /** | |
50 | * Set whether or not the search should be ranked. | |
51 | * | |
52 | * @param newRanked | |
53 | * true if the search should be ranked | |
54 | */ | |
55 | public void setRanked(boolean newRanked) { | |
56 | 0 | ranked = newRanked; |
57 | 0 | } |
58 | ||
59 | /* | |
60 | * (non-Javadoc) | |
61 | * | |
62 | * @see org.crosswire.jsword.index.search.SearchModifier#getMaxResults() | |
63 | */ | |
64 | public int getMaxResults() { | |
65 | 0 | return maxResults; |
66 | } | |
67 | ||
68 | /** | |
69 | * The maximum number of results to provide. A value of Integer.MAX_VALUE, | |
70 | * the default, means get all results. | |
71 | * | |
72 | * @param newMaxResults | |
73 | * the maxResults to set | |
74 | */ | |
75 | public void setMaxResults(int newMaxResults) { | |
76 | 0 | maxResults = newMaxResults; |
77 | 0 | } |
78 | ||
79 | /** | |
80 | * The indicator of whether the request should be ranked. | |
81 | */ | |
82 | private boolean ranked; | |
83 | ||
84 | /** | |
85 | * The indicator of whether the request should be ranked. | |
86 | */ | |
87 | private int maxResults; | |
88 | ||
89 | /** | |
90 | * Serialization ID | |
91 | */ | |
92 | private static final long serialVersionUID = 0L; | |
93 | } |