Class Bitmap

java.lang.Object
com.pnfsoftware.jeb.util.collect.Bitmap

@Ser public class Bitmap extends Object
A fast, efficient bitmap making optimal use of memory.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Bitmap(int bitsize)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Add the values of a source bitmap into this bitmap.
    void
    Clear the bitmap to all false.
     
    int
    Count the number of true values in the bitmap.
    int
    Count the number of false values in the bitmap.
    boolean
     
     
    formatAsRanges(boolean useExcludedEnds)
     
    boolean
    get(int i)
    Retrieve the value of a bit.
    int
     
    boolean
    Determine whether all entries in the bitmap are set to false.
    boolean
    Determine whether all entries in the bitmap are set to true.
    Generate a list of zero-based indices for the bitmap entry is true.
    void
    Remove the values of a source bitmap into this bitmap.
    void
    reset(int i)
    Fast reset a bit to false.
    void
    set(int i)
    Fast set a bit to true.
    boolean
    set(int i, boolean v)
    Set a bit to the provided value.
    void
    setRange(int from, int to)
    Fast set multiple bits to true.
    int
    Retrieve the map size.
     

    Methods inherited from class java.lang.Object

    finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Bitmap

      public Bitmap(int bitsize)
  • Method Details

    • clone

      public Bitmap clone()
      Overrides:
      clone in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • size

      public int size()
      Retrieve the map size.
      Returns:
    • countOnes

      public int countOnes()
      Count the number of true values in the bitmap.
      Returns:
    • countZeros

      public int countZeros()
      Count the number of false values in the bitmap.
      Returns:
    • clear

      public void clear()
      Clear the bitmap to all false.
    • set

      public boolean set(int i, boolean v)
      Set a bit to the provided value.
      Parameters:
      i - zero-based index
      v - value
      Returns:
      true if the value was updated; false if it was unchanged
    • set

      public void set(int i)
      Fast set a bit to true.
      Parameters:
      i - zero-based index
    • setRange

      public void setRange(int from, int to)
      Fast set multiple bits to true.
      Parameters:
      from - start zero-based index (inclusive)
      to - end zero-based index (exclusive)
    • reset

      public void reset(int i)
      Fast reset a bit to false.
      Parameters:
      i - zero-based index
    • get

      public boolean get(int i)
      Retrieve the value of a bit.
      Parameters:
      i - zero-based index
      Returns:
      the current bit value
    • addAllFrom

      public void addAllFrom(Bitmap other)
      Add the values of a source bitmap into this bitmap. Both bitmaps must have the same size.
      Parameters:
      other - source bitmap
    • removeAllFrom

      public void removeAllFrom(Bitmap other)
      Remove the values of a source bitmap into this bitmap. Both bitmaps must have the same size.
      Parameters:
      other - source bitmap
    • isFull

      public boolean isFull()
      Determine whether all entries in the bitmap are set to true.
      Returns:
    • isEmpty

      public boolean isEmpty()
      Determine whether all entries in the bitmap are set to false.
      Returns:
    • ones

      public List<Integer> ones()
      Generate a list of zero-based indices for the bitmap entry is true.
      Returns:
      a list of integers
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • formatAsRanges

      public String formatAsRanges()
    • formatAsRanges

      public String formatAsRanges(boolean useExcludedEnds)