algorithmfactoryimpl.java
来自「使用最大正向匹配算法」· Java 代码 · 共 30 行
JAVA
30 行
/**
*
*/
package org.solol.mmseg.internal;
import org.solol.mmseg.core.AlgorithmException;
import org.solol.mmseg.core.AlgorithmFactory;
import org.solol.mmseg.core.Config;
import org.solol.mmseg.core.IAlgorithm;
/**
* @author solo L
*
*/
public class AlgorithmFactoryImpl extends AlgorithmFactory {
public IAlgorithm createAlgorithm() throws AlgorithmException {
return createAlgorithm(Config.SINGLE_WORD);
}
public IAlgorithm createAlgorithm(String type) throws AlgorithmException {
if (type.equalsIgnoreCase(Config.SINGLE_WORD)) {
return new SimpleAlgorithm();
} else if (type.equalsIgnoreCase(Config.THREE_WORD)) {
return new ComplexAlgorithm();
}
throw new AlgorithmException("Not support.");
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?