}
}
+ /**
+ * Get the number of distinct hidden regions
+ *
+ * @return number of regions
+ */
+ public int getNumberOfRegions()
+ {
+ try
+ {
+ LOCK.readLock().lock();
+ int num = 0;
+ if (hasHiddenColumns())
+ {
+ num = hiddenColumns.size();
+ }
+ return num;
+ } finally
+ {
+ LOCK.readLock().unlock();
+ }
+ }
+
@Override
public boolean equals(Object obj)
{
// but where each hidden column region is shifted backwards by the number of
// preceding visible gaps
// update hidden columns at the same time
- ArrayList<int[]> regions = getHiddenColumnsCopy();
+ Iterator<int[]> regions = iterator();
ArrayList<int[]> newhidden = new ArrayList<>();
int numGapsBefore = 0;
int gapPosition = 0;
- for (int[] region : regions)
+ while (regions.hasNext())
{
// get region coordinates accounting for gaps
// we can rely on gaps not being *in* hidden regions because we already
// removed those
+ int[] region = regions.next();
while (gapPosition < region[0])
{
gapPosition++;
{
if (hiddenColumns != null)
{
- return new BoundedHiddenColsIterator(0, hiddenColumns.size(), true);
+ int last = hiddenColumns.get(hiddenColumns.size() - 1)[1];
+ return new BoundedHiddenColsIterator(0, last, true);
}
else
{
* lower bound to iterate from
* @param upperBound
* upper bound to iterate to
- * @param opt
- * Option.OVERLAP: regions which overlap [lowerBound,upperBound]
- * are included Option.START: regions which start in
- * [lowerBound,upperBound] are included
- * @param useAbsolutePos
- * have bounds and return values with reference to absolute indices
- * (if false, use indices for visible columns)
* @param useCopyCols
* whether to make a local copy of hiddenColumns for iteration (set
* to true if calling from outwith the HiddenColumns class)