+ }
+ if (hiddenColumns.size() == 0)
+ {
+ hiddenColumns = null;
+ }
+ }
+
+ public boolean isVisible(int column)
+ {
+ if (hiddenColumns != null)
+ {
+ for (int[] region : hiddenColumns)
+ {
+ if (column >= region[0] && column <= region[1])
+ {
+ return false;
+ }
+ }
+ }
+
+ return true;
+ }
+
+ /**
+ * Copy constructor
+ *
+ * @param copy
+ */
+ public ColumnSelection(ColumnSelection copy)
+ {
+ if (copy != null)
+ {
+ if (copy.selected != null)
+ {
+ selected = new IntList();
+ for (int i = 0, j = copy.selected.size(); i < j; i++)
+ {
+ selected.add(copy.selected.elementAt(i));
+ }
+ }
+ if (copy.hiddenColumns != null)
+ {
+ hiddenColumns = new Vector<int[]>(copy.hiddenColumns.size());
+ for (int i = 0, j = copy.hiddenColumns.size(); i < j; i++)
+ {
+ int[] rh, cp;
+ rh = copy.hiddenColumns.elementAt(i);
+ if (rh != null)
+ {
+ cp = new int[rh.length];
+ System.arraycopy(rh, 0, cp, 0, rh.length);
+ hiddenColumns.addElement(cp);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * ColumnSelection
+ */
+ public ColumnSelection()
+ {
+ }
+
+ public String[] getVisibleSequenceStrings(int start, int end,
+ SequenceI[] seqs)
+ {
+ int i, iSize = seqs.length;
+ String selection[] = new String[iSize];
+ if (hiddenColumns != null && hiddenColumns.size() > 0)
+ {
+ for (i = 0; i < iSize; i++)
+ {
+ StringBuffer visibleSeq = new StringBuffer();
+ List<int[]> regions = getHiddenColumns();
+
+ int blockStart = start, blockEnd = end;
+ int[] region;
+ int hideStart, hideEnd;