本文整理汇总了Java中org.apache.lucene.util.FixedBitSet.nextSetBit方法的典型用法代码示例。如果您正苦于以下问题:Java FixedBitSet.nextSetBit方法的具体用法?Java FixedBitSet.nextSetBit怎么用?Java FixedBitSet.nextSetBit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.lucene.util.FixedBitSet
的用法示例。
在下文中一共展示了FixedBitSet.nextSetBit方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: next
import org.apache.lucene.util.FixedBitSet; //导入方法依赖的package包/类
@Override
public void next() {
LimitedBitSetHitCollector collector = (LimitedBitSetHitCollector) this.getCollector();
int atomicDocId = this.currentAtomicDocId;
if (currentAtomicReaderId < collector.getFixedSets().size()) {
do {
FixedBitSet bitSet = collector.getFixedSets().get(currentAtomicReaderId);
if (atomicDocId == DocIdSetIterator.NO_MORE_DOCS) { // we start a new reader, reset the doc id
atomicDocId = -1;
}
atomicDocId = atomicDocId + 1 < bitSet.length() ? bitSet.nextSetBit(atomicDocId + 1) : DocIdSetIterator.NO_MORE_DOCS;
} while (atomicDocId == DocIdSetIterator.NO_MORE_DOCS && ++currentAtomicReaderId < collector.getFixedSets().size());
}
this.currentAtomicDocId = atomicDocId;
this.count++;
}
示例2: verify
import org.apache.lucene.util.FixedBitSet; //导入方法依赖的package包/类
private void verify(SortedNumericDocValues values, int maxDoc, FixedBitSet rootDocs, FixedBitSet innerDocs) throws IOException {
for (long missingValue : new long[] { 0, randomLong() }) {
for (MultiValueMode mode : new MultiValueMode[] {MultiValueMode.MIN, MultiValueMode.MAX, MultiValueMode.SUM, MultiValueMode.AVG}) {
final NumericDocValues selected = mode.select(values, missingValue, rootDocs, new BitSetIterator(innerDocs, 0L), maxDoc);
int prevRoot = -1;
for (int root = rootDocs.nextSetBit(0); root != -1; root = root + 1 < maxDoc ? rootDocs.nextSetBit(root + 1) : -1) {
final long actual = selected.get(root);
long expected = 0;
if (mode == MultiValueMode.MAX) {
expected = Long.MIN_VALUE;
} else if (mode == MultiValueMode.MIN) {
expected = Long.MAX_VALUE;
}
int numValues = 0;
for (int child = innerDocs.nextSetBit(prevRoot + 1); child != -1 && child < root; child = innerDocs.nextSetBit(child + 1)) {
values.setDocument(child);
for (int j = 0; j < values.count(); ++j) {
if (mode == MultiValueMode.SUM || mode == MultiValueMode.AVG) {
expected += values.valueAt(j);
} else if (mode == MultiValueMode.MIN) {
expected = Math.min(expected, values.valueAt(j));
} else if (mode == MultiValueMode.MAX) {
expected = Math.max(expected, values.valueAt(j));
}
++numValues;
}
}
if (numValues == 0) {
expected = missingValue;
} else if (mode == MultiValueMode.AVG) {
expected = numValues > 1 ? Math.round((double) expected / (double) numValues) : expected;
}
assertEquals(mode.toString() + " docId=" + root, expected, actual);
prevRoot = root;
}
}
}
}