int icount = (int)res.cardinality();
test(bds1.intersection(bds).size() == icount);
test(bds1.intersectionSize(bds) == icount);
if (bds1.intersection(hds).size() != icount) {
DocSet ds = bds1.intersection(hds);
System.out.println("STOP");
}
test(bds1.intersection(hds).size() == icount);
test(bds1.intersectionSize(hds) == icount);
test(hds1.intersection(bds).size() == icount);
test(hds1.intersectionSize(bds) == icount);
test(hds1.intersection(hds).size() == icount);
test(hds1.intersectionSize(hds) == icount);
ret += icount;
}
}
String type=null;
String oper=null;
if (test.endsWith("B")) { type="B"; }
if (test.endsWith("H")) { type="H"; }
if (test.endsWith("M")) { type="M"; }
if (test.startsWith("intersect")) oper="intersect";
if (test.startsWith("intersectSize")) oper="intersectSize";
if (test.startsWith("intersectAndSize")) oper="intersectSize";
if (oper!=null) {
for (int it=0; it<iter; it++) {
int idx1 = rand.nextInt(numSets);
int idx2 = rand.nextInt(numSets);
DocSet a=null,b=null;
if (type=="B") {
a=bset[idx1]; b=bset[idx2];
} else if (type=="H") {
a=hset[idx1]; b=bset[idx2];
} else if (type=="M") {
if (idx1 < idx2) {
a=bset[idx1];
b=hset[idx2];
} else {
a=hset[idx1];
b=bset[idx2];
}
}
if (oper=="intersect") {
DocSet res = a.intersection(b);
ret += res.memSize();
} else if (oper=="intersectSize") {
ret += a.intersectionSize(b);
} else if (oper=="intersectAndSize") {
DocSet res = a.intersection(b);
ret += res.size();
}
}
}