<commit_before>/*
 *                    BioJava development code
 *
 * This code may be freely distributed and modified under the
 * terms of the GNU Lesser General Public Licence.  This should
 * be distributed with the code.  If you do not have a copy,
 * see:
 *
 *      http://www.gnu.org/copyleft/lesser.html
 *
 * Copyright for this code is held jointly by the individual
 * authors.  These should be listed in @author doc comments.
 *
 * For more information on the BioJava project and its aims,
 * or to join the biojava-l mailing list, visit the home page
 * at:
 *
 *      http://www.biojava.org/
 *
 */

package org.biojavax.bio.alignment.blast;

import java.util.HashMap;
import java.util.Set;

import org.biojavax.bio.alignment.RemotePairwiseAlignmentProperties;

/**
 * 
 * This class implements RemotePairwiseAlignmentProperties by specifying several
 * convenient methods used to wrap the addition of Blast alignment parameters.
 * 
 * @author <NAME>, <NAME>
 * @since Biojava 3
 *
 */
public class NCBIQBlastAlignmentProperties implements
		RemotePairwiseAlignmentProperties {

	private static final long serialVersionUID = 1L;
	private HashMap<String, String> param = new HashMap<String, String>();

	/**
	 * This method returns the value of the program used for this particular
	 * blast run.
	 * 
	 * @return program :the name of the blastall program used.
	 */
	public String getBlastProgram() {
		return param.get("PROGRAM");
	}

	/**
	 * This method set the program to be use with blastall. This method does a
	 * validation before running on the valid blastall programs: blastn / blastp
	 * / blastx / tblastn / tblastx
	 * 
	 * @param program
	 *            : one of blastall programs
	 * @exception Exception
	 *                if the named program is not a valid blastall options
	 * 
	 */
	public void setBlastProgram(String program) throws Exception {

		boolean isValid = false;
		String[] blastPr = { "blastn", "blastp", "blastx", "tblastn", "tblastx" };

		for (int i = 0; i < blastPr.length; i++) {
			if (program == blastPr[i]) {
				this.param.put("PROGRAM", program);
				isValid = true;
			}
		}
		if (!isValid) {
			throw new Exception(
					"Invalid blastall program selection! Use one of valid values: blastn/blastp/blastx/tblastn/tblastx");
		}
	}

	/**
	 * This method returns the value of the database used for this particular
	 * blast run.
	 * 
	 * @return db :the name of the database used
	 */
	public String getBlastDatabase() {
		return param.get("DATABASE");<commit_msg>Correcting a "==" inequality, using Arrays' searchBinary() method instead.<commit_after>/*
 *                    BioJava development code
 *
 * This code may be freely distributed and modified under the
 * terms of the GNU Lesser General Public Licence.  This should
 * be distributed with the code.  If you do not have a copy,
 * see:
 *
 *      http://www.gnu.org/copyleft/lesser.html
 *
 * Copyright for this code is held jointly by the individual
 * authors.  These should be listed in @author doc comments.
 *
 * For more information on the BioJava project and its aims,
 * or to join the biojava-l mailing list, visit the home page
 * at:
 *
 *      http://www.biojava.org/
 *
 */

package org.biojavax.bio.alignment.blast;

import java.util.HashMap;
import java.util.Set;
import java.util.Arrays;

import org.biojavax.bio.alignment.RemotePairwiseAlignmentProperties;

/**
 * 
 * This class implements RemotePairwiseAlignmentProperties by specifying several
 * convenient methods used to wrap the addition of Blast alignment parameters.
 * 
 * @author <NAME>, <NAME>
 * @since Biojava 3
 *
 */
public class NCBIQBlastAlignmentProperties implements
		RemotePairwiseAlignmentProperties {

	private static final long serialVersionUID = 1L;
	private HashMap<String, String> param = new HashMap<String, String>();

	/**
	 * This method returns the value of the program used for this particular
	 * blast run.
	 * 
	 * @return program :the name of the blastall program used.
	 */
	public String getBlastProgram() {
		return param.get("PROGRAM");
	}

	/**
	 * This method set the program to be use with blastall. This method does a
	 * validation before running on the valid blastall programs: blastn / blastp
	 * / blastx / tblastn / tblastx
	 * 
	 * @param program
	 *            : one of blastall programs
	 * @exception Exception
	 *                if the named program is not a valid blastall options
	 * 
	 */
	public void setBlastProgram(String program) throws Exception {

		boolean isValid = false;
		String[] blastPr = { "blastn", "blastp", "blastx", "tblastn", "tblastx" };

//		for (int i = 0; i < blastPr.length; i++) {
//			if (program == blastPr[i]) {
//				this.param.put("PROGRAM", program);
//				isValid = true;
//			}
//		}
		
		if(searchBinary(blastPr,program)>=0){
			isValid = true;			
		}
		
		if (!isValid) {
			throw new Exception(
					"Invalid blastall program selection! Use one of valid values: blastn/blastp/blastx/tblastn/tblastx");
		}
	}

	/**
	 * This method returns the value of the database used for this particular
	 * blast run.
	 * 
	 * @return db :the name of the database used
	 */
	public String getBlastDatabase() {
		return param.get("DATABASE");
{'fraction_non_alphanumeric': 0.09769673704414587, 'fraction_numerical': 0.001343570057581574, 'mean_word_length': 3.1788291900561347, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, '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': '3408029', 'n_tokens_mistral': 1624, 'n_tokens_neox': 1470, 'n_words': 561}