mirror of https://github.com/apache/lucene.git
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:
parent
4e01800d3c
commit
2a7b13bd8f
|
@ -108,7 +108,7 @@ public class BitSetIterator {
|
||||||
return (i<<6) + bitIndex;
|
return (i<<6) + bitIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
int next(int fromIndex) {
|
public int next(int fromIndex) {
|
||||||
indexArray=0;
|
indexArray=0;
|
||||||
i = fromIndex >> 6;
|
i = fromIndex >> 6;
|
||||||
if (i>=words) {
|
if (i>=words) {
|
||||||
|
|
|
@ -30,12 +30,16 @@ public class TestOpenBitSet extends TestCase {
|
||||||
} while (aa>=0);
|
} while (aa>=0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// test interleaving different BitSetIterator.next()
|
||||||
void doIterate(BitSet a, OpenBitSet b) {
|
void doIterate(BitSet a, OpenBitSet b) {
|
||||||
int aa=-1,bb=-1;
|
int aa=-1,bb=-1;
|
||||||
BitSetIterator iterator = new BitSetIterator(b);
|
BitSetIterator iterator = new BitSetIterator(b);
|
||||||
do {
|
do {
|
||||||
aa = a.nextSetBit(aa+1);
|
aa = a.nextSetBit(aa+1);
|
||||||
|
if (rand.nextBoolean())
|
||||||
bb = iterator.next();
|
bb = iterator.next();
|
||||||
|
else
|
||||||
|
bb = iterator.next(bb+1);
|
||||||
assertEquals(aa,bb);
|
assertEquals(aa,bb);
|
||||||
} while (aa>=0);
|
} while (aa>=0);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue