X-Git-Url: https://git.mdrn.pl/pylucene.git/blobdiff_plain/a2e61f0c04805cfcb8706176758d1283c7e3a55c..aaeed5504b982cf3545252ab528713250aa33eed:/lucene-java-3.4.0/lucene/contrib/spellchecker/src/java/org/apache/lucene/search/suggest/BufferingTermFreqIteratorWrapper.java diff --git a/lucene-java-3.4.0/lucene/contrib/spellchecker/src/java/org/apache/lucene/search/suggest/BufferingTermFreqIteratorWrapper.java b/lucene-java-3.4.0/lucene/contrib/spellchecker/src/java/org/apache/lucene/search/suggest/BufferingTermFreqIteratorWrapper.java deleted file mode 100644 index e67e89b..0000000 --- a/lucene-java-3.4.0/lucene/contrib/spellchecker/src/java/org/apache/lucene/search/suggest/BufferingTermFreqIteratorWrapper.java +++ /dev/null @@ -1,65 +0,0 @@ -package org.apache.lucene.search.suggest; - - -import java.util.ArrayList; -import java.util.List; - -import org.apache.lucene.search.spell.TermFreqIterator; - -/** - * This wrapper buffers incoming elements. - */ -public class BufferingTermFreqIteratorWrapper implements TermFreqIterator { - - /** Entry in the buffer. */ - public static final class Entry implements Comparable { - String word; - float freq; - - public Entry(String word, float freq) { - this.word = word; - this.freq = freq; - } - - public int compareTo(Entry o) { - return word.compareTo(o.word); - } - } - - protected ArrayList entries = new ArrayList(); - - protected int curPos; - protected Entry curEntry; - - public BufferingTermFreqIteratorWrapper(TermFreqIterator source) { - // read all source data into buffer - while (source.hasNext()) { - String w = source.next(); - Entry e = new Entry(w, source.freq()); - entries.add(e); - } - curPos = 0; - } - - public float freq() { - return curEntry.freq; - } - - public boolean hasNext() { - return curPos < entries.size(); - } - - public String next() { - curEntry = entries.get(curPos); - curPos++; - return curEntry.word; - } - - public void remove() { - throw new UnsupportedOperationException("remove is not supported"); - } - - public List entries() { - return entries; - } -}