switch (r.nextInt(2)) {
case 0:
final ArrayList<Bytes> termsForQuery = new ArrayList<Bytes>();
final ArrayList<Bytes> terms = new ArrayList<Bytes>();
for(int i=r.nextInt(10); i>=0; i--) {
Bytes bytes = randTerm(r);
terms.add(bytes);
termsForQuery.add(bytes.copy());
}
node = index.getTerms(termsForQuery, revNum);
matches = new Filter<Bytes>(){
public MatchReq filter(Bytes item) {
return terms.contains(item) ? MatchReq.mustmatch : MatchReq.nomatch;
}
};
break;
case 1:
Range range = genRange(r);
range.flattenTerms();
boolean relaxed = false;
Range spec = null;
if (r.nextBoolean()) {
node = index.getRange(new Range(range), revNum);
} else {
spec = new Range(range);
Bytes prefix = range.getPrefix();
Bytes min = range.getMinSuffix();
Bytes max = range.getMaxSuffix();
if (min == null && max == null) {
range.setPrefix(new SlicedBytes(prefix, 0, r.nextInt(prefix.getLength()+1)));
} else if (min == null) {
range.setMaxSuffix(new SlicedBytes(max, 0, r.nextInt(max.getLength()+1)));
} else {
range.setMinSuffix(new SlicedBytes(min, 0, r.nextInt(min.getLength()+1)));
}
spec.flattenTerms();
range.flattenTerms();