{
private static final int HASH_MULTIPLIER = 31;
+ private static final int NUMCOLUMNS_RESET = -1; // value of numColumns if it
+ // needs to be recalculated
+
private static final ReentrantReadWriteLock LOCK = new ReentrantReadWriteLock();
/*
prevHiddenCount);
// reset the number of columns so they will be recounted
- numColumns = 0;
+ resetNumColumns();
} finally
{
hideColumns(r[0], r[1]);
}
cursor = new HiddenColumnsCursor(hiddenColumns);
- numColumns = 0;
+ resetNumColumns();
} finally
{
LOCK.writeLock().unlock();
}
hiddenColumns.clear();
cursor = new HiddenColumnsCursor(hiddenColumns);
- numColumns = 0;
+ resetNumColumns();
} finally
{
if (hiddenColumns.isEmpty())
{
- numColumns = 0;
+ resetNumColumns();
}
else
{
{
LOCK.readLock().lock();
- if (numColumns == 0)
+ if (numColumns == NUMCOLUMNS_RESET)
{
// numColumns is out of date, so recalculate
int size = 0;
}
/**
+ * Reset numColumns so that it gets recalculated. Currently the code does not
+ * recalculate numColumns on hide/reveal as it requires a full sweep of the
+ * hidden columns collection / smarter updating. Placeholder here if later on
+ * a recalculation is added.
+ */
+ private void resetNumColumns()
+ {
+ numColumns = NUMCOLUMNS_RESET;
+ }
+
+ /**
* Get the number of distinct hidden regions
*
* @return number of regions
hideColumns(firstSet, lastSet - 1);
}
cursor = new HiddenColumnsCursor(hiddenColumns);
- numColumns = 0;
+ resetNumColumns();
} finally
{
LOCK.writeLock().unlock();
hiddenColumns.subList(startindex, endindex + 1).clear();
cursor = new HiddenColumnsCursor(hiddenColumns);
- numColumns = 0;
+ resetNumColumns();
}
} finally
{