📄 algorithmfactory.java
字号:
/**
*
*/
package org.solol.mmseg.core;
/**
* @author solo L
*
*/
public abstract class AlgorithmFactory {
public static final String FACTORY_PROPERTY = "org.solol.mmseg.AlgorithmFactory";
public static final String FACTORY_DEFAULT = "org.solol.mmseg.internal.AlgorithmFactoryImpl";
private static AlgorithmFactory factory = null;
public static AlgorithmFactory getFactory() throws ConfigurationException {
if (factory == null) {
ClassLoader contextClassLoader = AlgorithmFactory.class
.getClassLoader();
factory = createFactory(FACTORY_DEFAULT, contextClassLoader);
}
return factory;
}
protected static AlgorithmFactory createFactory(String factoryClass,
ClassLoader classLoader) throws ConfigurationException {
Class logFactoryClass;
try {
logFactoryClass = classLoader.loadClass(factoryClass);
return (AlgorithmFactory) logFactoryClass.newInstance();
} catch (ClassNotFoundException e) {
throw new ConfigurationException(e);
} catch (InstantiationException e) {
throw new ConfigurationException(e);
} catch (IllegalAccessException e) {
throw new ConfigurationException(e);
}
}
public abstract IAlgorithm createAlgorithm() throws AlgorithmException;
public abstract IAlgorithm createAlgorithm(String type)
throws AlgorithmException;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -