Class Rank11

  • All Implemented Interfaces:
    Rank, java.io.Serializable

    public class Rank11
    extends AbstractRank
    implements Rank
    A rank11 implementation.

    rank11 is a ranking structure using 6.25% additional space and providing very fast ranking. It was proposed by Simon Gog and Matthias Petri in “Optimized succinct data structures for massive data”, Softw. Pract. Exper., 2014. The only difference between this implementation and their rank_support_v5 is that counts for blocks are stored as in Rank9 (that is, in opposite order).

    Note that to achieve such a low overhead, rank(long) contains a loop. As a consequence, the implementation of this method is significantly slower than that of Rank9 or Rank16, which don't do any looping.

    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected long[] bits  
      protected it.unimi.dsi.bits.BitVector bitVector  
      protected long[] count  
      protected long lastOne  
      protected long numOnes  
      protected int numWords  
    • Constructor Summary

      Constructors 
      Constructor Description
      Rank11​(long[] bits, long length)  
      Rank11​(it.unimi.dsi.bits.BitVector bitVector)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      it.unimi.dsi.bits.BitVector bitVector()
      Returns the bit vector indexed by this structure.
      long count()
      Returns the number of ones in the bit vector indexed by this class.
      long lastOne()  
      long numBits()
      Returns the overall number of bits allocated by this structure.
      long rank​(long pos)
      Returns the number of ones preceding the specified position.
      long rank​(long from, long to)
      Returns the number of ones in the specified interval.
      • Methods inherited from class java.lang.Object

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

      • bits

        protected transient long[] bits
      • bitVector

        protected final it.unimi.dsi.bits.BitVector bitVector
      • count

        protected final long[] count
      • numWords

        protected final int numWords
      • numOnes

        protected final long numOnes
      • lastOne

        protected final long lastOne
    • Constructor Detail

      • Rank11

        public Rank11​(long[] bits,
                      long length)
      • Rank11

        public Rank11​(it.unimi.dsi.bits.BitVector bitVector)
    • Method Detail

      • rank

        public long rank​(long pos)
        Description copied from interface: Rank
        Returns the number of ones preceding the specified position.
        Specified by:
        rank in interface Rank
        Parameters:
        pos - a position in the bit vector between 0 (inclusive) and the length of the bit vector (inclusive).
        Returns:
        the number of ones preceding position pos; if pos is out of bounds, behavior is undefined.
      • numBits

        public long numBits()
        Description copied from interface: Rank
        Returns the overall number of bits allocated by this structure.
        Specified by:
        numBits in interface Rank
        Returns:
        the overall number of bits allocated by this structure (not including the bits of the indexed vector).
      • count

        public long count()
        Description copied from interface: Rank
        Returns the number of ones in the bit vector indexed by this class.
        Specified by:
        count in interface Rank
        Overrides:
        count in class AbstractRank
        Returns:
        number of ones in the bit vector indexed by this class.
      • rank

        public long rank​(long from,
                         long to)
        Description copied from interface: Rank
        Returns the number of ones in the specified interval.
        Specified by:
        rank in interface Rank
        Overrides:
        rank in class AbstractRank
        Parameters:
        from - a position in the bit vector between 0 (inclusive) and the length of the bit vector (inclusive).
        to - a position in the bit vector between 0 (inclusive) and the length of the bit vector (inclusive); must be greater than or equal to from.
        Returns:
        the number of ones between from (inclusive) and to (exclusive); if the parameters are out of bounds, behavior is undefined.
      • lastOne

        public long lastOne()
      • bitVector

        public it.unimi.dsi.bits.BitVector bitVector()
        Description copied from interface: Rank
        Returns the bit vector indexed by this structure.

        Note that you must not modify the returned vector.

        Specified by:
        bitVector in interface Rank
        Returns:
        the bit vector indexed by this structure.