* Add a column to the selection\r
* \r
* @param col\r
- * index of column\r
+ * index of column\r
*/\r
public void addElement(int col)\r
{\r
* removes col from selection\r
* \r
* @param col\r
- * index of column to be removed\r
+ * index of column to be removed\r
*/\r
public void removeElement(int col)\r
{\r
* removes a range of columns from the selection\r
* \r
* @param start\r
- * int - first column in range to be removed\r
+ * int - first column in range to be removed\r
* @param end\r
- * int - last col\r
+ * int - last col\r
*/\r
public void removeElements(int start, int end)\r
{\r
/**\r
* \r
* @param col\r
- * index to search for in column selection\r
+ * index to search for in column selection\r
* \r
* @return true if Integer(col) is in selection.\r
*/\r
* Column number at position i in selection\r
* \r
* @param i\r
- * index into selected columns\r
+ * index into selected columns\r
* \r
* @return column number in alignment\r
*/\r
* propagate shift in alignment columns to column selection\r
* \r
* @param start\r
- * beginning of edit\r
+ * beginning of edit\r
* @param left\r
- * shift in edit (+ve for removal, or -ve for inserts)\r
+ * shift in edit (+ve for removal, or -ve for inserts)\r
*/\r
public Vector compensateForEdit(int start, int change)\r
{\r
* compensateForEdit - allowing for edits within hidden regions\r
* \r
* @param start\r
- * beginning of edit\r
+ * beginning of edit\r
* @param left\r
- * shift in edit (+ve for removal, or -ve for inserts)\r
+ * shift in edit (+ve for removal, or -ve for inserts)\r
*/\r
private void compensateForDelEdits(int start, int change)\r
{\r
}\r
}\r
return pruned; // true if any interval was removed or modified by\r
- // operations.\r
+ // operations.\r
}\r
\r
private boolean pruneColumnList(Vector deletion, Vector list)\r
* given index.\r
* \r
* @param end\r
- * int\r
+ * int\r
* @return Vector\r
*/\r
public Vector getHiddenColumns()\r
* Return absolute column index for a visible column index\r
* \r
* @param column\r
- * int column index in alignment view\r
+ * int column index in alignment view\r
* @return alignment column index for column\r
*/\r
public int adjustForHiddenColumns(int column)\r
* hidden columns exist\r
* \r
* @param hiddenColumn\r
- * int\r
+ * int\r
* @return int\r
*/\r
public int findColumnPosition(int hiddenColumn)\r
* hidden columns. In otherwords, the next hidden column.\r
* \r
* @param index\r
- * int\r
+ * int\r
*/\r
public int getHiddenBoundaryRight(int alPos)\r
{\r
* hidden columns. In otherwords, the previous hidden column.\r
* \r
* @param index\r
- * int\r
+ * int\r
*/\r
public int getHiddenBoundaryLeft(int alPos)\r
{\r
* specified\r
* \r
* @param res\r
- * int\r
+ * int\r
*/\r
public void hideColumns(int col)\r
{\r
* return all visible segments between the given start and end boundaries\r
* \r
* @param start\r
- * (first column inclusive from 0)\r
+ * (first column inclusive from 0)\r
* @param end\r
- * (last column - not inclusive)\r
- * @return int[] {i_start, i_end, ..} where intervals lie in start<=i_start<=i_end<end\r
+ * (last column - not inclusive)\r
+ * @return int[] {i_start, i_end, ..} where intervals lie in\r
+ * start<=i_start<=i_end<end\r
*/\r
public int[] getVisibleContigs(int start, int end)\r
{\r
* sequence associated annotation).\r
* \r
* @param start\r
- * remove any annotation to the right of this column\r
+ * remove any annotation to the right of this column\r
* @param end\r
- * remove any annotation to the left of this column\r
+ * remove any annotation to the left of this column\r
* @param alignmentAnnotation\r
- * the annotation to operate on\r
+ * the annotation to operate on\r
*/\r
public void makeVisibleAnnotation(int start, int end,\r
AlignmentAnnotation alignmentAnnotation)\r
if (end > blockStart)\r
{\r
annels.addElement(els = new Annotation[end - blockStart + 1]);\r
- if ((els.length+blockStart)<= alignmentAnnotation.annotations.length)\r
+ if ((els.length + blockStart) <= alignmentAnnotation.annotations.length)\r
{\r
// copy just the visible segment of the annotation row\r
System.arraycopy(alignmentAnnotation.annotations, blockStart,\r
{\r
// copy to the end of the annotation row\r
System.arraycopy(alignmentAnnotation.annotations, blockStart,\r
- els, 0, (alignmentAnnotation.annotations.length - blockStart));\r
+ els, 0,\r
+ (alignmentAnnotation.annotations.length - blockStart));\r
}\r
w += els.length;\r
}\r
}\r
}\r
}\r
+\r
+ /**\r
+ * add in any unselected columns from the given column selection, excluding any that are hidden.\r
+ * @param colsel\r
+ */\r
+ public void addElementsFrom(ColumnSelection colsel)\r
+ {\r
+ if (colsel != null && colsel.size() > 0)\r
+ {\r
+ Enumeration e = colsel.getSelected().elements();\r
+ while (e.hasMoreElements())\r
+ {\r
+ Object eo = e.nextElement();\r
+ if (hiddenColumns!=null && isVisible(((Integer) eo).intValue())) {\r
+ if (!selected.contains(eo))\r
+ {\r
+ selected.addElement(eo);\r
+ }\r
+ }\r
+ }\r
+ }\r
+ }\r
+/**\r
+ * set the selected columns the given column selection, excluding any columns that are hidden. \r
+ * @param colsel\r
+ */\r
+ public void setElementsFrom(ColumnSelection colsel)\r
+ {\r
+ if (colsel.selected != null && colsel.selected.size() > 0)\r
+ {\r
+ if (hiddenColumns!=null && hiddenColumns.size()>0)\r
+ {\r
+ // only select visible columns in this columns selection\r
+ selected = new Vector();\r
+ addElementsFrom(colsel);\r
+ } else {\r
+ // be quick\r
+ selected = new Vector(colsel.selected);\r
+ }\r
+ }\r
+ else\r
+ {\r
+ selected = new Vector();\r
+ }\r
+ }\r
}\r