}
if ((hiddenColumns.get(index)[0] <= column)
- && (hiddenColumns.get(index)[1] >= column))
+ && hiddenColumns.get(index)[1] >= column)
{
+ // column is in the current region
// we hit the jackpot
// don't need to move index
}
index = 0;
hiddenCount = 0;
}
- /*else if (column > lastColumn)
- {
- index = hiddenColumns.size();
- // TODO resolve here - need full hidden count
- }*/
+ // column is after current region
else if (column > hiddenColumns.get(index)[1]) // includes if column >
// lastColumn
{
// iterate from where we are now, if we're lucky we'll be close by
// (but still better than iterating from 0)
+ // stop when we find the region *before* column
+ // i.e. the next region starts after column or if not, ends after column
while ((index < hiddenColumns.size())
- && (hiddenColumns.get(index)[0] <= column))
+ && (column > hiddenColumns.get(index)[1]))
{
int[] region = hiddenColumns.get(index);
hiddenCount += region[1] - region[0] + 1;
index++;
}
-
}
- else // (column < hiddenColumns.get(regionIndex)[0])
+
+ // column is before current region
+ else if (column < hiddenColumns.get(index)[0])
{
while ((index > 0) && (hiddenColumns.get(index)[1] > column))
{