// lastly update the bitfield all at once
selected.or(mask);
}
+
+ public boolean isSelected(int column)
+ {
+ return selected.get(column);
+ }
+
+ public int getMaxColumn()
+ {
+ return selected.length() - 1;
+ }
+
+ public int getMinColumn()
+ {
+ return selected.get(0) ? 0 : selected.nextSetBit(0);
+ }
}
IntList selected = new IntList();
/**
* Returns a list of selected columns. The list contains no duplicates but is
- * not necessarily ordered.
+ * not necessarily ordered. It also may include columns hidden from the
+ * current view
*/
public List<Integer> getSelected()
{
* @param col
* index to search for in column selection
*
- * @return true if Integer(col) is in selection.
+ * @return true if col is selected
*/
public boolean contains(int col)
{
- return selected.contains(new Integer(col));
+ return (col > -1) ? selected.isSelected(col) : false;
}
/**
*/
public int getMax()
{
- int max = -1;
-
- for (int sel : getSelected())
+ if (selected.isEmpty())
{
- if (sel > max)
- {
- max = sel;
- }
+ return -1;
}
-
- return max;
+ return selected.getMaxColumn();
}
/**
*/
public int getMin()
{
- int min = 1000000000;
-
- for (int sel : getSelected())
+ if (selected.isEmpty())
{
- if (sel < min)
- {
- min = sel;
- }
+ return 1000000000;
}
-
- return min;
+ return selected.getMinColumn();
}
/**