@@ -0,0 +1,2737 @@
+/**%0A * Copyright 2015 Alessandro Daniele, Fabio Cesarato, Andrea Giraldin%0A * %0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A * %0A *     http://www.apache.org/licenses/LICENSE-2.0%0A * %0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage com.salsaw.salsa.algorithm;%0A%0Aimport com.salsaw.salsa.algorithm.exceptions.SALSAException;%0A%0A/**%0A * @author Alessandro Daniele, Fabio Cesarato, Andrea Giraldin%0A *%0A */%0Apublic class Alphabet %7B%0A%09// FILEDS%0A%09private final int numberOfCharacters;%0A%09private final char%5B%5D alphabet;%09%0A%09%0A%09// CONSTRUCTOR%0A%09public Alphabet(String matrixInputLine, int alphabetLength) throws SALSAException%7B%09%09%0A%09%09this.alphabet = new char%5BalphabetLength%5D;%0A%0A%09%09int numberOfCharacters = 0;%09%0A%09%09for (int i=0; i %3C matrixInputLine.length(); i++)%7B%0A%09%09%09%0A%09%09%09// For short string charAt has higher performance http://stackoverflow.com/a/11876086%0A%09%09%09char symbol = matrixInputLine.charAt(i);%0A%09%09%09if (symbol !=' ')%7B%0A%09%09%09%09alphabet%5BnumberOfCharacters%5D = symbol;%0A%09%09%09%09numberOfCharacters++;%0A%09%09%09%7D%0A%09%09%7D%0A%09%09%0A%09%09this.numberOfCharacters = numberOfCharacters;%0A%09%09%0A%09%09if (numberOfCharacters != alphabetLength)%7B%0A%09%09%09throw new SALSAException(%22Number of characters in the first line of the substitution matrix doesn't correspond to the specified number of characters.%22);%0A%09%09%7D%09%09%0A%09%7D%0A%09%0A%09// METHODS%0A%09/**%0A%09 * Next two are used for efficiency reasons: before starting the local search,%0A%09 * each cell of the alignment are converted in an integer. Then, during the local search,%0A%09 * the score is calculated only by accessing the substitution matrix. The converted characters%0A%09 * are indeed the indexes of the substitution matrix. Without this conversion it would be%0A%09 * necessary to calculate every time the score's position in the substitution matrix.%0A%09 **/%0A%09//Conversion of character in an integer%0A%09public int charToInt(char c)%7B%0A%09%09// TODO Report code from c%0A%09%09return 0;%0A%09%7D%0A%09/**%0A%09 * Conversion of an integer in a character (to be used after the end of local search)%0A%09 * @param i%0A%09 * @return%0A%09 */%0A%09public char intToChar(int i)%7B%0A%09%09// TODO Report code from c%0A%09%09return 0;%0A%09%7D%0A%0A%09/**%0A%09 * Dimension of the alphabet number of characters%0A%09 * @return%0A%09 */%0A%09public int dimension()%7B%0A%09%09// TODO Report code from c%0A%09%09return 0;%0A%09%7D%0A%09%0A%09/**%0A%09 * The representation of the INDEL in the integer form (see above)%0A%09 * @return%0A%09 */%0A%09public int INDEL()%7B%0A%09%09// TODO Report code from c%0A%09%09return 0;%0A%09%7D%0A%7D%0A

Add empty class Alphabet