+ }
+
+ /**
+ * Returns a read-only view of the (possibly empty) list of selected columns
+ * <p>
+ * The list contains no duplicates but is not necessarily ordered. It also may
+ * include columns hidden from the current view. To modify (for example sort)
+ * the list, you should first make a copy.
+ * <p>
+ * The list is not thread-safe: iterating over it could result in
+ * ConcurrentModificationException if it is modified by another thread.
+ */
+ public List<Integer> getSelected()
+ {
+ return selection.getList();
+ }
+
+ /**
+ * @return list of int arrays containing start and end column position for
+ * runs of selected columns ordered from right to left.
+ */
+ public List<int[]> getSelectedRanges()
+ {
+ return selection.getRanges();
+ }
+
+ /**
+ *
+ * @param col
+ * index to search for in column selection
+ *
+ * @return true if col is selected
+ */
+ public boolean contains(int col)
+ {
+ return (col > -1) ? selection.isSelected(col) : false;
+ }
+
+ /**
+ * Answers true if no columns are selected, else false
+ */
+ public boolean isEmpty()
+ {
+ return selection == null || selection.isEmpty();
+ }
+
+ /**
+ * rightmost selected column
+ *
+ * @return rightmost column in alignment that is selected
+ */
+ public int getMax()
+ {
+ if (selection.isEmpty())
+ {
+ return -1;
+ }
+ return selection.getMaxColumn();
+ }
+
+ /**
+ * Leftmost column in selection
+ *
+ * @return column index of leftmost column in selection
+ */
+ public int getMin()
+ {
+ if (selection.isEmpty())
+ {
+ return 1000000000;
+ }
+ return selection.getMinColumn();
+ }