/*\r
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
- *\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)\r
+ * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ * \r
* This program is free software; you can redistribute it and/or\r
* modify it under the terms of the GNU General Public License\r
* as published by the Free Software Foundation; either version 2\r
* of the License, or (at your option) any later version.\r
- *\r
+ * \r
* This program is distributed in the hope that it will be useful,\r
* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
* GNU General Public License for more details.\r
- *\r
+ * \r
* You should have received a copy of the GNU General Public License\r
* along with this program; if not, write to the Free Software\r
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
*/\r
package jalview.datamodel;\r
\r
-public class CigarArray\r
- extends CigarBase\r
+public class CigarArray extends CigarBase\r
{\r
/**\r
- * Do CIGAR operations on a set of sequences from many other cigars\r
- * BAD THINGS WILL HAPPEN IF A CIGARARRAY IS PASSED TO A CIGARARRAY\r
- * or a CIGARCIGAR is given a CIGARARRAY to insert gaps into.\r
+ * Do CIGAR operations on a set of sequences from many other cigars BAD THINGS\r
+ * WILL HAPPEN IF A CIGARARRAY IS PASSED TO A CIGARARRAY or a CIGARCIGAR is\r
+ * given a CIGARARRAY to insert gaps into.\r
*/\r
/**\r
* array of subject cigars\r
*/\r
public CigarSimple refCigars[] = null;\r
+\r
private boolean seqcigararray = false;\r
+\r
private CigarArray()\r
{\r
super();\r
\r
/**\r
* isSeqCigarArray()\r
+ * \r
* @return boolean true if all refCigars resolve to a SeqCigar or a CigarCigar\r
*/\r
public boolean isSeqCigarArray()\r
}\r
\r
/**\r
- * Apply CIGAR operations to several cigars in parallel\r
- * will throw an error if any of cigar are actually CigarArrays.\r
- * @param cigar Cigar[]\r
+ * Apply CIGAR operations to several cigars in parallel will throw an error if\r
+ * any of cigar are actually CigarArrays.\r
+ * \r
+ * @param cigar\r
+ * Cigar[]\r
*/\r
public CigarArray(CigarSimple[] cigars)\r
{\r
for (int c = 0; c < cigars.length; c++)\r
{\r
refCigars[c] = cigars[c];\r
- if (! ( (cigars[c] instanceof SeqCigar)\r
- || cigars[c] instanceof CigarCigar))\r
+ if (!((cigars[c] instanceof SeqCigar) || cigars[c] instanceof CigarCigar))\r
{\r
seqcigararray = false;\r
}\r
\r
/**\r
* @see Cigar.getSequenceAndDeletions\r
- * @param GapChar char\r
+ * @param GapChar\r
+ * char\r
* @return Object[][]\r
*/\r
protected Object[][] getArrayofSequenceAndDeletions(char GapChar)\r
\r
/**\r
* NOTE: this is an improper sequence string function\r
- * @return String formed by newline concatenated results of applying CIGAR operations to each reference object in turn.\r
- * @param GapChar char\r
+ * \r
+ * @return String formed by newline concatenated results of applying CIGAR\r
+ * operations to each reference object in turn.\r
+ * @param GapChar\r
+ * char\r
* @return '\n' separated strings (empty results included as \n\n)\r
*/\r
public String getSequenceString(char GapChar)\r
{\r
if (sqanddels[c] != null)\r
{\r
- seqStrings.append( (String) sqanddels[c][0]);\r
+ seqStrings.append((String) sqanddels[c][0]);\r
sqanddels[c][0] = null;\r
}\r
seqStrings.append('\n');\r
\r
/**\r
* return string results of applying cigar string to all reference cigars\r
- * @param GapChar char\r
+ * \r
+ * @param GapChar\r
+ * char\r
* @return String[]\r
*/\r
public String[] getSequenceStrings(char GapChar)\r
/**\r
* Combines the CigarArray cigar operations with the operations in each\r
* reference cigar - creating a new reference cigar\r
+ * \r
* @return Cigar[]\r
-\r
- public CigarBase[] getEditedCigars() {\r
-\r
- return new CigarBase[] {};\r
- }\r
+ * \r
+ * public CigarBase[] getEditedCigars() {\r
+ * \r
+ * return new CigarBase[] {}; }\r
*/\r
/**\r
- * applyDeletions\r
- * edits underlying refCigars to propagate deleted regions, and removes deletion\r
- * operations from CigarArray operation list.\r
- * @return int[] position after deletion occured and range of deletion in cigarArray or null if none occured\r
+ * applyDeletions edits underlying refCigars to propagate deleted regions, and\r
+ * removes deletion operations from CigarArray operation list.\r
+ * \r
+ * @return int[] position after deletion occured and range of deletion in\r
+ * cigarArray or null if none occured\r
*/\r
public int[] applyDeletions()\r
{\r
}\r
int delstart = cursor, delend = cursor + range[i] - 1; // inclusive\r
delpos.addElement(new int[]\r
- {vcursor + offset, range[i]}); // index of right hand column after hidden region boundary\r
+ { vcursor + offset, range[i] }); // index of right hand column after\r
+ // hidden region boundary\r
offset += range[i] - 1; // shift in visible column coordinates\r
System.arraycopy(operation, i + 1, operation, i, length - i);\r
System.arraycopy(range, i + 1, range, i, length - i);\r
length--;\r
- /* int dmax=0;\r
- for (int s=0; s<refCigars.length; s++) {\r
- int d = refCigars[s].deleteRange(delstart, delend);\r
- if (d>dmax)\r
- dmax=d;\r
- }\r
- offset+=dmax; // shift in visible column coordinates\r
+ /*\r
+ * int dmax=0; for (int s=0; s<refCigars.length; s++) { int d =\r
+ * refCigars[s].deleteRange(delstart, delend); if (d>dmax) dmax=d; }\r
+ * offset+=dmax; // shift in visible column coordinates\r
*/\r
for (int s = 0; s < refCigars.length; s++)\r
{\r
int[] pos = new int[delpos.size() * 2];\r
for (int k = 0, l = delpos.size(); k < l; k++)\r
{\r
- int[] dr = ( (int[]) delpos.elementAt(k));\r
+ int[] dr = ((int[]) delpos.elementAt(k));\r
pos[k * 2] = dr[0];\r
pos[k * 2 + 1] = dr[1];\r
delpos.setElementAt(null, k);\r
}\r
\r
/**\r
- *\r
- * @return SeqCigar[] or null if CigarArray is not a SeqCigarArray (ie it does not resolve to set of seqCigars)\r
+ * \r
+ * @return SeqCigar[] or null if CigarArray is not a SeqCigarArray (ie it does\r
+ * not resolve to set of seqCigars)\r
*/\r
public SeqCigar[] getSeqCigarArray()\r
{\r