本文整理汇总了Java中org.apache.lucene.util.FixedBitSet.and方法的典型用法代码示例。如果您正苦于以下问题:Java FixedBitSet.and方法的具体用法?Java FixedBitSet.and怎么用?Java FixedBitSet.and使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.lucene.util.FixedBitSet
的用法示例。
在下文中一共展示了FixedBitSet.and方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: intersection
import org.apache.lucene.util.FixedBitSet; //导入方法依赖的package包/类
@Override
public DocSet intersection(DocSet other) {
// intersection is overloaded in the smaller DocSets to be more
// efficient, so dispatch off of it instead.
if (!(other instanceof BitDocSet)) {
return other.intersection(this);
}
// Default... handle with bitsets.
FixedBitSet newbits = getBits().clone();
newbits.and(toBitSet(other));
return new BitDocSet(newbits);
}
示例2: doSingle
import org.apache.lucene.util.FixedBitSet; //导入方法依赖的package包/类
protected void doSingle(int maxSize) {
int sz = rand.nextInt(maxSize+1);
int sz2 = rand.nextInt(maxSize);
FixedBitSet bs1 = getRandomSet(sz, rand.nextInt(sz+1));
FixedBitSet bs2 = getRandomSet(sz, rand.nextInt(sz2+1));
DocSet a1 = new BitDocSet(bs1);
DocSet a2 = new BitDocSet(bs2);
DocSet b1 = getDocSet(bs1);
DocSet b2 = getDocSet(bs2);
checkEqual(bs1,b1);
checkEqual(bs2,b2);
iter(a1,b1);
iter(a2,b2);
FixedBitSet a_and = bs1.clone(); a_and.and(bs2);
FixedBitSet a_or = bs1.clone(); a_or.or(bs2);
// FixedBitSet a_xor = bs1.clone(); a_xor.xor(bs2);
FixedBitSet a_andn = bs1.clone(); a_andn.andNot(bs2);
checkEqual(a_and, b1.intersection(b2));
checkEqual(a_or, b1.union(b2));
checkEqual(a_andn, b1.andNot(b2));
assertEquals(a_and.cardinality(), b1.intersectionSize(b2));
assertEquals(a_or.cardinality(), b1.unionSize(b2));
assertEquals(a_andn.cardinality(), b1.andNotSize(b2));
}
示例3: doChain
import org.apache.lucene.util.FixedBitSet; //导入方法依赖的package包/类
private void doChain(FixedBitSet result, int logic, DocIdSet dis) throws IOException {
if (dis instanceof FixedBitSet) {
// optimized case for FixedBitSets
switch (logic) {
case OR:
result.or((FixedBitSet) dis);
break;
case AND:
result.and((FixedBitSet) dis);
break;
case ANDNOT:
result.andNot((FixedBitSet) dis);
break;
case XOR:
result.xor((FixedBitSet) dis);
break;
default:
doChain(result, DEFAULT, dis);
break;
}
} else {
DocIdSetIterator disi;
if (dis == null) {
disi = DocIdSetIterator.empty();
} else {
disi = dis.iterator();
if (disi == null) {
disi = DocIdSetIterator.empty();
}
}
switch (logic) {
case OR:
result.or(disi);
break;
case AND:
result.and(disi);
break;
case ANDNOT:
result.andNot(disi);
break;
case XOR:
result.xor(disi);
break;
default:
doChain(result, DEFAULT, dis);
break;
}
}
}