lemire/javaewah — pull request #38 by gssiyankai (2014-08-12 20:32:02+00:00)
Title: Implement composition using chunk iterators

This PR introduces a new kind of iterators over bitmap: chunk iterators. When it traverses a bitmap, a chunk iterator gives the value of the bit it is pointing to (true or false) and the number of consecutive bits with the same value.

For example, with the bitmap A = { 1, 1, 0, 0, 0, 1 }, the chunk iterator will give successively (true, 2), (false, 3), (true, 1).

Note that it is possible to skip an arbitrary number of bits at any position. In the above example, if the chunk iterator is pointing to the third bit, it returns (false, 3). It can then be moved to the second following bit and it will return (false, 1).

Finally, bitmap composition implementation has been adapted to use chunk iterators.