<commit_before>package ch.ethz.scu.obit.common.settings;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

/**
 * Class to store Annotation Tool settings for one specific openBIS server
 * 
 * This class is only visible within its package.
 * 
 * @author <NAME>
 */
class AppSettings {

	// String-string map of setting name - values
	protected Map<String, String> settings = new HashMap<String, String>();

	/**
	 * Constructor
	 */
	public AppSettings() {
		ArrayList<String> names = getSettingsNames();
		for (String name : names) {
			setSettingValue(name, defaultValueForSetting(name));
		}
	}

	/**
	 * Constructor
	 * @param openBISURL: URL of the openBIS server  
	 */
	public AppSettings(String openBISURL) {
		ArrayList<String> names = getSettingsNames();
		for (String name : names) {
			if (name.equals("OpenBISURL")) {
				setSettingValue("OpenBISURL", openBISURL);
			} else {
				setSettingValue(name, defaultValueForSetting(name));
			}
		}
	}

	/**
	 * Get the openBIS URL
	 * @return the openBIS URL
	 */
	public String getOpenBISURL() {
		if (settings.containsKey("OpenBISURL")) {
			return settings.get("OpenBISURL");
		} else {
			return AppSettings.defaultValueForSetting("OpenBISURL");
		}
	}

	/**
	 * Sets the openBIS URL
	 * @param openBISURL: openBIS URL
	 */
	public void setOpenBISURL(String openBISURL) {
		setSettingValue("OpenBISURL", openBISURL);
	}

	/**
	 * Store a setting
	 * @param name: setting name
	 * @param value: setting value
	 */
	public void setSettingValue(String name, String value) {
		settings.put(name, value);
	}
	
	/**
	 * Get a setting
	 * @param name: setting name
	 */
	public String getSettingValue(String name) {
		return settings.get(name);
	}
	
	/**
	 * Return all settings
	 * @return all settings in a name-value String-String map
	 */
	public Map<String, String> getAllSettings() {
		return settings;
	}

	/**
	 * Returns the possible values for a given setting
	 * @param name Name of the setting
	 * @return list of values (Strings)
	 */
	static public ArrayList<String> possibleValuesForSetting(String name) {
		
		ArrayList<String> options = new ArrayList<String>();
		
		if (name.equals("OpenBISURL")) {
			options.add("https://localhost:8443/openbis");
		} else if (name.equals("AcceptSelfSignedCertificates")) {
			options.add("no");
			options.add("yes");
		} else if (name.equals("AcquisitionStation")) {
			options.add("BD Biosciences Cell Analyzers and Sorters");
			options.add("Generic light microscopes");
		} else if (name.equals("UserDataDir")) {
			options.add("");			
		} else if (name.equals("DatamoverIncomingDir")) {
			options.add("");
		} else {
			throw (new IllegalArgumentException());
		}
		
		return options;
	}

	/**
	 * Returns the description for the specified acquisition station
	 * @param name Name of the acquisition station
	 * @return description of acquisition station
	 */
	static public String getAcqStationDescription(String name) {
		
		if (name.equals("BD Biosciences Cell Analyzers and Sorters")) {
			return "BD LSRFortessa and FACSAria III "
					+ "(FCS 3.0/3.1 exports from BD FACSDiva™ Software 6/7)";
		} else if (name.equals("Generic light microscopes")) {
			return "Generic light microscopes (LOCI bio-formats compatible)";
		} else {
			throw (new IllegalArgumentException("Unknown acquisition station."));
		}
	}

	/**
	 * Return default option for a given setting 
	 * @return name String with the default value for a given setting name<commit_msg>Update flow hardware description.<commit_after>package ch.ethz.scu.obit.common.settings;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

/**
 * Class to store Annotation Tool settings for one specific openBIS server
 * 
 * This class is only visible within its package.
 * 
 * @author <NAME>
 */
class AppSettings {

	// String-string map of setting name - values
	protected Map<String, String> settings = new HashMap<String, String>();

	/**
	 * Constructor
	 */
	public AppSettings() {
		ArrayList<String> names = getSettingsNames();
		for (String name : names) {
			setSettingValue(name, defaultValueForSetting(name));
		}
	}

	/**
	 * Constructor
	 * @param openBISURL: URL of the openBIS server  
	 */
	public AppSettings(String openBISURL) {
		ArrayList<String> names = getSettingsNames();
		for (String name : names) {
			if (name.equals("OpenBISURL")) {
				setSettingValue("OpenBISURL", openBISURL);
			} else {
				setSettingValue(name, defaultValueForSetting(name));
			}
		}
	}

	/**
	 * Get the openBIS URL
	 * @return the openBIS URL
	 */
	public String getOpenBISURL() {
		if (settings.containsKey("OpenBISURL")) {
			return settings.get("OpenBISURL");
		} else {
			return AppSettings.defaultValueForSetting("OpenBISURL");
		}
	}

	/**
	 * Sets the openBIS URL
	 * @param openBISURL: openBIS URL
	 */
	public void setOpenBISURL(String openBISURL) {
		setSettingValue("OpenBISURL", openBISURL);
	}

	/**
	 * Store a setting
	 * @param name: setting name
	 * @param value: setting value
	 */
	public void setSettingValue(String name, String value) {
		settings.put(name, value);
	}
	
	/**
	 * Get a setting
	 * @param name: setting name
	 */
	public String getSettingValue(String name) {
		return settings.get(name);
	}
	
	/**
	 * Return all settings
	 * @return all settings in a name-value String-String map
	 */
	public Map<String, String> getAllSettings() {
		return settings;
	}

	/**
	 * Returns the possible values for a given setting
	 * @param name Name of the setting
	 * @return list of values (Strings)
	 */
	static public ArrayList<String> possibleValuesForSetting(String name) {
		
		ArrayList<String> options = new ArrayList<String>();
		
		if (name.equals("OpenBISURL")) {
			options.add("https://localhost:8443/openbis");
		} else if (name.equals("AcceptSelfSignedCertificates")) {
			options.add("no");
			options.add("yes");
		} else if (name.equals("AcquisitionStation")) {
			options.add("BD Biosciences Cell Analyzers and Sorters");
			options.add("Generic light microscopes");
		} else if (name.equals("UserDataDir")) {
			options.add("");			
		} else if (name.equals("DatamoverIncomingDir")) {
			options.add("");
		} else {
			throw (new IllegalArgumentException());
		}
		
		return options;
	}

	/**
	 * Returns the description for the specified acquisition station
	 * @param name Name of the acquisition station
	 * @return description of acquisition station
	 */
	static public String getAcqStationDescription(String name) {
		
		if (name.equals("BD Biosciences Cell Analyzers and Sorters")) {
			return "BD LSRFortessa and FACSAria III "
					+ "(FCS 3.0/3.1 exports from BD FACSDiva™ Software 6/7/8)";
		} else if (name.equals("Generic light microscopes")) {
			return "Generic light microscopes (LOCI bio-formats compatible)";
		} else {
			throw (new IllegalArgumentException("Unknown acquisition station."));
		}
	}

	/**
	 * Return default option for a given setting 
	 * @return name String with the default value for a given setting name
{'fraction_non_alphanumeric': 0.12147134302822926, 'fraction_numerical': 0.0029940119760479044, 'mean_word_length': 3.7851296043656206, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2562393', 'n_tokens_mistral': 2370, 'n_tokens_neox': 2077, 'n_words': 616}