mirror of https://github.com/apache/lucene.git
Rename assertUnpositioned to checkUnpositioned since this is a hard exception and not an assertion.
This commit is contained in:
parent
ebc3916b04
commit
ea14a0721d
|
@ -79,7 +79,7 @@ public abstract class BitSet implements MutableBits, Accountable {
|
||||||
public abstract int nextSetBit(int index);
|
public abstract int nextSetBit(int index);
|
||||||
|
|
||||||
/** Assert that the current doc is -1. */
|
/** Assert that the current doc is -1. */
|
||||||
protected final void assertUnpositioned(DocIdSetIterator iter) {
|
protected final void checkUnpositioned(DocIdSetIterator iter) {
|
||||||
if (iter.docID() != -1) {
|
if (iter.docID() != -1) {
|
||||||
throw new IllegalStateException("This operation only works with an unpositioned iterator, got current position = " + iter.docID());
|
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
|
/** Does in-place OR of the bits provided by the iterator. The state of the
|
||||||
* iterator after this operation terminates is undefined. */
|
* iterator after this operation terminates is undefined. */
|
||||||
public void or(DocIdSetIterator iter) throws IOException {
|
public void or(DocIdSetIterator iter) throws IOException {
|
||||||
assertUnpositioned(iter);
|
checkUnpositioned(iter);
|
||||||
for (int doc = iter.nextDoc(); doc != DocIdSetIterator.NO_MORE_DOCS; doc = iter.nextDoc()) {
|
for (int doc = iter.nextDoc(); doc != DocIdSetIterator.NO_MORE_DOCS; doc = iter.nextDoc()) {
|
||||||
set(doc);
|
set(doc);
|
||||||
}
|
}
|
||||||
|
|
|
@ -264,7 +264,7 @@ public final class FixedBitSet extends BitSet implements MutableBits, Accountabl
|
||||||
@Override
|
@Override
|
||||||
public void or(DocIdSetIterator iter) throws IOException {
|
public void or(DocIdSetIterator iter) throws IOException {
|
||||||
if (BitSetIterator.getFixedBitSetOrNull(iter) != null) {
|
if (BitSetIterator.getFixedBitSetOrNull(iter) != null) {
|
||||||
assertUnpositioned(iter);
|
checkUnpositioned(iter);
|
||||||
final FixedBitSet bits = BitSetIterator.getFixedBitSetOrNull(iter);
|
final FixedBitSet bits = BitSetIterator.getFixedBitSetOrNull(iter);
|
||||||
or(bits);
|
or(bits);
|
||||||
} else {
|
} 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. */
|
/** Does in-place XOR of the bits provided by the iterator. */
|
||||||
public void xor(DocIdSetIterator iter) throws IOException {
|
public void xor(DocIdSetIterator iter) throws IOException {
|
||||||
assertUnpositioned(iter);
|
checkUnpositioned(iter);
|
||||||
if (BitSetIterator.getFixedBitSetOrNull(iter) != null) {
|
if (BitSetIterator.getFixedBitSetOrNull(iter) != null) {
|
||||||
final FixedBitSet bits = BitSetIterator.getFixedBitSetOrNull(iter);
|
final FixedBitSet bits = BitSetIterator.getFixedBitSetOrNull(iter);
|
||||||
xor(bits);
|
xor(bits);
|
||||||
|
|
|
@ -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
|
* {@link #or(DocIdSetIterator)} impl that works best when <code>it</code> is dense
|
||||||
*/
|
*/
|
||||||
private void orDense(DocIdSetIterator it) throws IOException {
|
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
|
// The goal here is to try to take advantage of the ordering of documents
|
||||||
// to build the data-structure more efficiently
|
// to build the data-structure more efficiently
|
||||||
// NOTE: this heavily relies on the fact that shifts are mod 64
|
// 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
|
// specialize union with another SparseFixedBitSet
|
||||||
final SparseFixedBitSet other = BitSetIterator.getSparseFixedBitSetOrNull(it);
|
final SparseFixedBitSet other = BitSetIterator.getSparseFixedBitSetOrNull(it);
|
||||||
if (other != null) {
|
if (other != null) {
|
||||||
assertUnpositioned(it);
|
checkUnpositioned(it);
|
||||||
or(other);
|
or(other);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue