Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

- Cosmetics

Otis Gospodnetic7bbc7b154411
diff --git a/contrib/spellchecker/src/java/org/apache/lucene/search/spell/Dictionary.java b/contrib/spellchecker/src/java/org/apache/lucene/search/spell/Dictionary.java
index 979621abdeb..3bc240a3b40 100755
--- a/contrib/spellchecker/src/java/org/apache/lucene/search/spell/Dictionary.java
+++ b/contrib/spellchecker/src/java/org/apache/lucene/search/spell/Dictionary.java
@@ -24,10 +24,9 @@ import java.util.Iterator;
*/
public interface Dictionary {
- /**
- * return all the words present in the dictionnary
- * @return Iterator
- */
- public Iterator getWordsIterator();
-
+ /**
+ * Return all words present in the dictionary
+ * @return Iterator
+ */
+ Iterator getWordsIterator();
}
diff --git a/contrib/spellchecker/src/java/org/apache/lucene/search/spell/LuceneDictionary.java b/contrib/spellchecker/src/java/org/apache/lucene/search/spell/LuceneDictionary.java
index dd5fcc2947f..efdec68a900 100755
--- a/contrib/spellchecker/src/java/org/apache/lucene/search/spell/LuceneDictionary.java
+++ b/contrib/spellchecker/src/java/org/apache/lucene/search/spell/LuceneDictionary.java
@@ -47,7 +47,7 @@ public class LuceneDictionary implements Dictionary {
final class LuceneIterator implements Iterator {
private TermEnum termEnum;
private Term actualTerm;
- private boolean has_next_called;
+ private boolean hasNextCalled;
public LuceneIterator() {
try {
@@ -59,16 +59,16 @@ public class LuceneDictionary implements Dictionary {
public Object next() {
- if (!has_next_called) {
+ if (!hasNextCalled) {
hasNext();
}
- has_next_called = false;
+ hasNextCalled = false;
return (actualTerm != null) ? actualTerm.text() : null;
}
public boolean hasNext() {
- has_next_called = true;
+ hasNextCalled = true;
try {
// if there is still words
if (!termEnum.next()) {
@@ -90,6 +90,6 @@ public class LuceneDictionary implements Dictionary {
}
public void remove() {
- };
+ }
}
}
diff --git a/contrib/spellchecker/src/java/org/apache/lucene/search/spell/PlainTextDictionary.java b/contrib/spellchecker/src/java/org/apache/lucene/search/spell/PlainTextDictionary.java
index 36896017bb5..cd9abbfe246 100755
--- a/contrib/spellchecker/src/java/org/apache/lucene/search/spell/PlainTextDictionary.java
+++ b/contrib/spellchecker/src/java/org/apache/lucene/search/spell/PlainTextDictionary.java
@@ -27,10 +27,10 @@ import java.io.*;
/**
* Dictionary represented by a file text.
*
- * <p>Format allowed: 1 word per line:<br>
- * word1<br>
- * word2<br>
- * word3<br>
+ * <p/>Format allowed: 1 word per line:<br/>
+ * word1<br/>
+ * word2<br/>
+ * word3<br/>
*
* @author Nicolas Maisonneuve
*/
@@ -38,7 +38,7 @@ public class PlainTextDictionary implements Dictionary {
private BufferedReader in;
private String line;
- private boolean has_next_called;
+ private boolean hasNextCalled;
public PlainTextDictionary(File file) throws FileNotFoundException {
in = new BufferedReader(new FileReader(file));
@@ -55,16 +55,16 @@ public class PlainTextDictionary implements Dictionary {
final class fileIterator implements Iterator {
public Object next() {
- if (!has_next_called) {
+ if (!hasNextCalled) {
hasNext();
}
- has_next_called = false;
+ hasNextCalled = false;
return line;
}
public boolean hasNext() {
- has_next_called = true;
+ hasNextCalled = true;
try {
line = in.readLine();
} catch (IOException ex) {
@@ -77,7 +77,7 @@ public class PlainTextDictionary implements Dictionary {
public void remove() {
- };
+ }
}
}
diff --git a/contrib/spellchecker/src/java/org/apache/lucene/search/spell/SpellChecker.java b/contrib/spellchecker/src/java/org/apache/lucene/search/spell/SpellChecker.java
index f0923958d8f..3de068f987d 100755
--- a/contrib/spellchecker/src/java/org/apache/lucene/search/spell/SpellChecker.java
+++ b/contrib/spellchecker/src/java/org/apache/lucene/search/spell/SpellChecker.java
@@ -38,8 +38,8 @@ import java.util.*;
/**
* <p>
- * Spell Checker class (Main class) <br/>
- * (initially inspired by the David Spencer code).
+ * Spell Checker class (Main class) <br/>
+ * (initially inspired by the David Spencer code).
* </p>
*
* <p>Example Usage:
@@ -351,7 +351,7 @@ public class SpellChecker {
}
- protected void finalize () throws Throwable {
+ protected void finalize() throws Throwable {
if (reader!=null) {
reader.close();
}
diff --git a/contrib/spellchecker/src/java/org/apache/lucene/search/spell/SuggestWord.java b/contrib/spellchecker/src/java/org/apache/lucene/search/spell/SuggestWord.java
index 41a558ef2ee..b348edbff04 100755
--- a/contrib/spellchecker/src/java/org/apache/lucene/search/spell/SuggestWord.java
+++ b/contrib/spellchecker/src/java/org/apache/lucene/search/spell/SuggestWord.java
@@ -18,47 +18,43 @@ package org.apache.lucene.search.spell;
*/
/**
- * SuggestWord Class, used in suggestSimilar method in SpellChecker class.
+ * SuggestWord, used in suggestSimilar method in SpellChecker class.
*
* @author Nicolas Maisonneuve
*/
- final class SuggestWord {
- /**
- * the score of the word
- */
- public float score;
-
-
- /**
- * The freq of the word
- */
- public int freq;
-
-
- /**
- * the suggested word
- */
- public String string;
-
-
- public final int compareTo (SuggestWord a) {
- //first criteria: the edit distance
- if (score>a.score) {
- return 1;
- }
- if (score<a.score) {
- return-1;
- }
-
- //second criteria (if first criteria is equal): the popularity
- if (freq>a.freq) {
- return 1;
- }
+final class SuggestWord {
+ /**
+ * the score of the word
+ */
+ public float score;
+
+ /**
+ * The freq of the word
+ */
+ public int freq;
+
+ /**
+ * the suggested word
+ */
+ public String string;
+
+ public final int compareTo (SuggestWord a) {
+ //first criteria: the edit distance
+ if (score > a.score) {
+ return 1;
+ }
+ if (score < a.score) {
+ return -1;
+ }
- if (freq<a.freq) {
- return-1;
- }
+ //second criteria (if first criteria is equal): the popularity
+ if (freq > a.freq) {
+ return 1;
+ }
- return 0;
+ if (freq < a.freq) {
+ return -1;
}
+ return 0;
+ }
}
diff --git a/contrib/spellchecker/src/java/org/apache/lucene/search/spell/SuggestWordQueue.java b/contrib/spellchecker/src/java/org/apache/lucene/search/spell/SuggestWordQueue.java
index a96c29dbbc4..bd1765d41c9 100755
--- a/contrib/spellchecker/src/java/org/apache/lucene/search/spell/SuggestWordQueue.java
+++ b/contrib/spellchecker/src/java/org/apache/lucene/search/spell/SuggestWordQueue.java
@@ -17,25 +17,23 @@ package org.apache.lucene.search.spell;
* limitations under the License.
*/
-/**
- * to sort SuggestWord
- * @author Nicolas Maisonneuve
- */
import org.apache.lucene.util.PriorityQueue;
-final class SuggestWordQueue
-extends PriorityQueue {
-
- SuggestWordQueue (int size) {
- initialize(size);
- }
-
- protected final boolean lessThan (Object a, Object b) {
- SuggestWord wa=(SuggestWord) a;
- SuggestWord wb=(SuggestWord) b;
- int val=wa.compareTo(wb);
- return val<0;
- }
-
+/**
+ * Sorts SuggestWord instances
+ * @author Nicolas Maisonneuve
+ */
+final class SuggestWordQueue extends PriorityQueue {
+
+ SuggestWordQueue (int size) {
+ initialize(size);
+ }
+
+ protected final boolean lessThan (Object a, Object b) {
+ SuggestWord wa = (SuggestWord) a;
+ SuggestWord wb = (SuggestWord) b;
+ int val = wa.compareTo(wb);
+ return val < 0;
+ }
}