Interface IBitmap

All Superinterfaces:
Cloneable, IClone<IBitmap>, Serializable
All Known Subinterfaces:
IClearableBitmap
All Known Implementing Classes:
Bitmap, ChunkedBitmap, QFSBitmap

public interface IBitmap extends Serializable, IClone<IBitmap>
A bitmap is a possibly large sequence of bits on which logical operations like AND, OR, XOR can be efficiently applied.
Author:
ActiveViam
  • Method Summary

    Modifier and Type
    Method
    Description
    and(IBitmap other)
    Performs a logical AND operation between two bitmaps.
    void
    and(IBitmap operand, IBitmap result)
    Performs a logical AND operation between two bitmaps.
    andNot(IBitmap other)
    Performs a logical AND NOT operation between two bitmaps.
    void
    andNot(IBitmap operand, IBitmap result)
    Performs a logical AND NOT operation between two bitmaps.
    int
    Reports the number of bits set in the bitmap.
    void
    Clears the bitmap.
    long
    Estimates the size of the internal data only (without the structure costs).
    void
    Executes a procedure for each of the bits that are set in the bitmap.
    boolean
    get(int i)
    Returns whether the bit at the given index is set or not.
    Returns an iterator.
    int
    Gets the position of the last bit set in the bitmap.
    boolean
    Returns whether this bitmap is empty or not.
    void
    not(int sizeInBits)
    Reverses the bits in the bitmap, equivalent of the NOT logical operation.
    or(IBitmap other)
    Performs a logical OR operation between two bitmaps.
    void
    or(IBitmap operand, IBitmap result)
    Performs a logical OR operation between two bitmaps.
    void
    set(int i)
    Sets the bit at position i to true.
    long
    Gets the total size of the index.
    default IntStream
    Returns a sequential IntStream with this bitmap as its source.
    static String
    toString(IBitmap bitmap)
    Returns a human-readable representation of the given bitmap.
    xor(IBitmap other)
    Performs a logical XOR operation between two bitmaps.
    void
    xor(IBitmap operand, IBitmap result)
    Performs a logical XOR operation between two bitmaps.

    Methods inherited from interface com.quartetfs.fwk.IClone

    clone
  • Method Details

    • set

      void set(int i)
      Sets the bit at position i to true.

      The bits must be set in increasing order.

      Parameters:
      i - the index of the bit to set
    • get

      boolean get(int i)
      Returns whether the bit at the given index is set or not.
      Parameters:
      i - the index of the bit
      Returns:
      true if the bit is set, false otherwise
    • getLast

      int getLast()
      Gets the position of the last bit set in the bitmap.
      Returns:
      the position of the last bit set, or -1 if no bit is set
    • clear

      void clear()
      Clears the bitmap.

      After this call the bitmap will be empty.

    • cardinality

      int cardinality()
      Reports the number of bits set in the bitmap.
      Returns:
      this bitmap cardinality
    • and

      void and(IBitmap operand, IBitmap result)
      Performs a logical AND operation between two bitmaps. It is responsibility of the user to clear the result before using this logic operation.
      Parameters:
      operand - the other bitmap operand
      result - the bitmap where the result is appended
    • and

      IBitmap and(IBitmap other)
      Performs a logical AND operation between two bitmaps.
      Parameters:
      other - other bitmap operand of the AND operator
      Returns:
      AND result bitmap
    • or

      void or(IBitmap operand, IBitmap result)
      Performs a logical OR operation between two bitmaps. It is responsibility of the user to clear the result before using this logic operation.
      Parameters:
      operand - the other bitmap operand
      result - the bitmap where the result is appended
    • or

      IBitmap or(IBitmap other)
      Performs a logical OR operation between two bitmaps.
      Parameters:
      other - other bitmap operand of the OR operator
      Returns:
      OR result bitmap
    • xor

      void xor(IBitmap operand, IBitmap result)
      Performs a logical XOR operation between two bitmaps. It is responsibility of the user to clear the result before using this logic operation.
      Parameters:
      operand - the other bitmap operand
      result - the bitmap where the result is appended
    • xor

      IBitmap xor(IBitmap other)
      Performs a logical XOR operation between two bitmaps.
      Parameters:
      other - other bitmap operand of the XOR operator
      Returns:
      OR result bitmap
    • andNot

      void andNot(IBitmap operand, IBitmap result)
      Performs a logical AND NOT operation between two bitmaps. It is responsibility of the user to clear the result before using this logic operation.
      Parameters:
      operand - the other bitmap operand
      result - the bitmap where the result is appended
    • andNot

      IBitmap andNot(IBitmap other)
      Performs a logical AND NOT operation between two bitmaps.
      Parameters:
      other - other bitmap operand of the AND NOT operator
      Returns:
      OR result bitmap
    • not

      void not(int sizeInBits)
      Reverses the bits in the bitmap, equivalent of the NOT logical operation.
      Parameters:
      sizeInBits - the size of the result, if the bitmap has a smaller size, ones will be appended, if the bitmap has a larger size, its size will be reduced
    • forEachBit

      void forEachBit(IMatchProcedure procedure)
      Executes a procedure for each of the bits that are set in the bitmap.
      Parameters:
      procedure - procedure to apply to each value in this bitmap
    • sizeInBytes

      long sizeInBytes()
      Gets the total size of the index.

      This includes data as well as abject internal attributes, class pointers, ...

      Returns:
      estimated size of the bitmap, measured in bytes
    • dataSizeInBytes

      long dataSizeInBytes()
      Estimates the size of the internal data only (without the structure costs).
      Returns:
      size in bytes
    • isEmpty

      boolean isEmpty()
      Returns whether this bitmap is empty or not.

      A bitmap is empty iff its cardinality is equal to 0.

      Returns:
      true if this bitmap is empty, false otherwise
    • getIterator

      IBitmapIterator getIterator()
      Returns an iterator.
      Returns:
      an iterator
    • toString

      static String toString(IBitmap bitmap)
      Returns a human-readable representation of the given bitmap.
      Parameters:
      bitmap - the bitmap to print
      Returns:
      a human-readable representation of the bitmap
    • stream

      default IntStream stream()
      Returns a sequential IntStream with this bitmap as its source.
      Returns:
      a sequential IntStream with this bitmap as its source.