Class 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

      Fields 
      Modifier and Type Field Description
      private long[] arr
      the python code that generated bitlist def bits2int(val): arr=0 for shift in range(8,0,-1): if val & 0x80: arr = (arr << 4) | shift val = val << 1 return arr def int_table(): tbl = [ hex(bits2int(val)).strip('L') for val in range(256) ] return ','.join(tbl)
      (package private) static int[] bitlist  
      private int i  
      private int indexArray  
      static int NO_MORE  
      private long word  
      private int words  
      private int wordShift  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int nextSetBit()  
      private void shift()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • bitlist

        static final int[] bitlist
      • arr

        private final long[] arr
        the python code that generated bitlist def bits2int(val): arr=0 for shift in range(8,0,-1): if val & 0x80: arr = (arr << 4) | shift val = val << 1 return arr def int_table(): tbl = [ hex(bits2int(val)).strip('L') for val in range(256) ] return ','.join(tbl)
      • words

        private final int words
      • i

        private int i
      • word

        private long word
      • wordShift

        private int wordShift
      • indexArray

        private int indexArray
    • Constructor Detail

      • BitSetIterator

        public BitSetIterator​(BitSet obs)
      • BitSetIterator

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

      • shift

        private void shift()
      • nextSetBit

        public int nextSetBit()