mirror of https://github.com/apache/lucene.git
add missing javadocs
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1377972 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ed8adb5e92
commit
d3e059b5e7
|
@ -37,6 +37,15 @@ import java.util.regex.PatternSyntaxException;
|
|||
/**
|
||||
* Abstract parent class for analysis factories {@link TokenizerFactory},
|
||||
* {@link TokenFilterFactory} and {@link CharFilterFactory}.
|
||||
* <p>
|
||||
* The typical lifecycle for a factory consumer is:
|
||||
* <ol>
|
||||
* <li>Create factory via its a no-arg constructor
|
||||
* <li>Set version emulation by calling {@link #setLuceneMatchVersion(Version)}
|
||||
* <li>Calls {@link #init(Map)} passing arguments as key-value mappings.
|
||||
* <li>(Optional) If the factory uses resources such as files, {@link ResourceLoaderAware#inform(ResourceLoader)} is called to initialize those resources.
|
||||
* <li>Consumer calls create() to obtain instances.
|
||||
* </ol>
|
||||
*/
|
||||
public abstract class AbstractAnalysisFactory {
|
||||
|
||||
|
@ -46,6 +55,9 @@ public abstract class AbstractAnalysisFactory {
|
|||
/** the luceneVersion arg */
|
||||
protected Version luceneMatchVersion = null;
|
||||
|
||||
/**
|
||||
* Initialize this factory via a set of key-value pairs.
|
||||
*/
|
||||
public void init(Map<String,String> args) {
|
||||
this.args = args;
|
||||
}
|
||||
|
@ -104,6 +116,9 @@ public abstract class AbstractAnalysisFactory {
|
|||
return Boolean.parseBoolean(s);
|
||||
}
|
||||
|
||||
/**
|
||||
* Compiles a pattern for the value of the specified argument key <code>name</code>
|
||||
*/
|
||||
protected Pattern getPattern(String name) {
|
||||
try {
|
||||
String pat = args.get(name);
|
||||
|
@ -118,6 +133,10 @@ public abstract class AbstractAnalysisFactory {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns as {@link CharArraySet} from wordFiles, which
|
||||
* can be a comma-separated list of filenames
|
||||
*/
|
||||
protected CharArraySet getWordSet(ResourceLoader loader,
|
||||
String wordFiles, boolean ignoreCase) throws IOException {
|
||||
assureMatchVersion();
|
||||
|
@ -137,6 +156,9 @@ public abstract class AbstractAnalysisFactory {
|
|||
return words;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the resource's lines (with content treated as UTF-8)
|
||||
*/
|
||||
protected List<String> getLines(ResourceLoader loader, String resource) throws IOException {
|
||||
return WordlistLoader.getLines(loader.openResource(resource), IOUtils.CHARSET_UTF_8);
|
||||
}
|
||||
|
|
|
@ -27,5 +27,9 @@ import java.io.IOException;
|
|||
*/
|
||||
public interface ResourceLoaderAware {
|
||||
|
||||
/**
|
||||
* Initializes this component with the provided ResourceLoader
|
||||
* (used for loading classes, files, etc).
|
||||
*/
|
||||
void inform(ResourceLoader loader) throws IOException;
|
||||
}
|
||||
|
|
|
@ -19,6 +19,9 @@ package org.apache.lucene.analysis.util;
|
|||
|
||||
/** Some commonly-used stemming functions */
|
||||
public class StemmerUtil {
|
||||
/** no instance */
|
||||
private StemmerUtil() {}
|
||||
|
||||
/**
|
||||
* Returns true if the character array starts with the suffix.
|
||||
*
|
||||
|
|
|
@ -36,7 +36,10 @@ import org.apache.lucene.util.Version;
|
|||
*/
|
||||
public class WordlistLoader {
|
||||
|
||||
private static final int INITITAL_CAPACITY = 16;
|
||||
private static final int INITIAL_CAPACITY = 16;
|
||||
|
||||
/** no instance */
|
||||
private WordlistLoader() {}
|
||||
|
||||
/**
|
||||
* Reads lines from a Reader and adds every line as an entry to a CharArraySet (omitting
|
||||
|
@ -74,7 +77,7 @@ public class WordlistLoader {
|
|||
* @return A {@link CharArraySet} with the reader's words
|
||||
*/
|
||||
public static CharArraySet getWordSet(Reader reader, Version matchVersion) throws IOException {
|
||||
return getWordSet(reader, new CharArraySet(matchVersion, INITITAL_CAPACITY, false));
|
||||
return getWordSet(reader, new CharArraySet(matchVersion, INITIAL_CAPACITY, false));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -89,7 +92,7 @@ public class WordlistLoader {
|
|||
* @return A CharArraySet with the reader's words
|
||||
*/
|
||||
public static CharArraySet getWordSet(Reader reader, String comment, Version matchVersion) throws IOException {
|
||||
return getWordSet(reader, comment, new CharArraySet(matchVersion, INITITAL_CAPACITY, false));
|
||||
return getWordSet(reader, comment, new CharArraySet(matchVersion, INITIAL_CAPACITY, false));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -171,7 +174,7 @@ public class WordlistLoader {
|
|||
* @return A {@link CharArraySet} with the reader's words
|
||||
*/
|
||||
public static CharArraySet getSnowballWordSet(Reader reader, Version matchVersion) throws IOException {
|
||||
return getSnowballWordSet(reader, new CharArraySet(matchVersion, INITITAL_CAPACITY, false));
|
||||
return getSnowballWordSet(reader, new CharArraySet(matchVersion, INITIAL_CAPACITY, false));
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue