}
}
+ /**
+ *
+ * @param inserts
+ * BitSet where hidden columns will be marked
+ */
+ public void markHiddenRegions(BitSet inserts)
+ {
+ if (hiddenColumns == null)
+ {
+ return;
+ }
+ for (int[] range : hiddenColumns)
+ {
+ inserts.set(range[0], range[1] + 1);
+ }
+ }
+
}
import java.util.Arrays;
import java.util.BitSet;
import java.util.List;
+import java.util.Random;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
assertEquals(2, cs.adjustForHiddenColumns(2));
assertEquals(4, cs.adjustForHiddenColumns(3));
}
+
+ @Test(groups = { "Functional" })
+ public void testGetBitset()
+ {
+ BitSet toMark, fromMark;
+ long seed = -3241532;
+ Random number = new Random(seed);
+ for (int n = 0; n < 1000; n++)
+ {
+ // create a random bitfield
+ toMark = BitSet.valueOf(new long[] { number.nextLong(),
+ number.nextLong(), number.nextLong() });
+ toMark.set(n * number.nextInt(10), n * (25 + number.nextInt(25)));
+ HiddenColumns hc = new HiddenColumns();
+ hc.hideMarkedBits(toMark);
+
+ // see if we can recover bitfield
+ hc.markHiddenRegions(fromMark = new BitSet());
+ assertEquals(toMark, fromMark);
+ }
+ }
}