All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.gdface.cassdk.Version Maven / Gradle / Ivy

package net.gdface.cassdk;

import java.util.Collections;
import java.util.List;

/**
 * CASSDK版本定义
 * @author guyadong
 *
 */
public enum Version{
	/** 5.4.0 版本*/
	V5_4_0(
			"5.4.0",
			"libTHDetect_dpbin.so,libTHFacialPos_con.so,libTHFacialPos_lmp.so,libTHFeature_db10.so,libTHFeature_dis.so",
			"feadb.db10"),
	/** 8.0.0 版本*/
	V8_0_0(
			"8.0.0",
			"libTHDetect_dpbin.so,libTHFacialPos_con.so,libTHFacialPos_lmp.so,libTHFeature_db40.so",
			"feadb.db40");
	/** CASSDK版本号 */
	public  final String version;
	/** (Linux)需要复制到${user.dir}或JVM folder的模型文件列表(immutable) */
	private final List linuxModelFiles;
	/** (Windows)需要复制到${user.dir}或JVM folder的模型文件列表(immutable) */
	private final List windowsModelFiles;
	Version(String version,String linuxModelFiles,String windowsModelFiles){
		this(version,
				CasConfig.getExplodedStringAsList(linuxModelFiles),
				CasConfig.getExplodedStringAsList(windowsModelFiles));
	}
	Version(String version,Version v){
		this(version,v.linuxModelFiles,v.windowsModelFiles);
	}
	Version(String version,List linuxModelFiles,List windowsModelFiles){
		this.version= version;
		this.linuxModelFiles=null == linuxModelFiles 
				? Collections.emptyList()
				: Collections.unmodifiableList(linuxModelFiles);
		this.windowsModelFiles = null == windowsModelFiles
				? Collections.emptyList()
				: Collections.unmodifiableList(windowsModelFiles);
	}
	/**
	 * 根据CASSDK版本号返回匹配的{@link Version}
	 * @param version 版本号字符串
	 * @return
	 */
	public static final Version cast(String version){
		for(Version v : Version.values()){
			if(v.version.equals(version)){
				return v;
			}
		}
		throw new IllegalArgumentException(
	            "No enum constant " + Version.class.getCanonicalName() + "." + version);
	}
	/** 根据操作系统类型返回需要复制到${user.dir}或JVM folder的模型文件列表 */
	public List getModelFiles(){
		return System.getProperty("os.name").toLowerCase().startsWith("win") 
					? windowsModelFiles
					: linuxModelFiles;
	}
	public List getLinuxModelFiles() {
		return linuxModelFiles;
	}
	public List getWindowsModelFiles() {
		return windowsModelFiles;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy