/** this = this AND NOT other */ public void andNot(FixedBitSet other) { andNot(other.bits, other.numWords); }
/** returns a Scorer for all other (non INTERSECT) queries */ protected Scorer getScorer(XLatLonShapeQuery query, Weight weight, FixedBitSet intersect, FixedBitSet disjoint, final float boost) throws IOException { values.intersect(visitor); DocIdSetIterator iterator; if (query.queryRelation == QueryRelation.DISJOINT) { disjoint.andNot(intersect); iterator = new BitSetIterator(disjoint, cost()); } else if (query.queryRelation == QueryRelation.WITHIN) { intersect.andNot(disjoint); iterator = new BitSetIterator(intersect, cost()); } else { iterator = new BitSetIterator(intersect, cost()); } return new ConstantScoreScorer(weight, boost, iterator); }
/** this = this AND NOT other */ public void andNot(FixedBitSet other) { andNot(other.bits, other.numWords); }
/** this = this AND NOT other */ public void andNot(FixedBitSet other) { andNot(other.bits, other.numWords); }
/** this = this AND NOT other */ public void andNot(FixedBitSet other) { andNot(other.bits, other.numWords); }
@Override protected DocIdSet finish() { inside.andNot(outside); return new BitDocIdSet(inside); }
@Override protected DocIdSet finish() { inside.andNot(outside); return new BitDocIdSet(inside); }
/** * Removes from this builder documents that are contained in <code>it</code>. */ @Deprecated public void andNot(DocIdSetIterator it) throws IOException { if (denseSet != null) { denseSet.andNot(it); } else if (sparseSet != null) { sparseSet.andNot(it); } }
/** * Removes from this builder documents that are contained in <code>it</code>. */ @Deprecated public void andNot(DocIdSetIterator it) throws IOException { if (denseSet != null) { denseSet.andNot(it); } else if (sparseSet != null) { sparseSet.andNot(it); } }
/** * Sets {@link #tempSet} to be a bitset with a "1" in the position of every dimension * in the {@link #votingRecord} that exactly matches the target number. */ private synchronized void setTempSetToExactMatches(int target) { if (target == 0) { tempSet.set(0, dimension); tempSet.xor(votingRecord.get(0)); for (int x = 1; x < votingRecord.size(); x++) tempSet.andNot(votingRecord.get(x)); } else { String inbinary = reverse(Integer.toBinaryString(target)); tempSet.xor(tempSet); try { tempSet.xor(votingRecord.get(inbinary.indexOf("1"))); //this requires error checking, it is throwing an index out of bounds exception } catch (Exception e) { e.printStackTrace(); } for (int q =0; q < votingRecord.size(); q++) { if (q < inbinary.length() && inbinary.charAt(q) == '1') tempSet.and(votingRecord.get(q)); else tempSet.andNot(votingRecord.get(q)); } } }
@Override public void andNot(DocIdSetIterator iter) throws IOException { if (BitSetIterator.getFixedBitSetOrNull(iter) != null) { assertUnpositioned(iter); final FixedBitSet bits = BitSetIterator.getFixedBitSetOrNull(iter); andNot(bits); } else { super.andNot(iter); } }
@Override public void andNot(DocIdSetIterator iter) throws IOException { if (BitSetIterator.getFixedBitSetOrNull(iter) != null) { assertUnpositioned(iter); final FixedBitSet bits = BitSetIterator.getFixedBitSetOrNull(iter); andNot(bits); } else { super.andNot(iter); } }
/** returns a Scorer for all other (non INTERSECT) queries */ protected Scorer getScorer(LatLonShapeQuery query, Weight weight, FixedBitSet intersect, FixedBitSet disjoint, final float boost) throws IOException { values.intersect(visitor); DocIdSetIterator iterator; if (query.queryRelation == QueryRelation.DISJOINT) { disjoint.andNot(intersect); iterator = new BitSetIterator(disjoint, cost()); } else if (query.queryRelation == QueryRelation.WITHIN) { intersect.andNot(disjoint); iterator = new BitSetIterator(intersect, cost()); } else { iterator = new BitSetIterator(intersect, cost()); } return new ConstantScoreScorer(weight, boost, iterator); }
tempSet.andNot(votingRecord.get(x-1)); //if 1 already added, eliminate dimension from tempSet votingRecord.get(x).xor(tempSet);
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; }