BitSetIterator.next(int startFrom) public, add test

git-svn-id: https://svn.apache.org/repos/asf/incubator/solr/trunk@440369 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Yonik Seeley 2006-09-05 15:23:18 +00:00
parent 4e01800d3c
commit 2a7b13bd8f
2 changed files with 6 additions and 2 deletions

View File

@ -108,7 +108,7 @@ public class BitSetIterator {
return (i<<6) + bitIndex;
}
int next(int fromIndex) {
public int next(int fromIndex) {
indexArray=0;
i = fromIndex >> 6;
if (i>=words) {

View File

@ -30,12 +30,16 @@ public class TestOpenBitSet extends TestCase {
} while (aa>=0);
}
// test interleaving different BitSetIterator.next()
void doIterate(BitSet a, OpenBitSet b) {
int aa=-1,bb=-1;
BitSetIterator iterator = new BitSetIterator(b);
do {
aa = a.nextSetBit(aa+1);
bb = iterator.next();
if (rand.nextBoolean())
bb = iterator.next();
else
bb = iterator.next(bb+1);
assertEquals(aa,bb);
} while (aa>=0);
}