|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.lucene.search.DocIdSetIterator
org.apache.lucene.util.OpenBitSetIterator
public class OpenBitSetIterator
An iterator to iterate over set bits in an OpenBitSet. This is faster than nextSetBit() for iterating over the complete set of bits, especially when the density of the bits set is high.
| Field Summary | |
|---|---|
protected static int[] |
bitlist
|
| Constructor Summary | |
|---|---|
OpenBitSetIterator(long[] bits,
int numWords)
|
|
OpenBitSetIterator(OpenBitSet obs)
|
|
| Method Summary | |
|---|---|
int |
doc()
Returns the current document number. |
boolean |
next()
alternate shift implementations // 32 bit shifts, but a long shift needed at the end private void shift2() { int y = (int)word; if (y==0) {wordShift +=32; y = (int)(word >>>32); } if ((y & 0x0000FFFF) == 0) { wordShift +=16; y>>>=16; } if ((y & 0x000000FF) == 0) { wordShift +=8; y>>>=8; } indexArray = bitlist[y & 0xff]; word >>>= (wordShift +1); } private void shift3() { int lower = (int)word; int lowByte = lower & 0xff; if (lowByte != 0) { indexArray=bitlist[lowByte]; return; } shift(); } |
boolean |
skipTo(int target)
Skips entries to the first beyond the current whose document number is greater than or equal to target. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final int[] bitlist
| Constructor Detail |
|---|
public OpenBitSetIterator(OpenBitSet obs)
public OpenBitSetIterator(long[] bits,
int numWords)
| Method Detail |
|---|
public boolean next()
next in class DocIdSetIteratorpublic boolean skipTo(int target)
DocIdSetIteratorReturns true iff there is such an entry.
Behaves as if written:
boolean skipTo(int target) {
do {
if (!next())
return false;
} while (target > doc());
return true;
}
Some implementations are considerably more efficient than that.
skipTo in class DocIdSetIteratorpublic int doc()
DocIdSetIterator This is invalid until DocIdSetIterator.next() is called for the first time.
doc in class DocIdSetIterator
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||