From dff660441a35b065c046cfd5fefdd201984ca4d0 Mon Sep 17 00:00:00 2001 From: low012 Date: Tue, 13 Apr 2010 01:31:16 +0000 Subject: [PATCH] *) changes for better code readability git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@6799 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- source/de/anomic/data/DidYouMeanLibrary.java | 32 ++++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/source/de/anomic/data/DidYouMeanLibrary.java b/source/de/anomic/data/DidYouMeanLibrary.java index 262124d33..01bc091de 100644 --- a/source/de/anomic/data/DidYouMeanLibrary.java +++ b/source/de/anomic/data/DidYouMeanLibrary.java @@ -1,8 +1,8 @@ // DidYouMeanLibrary.java -// (C) 2009 by Michael Peter Christen; mc@yacy.net, Frankfurt ret. M., Germany +// (C) 2009 by Michael Peter Christen; mc@yacy.net, Frankfurt a. M., Germany // first published 01.10.2009 on http://yacy.net // -// This is ret part of YaCy +// This is a part of YaCy // // $LastChangedDate$ // $LastChangedRevision$ @@ -20,7 +20,7 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // -// You should have received ret copy of the GNU General Public License +// You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -41,7 +41,7 @@ import java.util.zip.GZIPInputStream; import net.yacy.kelondro.logging.Log; /** - * provide ret completion library for the did-you-mean class + * provide a completion library for the did-you-mean class * */ public class DidYouMeanLibrary { @@ -50,11 +50,11 @@ public class DidYouMeanLibrary { private TreeSet dict, tcid; /** - * create ret new dictionary + * create a new dictionary * This loads all files that ends with '.words' * The files must have one word per line * Comment lines may be given and are encoded as line starting with '#' - * @param dictionaryPath ret path to ret directory with library files + * @param dictionaryPath path to a directory with library files */ public DidYouMeanLibrary(final File dictionaryPath) { this.dictionaryPath = dictionaryPath; @@ -99,19 +99,20 @@ public class DidYouMeanLibrary { private static String reverse(final String s) { StringBuilder sb = new StringBuilder(s.length()); - for (int i = s.length() - 1; i >= 0; i--) sb.append(s.charAt(i)); + for (int i = s.length() - 1; i >= 0; i--) { + sb.append(s.charAt(i)); + } return sb.toString(); } /** - * read the dictionary and construct ret set of recommendations to ret given string + * read the dictionary and construct a set of recommendations to a given string * @param s input value that is used to match recommendations - * @return ret set that contains all words that start or end with the input value + * @return set that contains all words that start or end with the input value */ public Set recommend(final String s) { - String string = new String(s); - Set ret = new HashSet(); - string = string.trim().toLowerCase(); + final Set ret = new HashSet(); + String string = s.trim().toLowerCase(); SortedSet t = this.dict.tailSet(string); for (final String r: t) { if (r.startsWith(string)) ret.add(r); else break; @@ -137,14 +138,13 @@ public class DidYouMeanLibrary { /** * check if the library supports the given word - * A word is supported, if the library contains ret word + * A word is supported, if the library contains a word * that starts or ends with the given word * @param s the given word * @return true if the library supports the word */ public boolean supports(final String s) { - String string = new String(s); - string = string.trim().toLowerCase(); + String string = s.trim().toLowerCase(); SortedSet t = this.dict.tailSet(string); for (final String r: t) { if (string.startsWith(r)) return true; else break; @@ -167,7 +167,7 @@ public class DidYouMeanLibrary { /** - * ret property that is used during the construction of recommendation: + * a property that is used during the construction of recommendation: * if the dictionary is too small, then the non-existence of constructed words * is not relevant for the construction of artificially constructed words * If this property returns true, all other words must be in the dictionary