Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.lucene.util
Class OpenBitSetIterator

    java.lang.Object
      org.apache.lucene.search.DocIdSetIterator
          org.apache.lucene.util.OpenBitSetIterator

    public class OpenBitSetIterator

extends DocIdSetIterator

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.

Version:
  $Id$

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

### bitlist

    protected static final int[] bitlist

Constructor Detail

### OpenBitSetIterator

    public OpenBitSetIterator(OpenBitSet obs)

### OpenBitSetIterator

    public OpenBitSetIterator(long[] bits,
                              int numWords)

Method Detail

### next

    public 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(); }

  Specified by:
    `next` in class `DocIdSetIterator`

### skipTo

    public boolean skipTo(int target)

  Description copied from class: `DocIdSetIterator`
  Skips entries to the first beyond the current whose document number is greater than or equal to target.

  Returns 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.

  Specified by:
    `skipTo` in class `DocIdSetIterator`

### doc

    public int doc()

  Description copied from class: `DocIdSetIterator`
  Returns the current document number.

  This is invalid until `DocIdSetIterator.next()` is called for the first time.

  Specified by:
    `doc` in class `DocIdSetIterator`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000-2009 Apache Software Foundation. All Rights Reserved.