当前位置: 首页>>代码示例>>Java>>正文


Java FixedBitSet.andNot方法代码示例

本文整理汇总了Java中org.apache.lucene.util.FixedBitSet.andNot方法的典型用法代码示例。如果您正苦于以下问题:Java FixedBitSet.andNot方法的具体用法?Java FixedBitSet.andNot怎么用?Java FixedBitSet.andNot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.lucene.util.FixedBitSet的用法示例。


在下文中一共展示了FixedBitSet.andNot方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: andNot

import org.apache.lucene.util.FixedBitSet; //导入方法依赖的package包/类
@Override
public DocSet andNot(DocSet other) {
  FixedBitSet newbits = bits.clone();
  if (other instanceof BitDocSet) {
    newbits.andNot(((BitDocSet) other).bits);
  } else {
    DocIterator iter = other.iterator();
    while (iter.hasNext()) {
      int doc = iter.nextDoc();
      if (doc < newbits.length()) {
        newbits.clear(doc);
      }
    }
  }
  return new BitDocSet(newbits);
}
 
开发者ID:europeana,项目名称:search,代码行数:17,代码来源:BitDocSet.java

示例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));
}
 
开发者ID:europeana,项目名称:search,代码行数:31,代码来源:TestDocSet.java

示例3: concludeVote

import org.apache.lucene.util.FixedBitSet; //导入方法依赖的package包/类
protected synchronized FixedBitSet concludeVote(int target) {
  int target2 = (int) Math.ceil((double) target / (double) 2);
  target2 = target2 - minimum;

  // Unlikely other than in testing: minimum more than half the votes
  if (target2 < 0) {
    FixedBitSet ans = new FixedBitSet(dimension);
    ans.set(0, dimension);
    return ans;
  }

  boolean even = (target % 2 == 0);
  FixedBitSet result = concludeVote(target2, votingRecord.size() - 1);

  if (even) {
    setTempSetToExactMatches(target2);
    boolean switcher = true;
    // 50% chance of being true with split vote.
    int q = tempSet.nextSetBit(0);
    while (q != DocIdSetIterator.NO_MORE_DOCS)
    	{
  	  switcher = !switcher;
        if (switcher) tempSet.clear(q);
        q = tempSet.nextSetBit(q);
    	}
    		result.andNot(tempSet);
  }
  return result;
}
 
开发者ID:semanticvectors,项目名称:semanticvectors,代码行数:30,代码来源:BinaryVector.java

示例4: 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;
    }
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:51,代码来源:ChainedFilter.java

示例5: andNot

import org.apache.lucene.util.FixedBitSet; //导入方法依赖的package包/类
@Override
public DocSet andNot(DocSet other) {
  FixedBitSet newbits = getBits().clone();
  newbits.andNot(toBitSet(other));
  return new BitDocSet(newbits);
}
 
开发者ID:europeana,项目名称:search,代码行数:7,代码来源:DocSetBase.java


注:本文中的org.apache.lucene.util.FixedBitSet.andNot方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。