Ejemplo n.º 1
0
 @Override
 public void compute(OpenBitSetDISI accumulator, DocIdSet bitset) throws IOException {
   if (bitset instanceof OpenBitSet) {
     accumulator.and((OpenBitSet) bitset);
   } else if (bitset instanceof SortedVIntList) {
     accumulator.inPlaceAnd(bitset.iterator());
   } else {
     throw new IllegalArgumentException("Not supported:" + bitset);
   }
 }
  @SuppressWarnings({"unchecked"})
  @Override
  public T[] call() throws Exception {
    OpenBitSetDISI accumulator = new OpenBitSetDISI(finalBitsetSize);

    OpenBitSetDISI toCompareDisi = new OpenBitSetDISI(finalBitsetSize);
    toCompareDisi.inPlaceOr(toCompare.iterator());

    Object[] result = new Object[toIndex - fromIndex];
    for (int i = fromIndex; i < toIndex; i++) {
      result[i - fromIndex] = operation.compute(accumulator, bs[i], toCompareDisi);
    }

    return ArrayUtils.typedArray(result);
  }