Rename assertUnpositioned to checkUnpositioned since this is a hard exception and not an assertion.

This commit is contained in:
Adrien Grand 2017-08-22 08:39:44 +02:00
parent ebc3916b04
commit ea14a0721d
3 changed files with 6 additions and 6 deletions

View File

@ -79,7 +79,7 @@ public abstract class BitSet implements MutableBits, Accountable {
public abstract int nextSetBit(int index);
/** Assert that the current doc is -1. */
protected final void assertUnpositioned(DocIdSetIterator iter) {
protected final void checkUnpositioned(DocIdSetIterator iter) {
if (iter.docID() != -1) {
throw new IllegalStateException("This operation only works with an unpositioned iterator, got current position = " + iter.docID());
}
@ -88,7 +88,7 @@ public abstract class BitSet implements MutableBits, Accountable {
/** Does in-place OR of the bits provided by the iterator. The state of the
* iterator after this operation terminates is undefined. */
public void or(DocIdSetIterator iter) throws IOException {
assertUnpositioned(iter);
checkUnpositioned(iter);
for (int doc = iter.nextDoc(); doc != DocIdSetIterator.NO_MORE_DOCS; doc = iter.nextDoc()) {
set(doc);
}

View File

@ -264,7 +264,7 @@ public final class FixedBitSet extends BitSet implements MutableBits, Accountabl
@Override
public void or(DocIdSetIterator iter) throws IOException {
if (BitSetIterator.getFixedBitSetOrNull(iter) != null) {
assertUnpositioned(iter);
checkUnpositioned(iter);
final FixedBitSet bits = BitSetIterator.getFixedBitSetOrNull(iter);
or(bits);
} else {
@ -293,7 +293,7 @@ public final class FixedBitSet extends BitSet implements MutableBits, Accountabl
/** Does in-place XOR of the bits provided by the iterator. */
public void xor(DocIdSetIterator iter) throws IOException {
assertUnpositioned(iter);
checkUnpositioned(iter);
if (BitSetIterator.getFixedBitSetOrNull(iter) != null) {
final FixedBitSet bits = BitSetIterator.getFixedBitSetOrNull(iter);
xor(bits);

View File

@ -413,7 +413,7 @@ public class SparseFixedBitSet extends BitSet implements Bits, Accountable {
* {@link #or(DocIdSetIterator)} impl that works best when <code>it</code> is dense
*/
private void orDense(DocIdSetIterator it) throws IOException {
assertUnpositioned(it);
checkUnpositioned(it);
// The goal here is to try to take advantage of the ordering of documents
// to build the data-structure more efficiently
// NOTE: this heavily relies on the fact that shifts are mod 64
@ -466,7 +466,7 @@ public class SparseFixedBitSet extends BitSet implements Bits, Accountable {
// specialize union with another SparseFixedBitSet
final SparseFixedBitSet other = BitSetIterator.getSparseFixedBitSetOrNull(it);
if (other != null) {
assertUnpositioned(it);
checkUnpositioned(it);
or(other);
return;
}