com.carrotsearch.hppc
Class BitSetIterator

java.lang.Object
  extended by com.carrotsearch.hppc.BitSetIterator

public class BitSetIterator
extends java.lang.Object

An iterator to iterate over set bits in an BitSet. 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
static int NO_MORE
          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(); }
 
Constructor Summary
BitSetIterator(BitSet obs)
           
BitSetIterator(long[] bits, int numWords)
           
 
Method Summary
 int nextSetBit()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NO_MORE

public static final int NO_MORE
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(); }

See Also:
Constant Field Values
Constructor Detail

BitSetIterator

public BitSetIterator(BitSet obs)

BitSetIterator

public BitSetIterator(long[] bits,
                      int numWords)
Method Detail

nextSetBit

public int nextSetBit()


Copyright © 2011 Carrot Search s.c.. All Rights Reserved.