Class BitMap


  • public class BitMap
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      BitMap​(int size)
      Initialize a BitMap with given size.
      BitMap​(int size, byte[] bits)
      Initialize a BitMap with given size and bytes.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      BitMap clone()  
      static void copyOfRange​(BitMap src, int srcPos, BitMap dest, int destPos, int length)
      Copies a bitmap from the specified source bitmap, beginning at the specified position, to the specified position of the destination bitmap.
      boolean equals​(java.lang.Object obj)  
      byte[] getByteArray()  
      BitMap getRegion​(int positionOffset, int length)  
      int getSize()  
      int hashCode()  
      boolean isAllMarked()
      whether all bits are one, i.e., all are Null
      boolean isAllUnmarked()
      whether all bits are zero, i.e., no Null value
      boolean isMarked​(int position)
      returns the value of the bit with the specified index.
      void mark​(int position)
      mark as 1 at the given bit position.
      void markAll()
      mark as 1 at all positions.
      void reset()
      mark as 0 at all positions.
      java.lang.String toString()  
      void unmark​(int position)  
      • Methods inherited from class java.lang.Object

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

      • BitMap

        public BitMap​(int size)
        Initialize a BitMap with given size.
      • BitMap

        public BitMap​(int size,
                      byte[] bits)
        Initialize a BitMap with given size and bytes.
    • Method Detail

      • getByteArray

        public byte[] getByteArray()
      • getSize

        public int getSize()
      • isMarked

        public boolean isMarked​(int position)
        returns the value of the bit with the specified index.
      • markAll

        public void markAll()
        mark as 1 at all positions.
      • mark

        public void mark​(int position)
        mark as 1 at the given bit position.
      • reset

        public void reset()
        mark as 0 at all positions.
      • unmark

        public void unmark​(int position)
      • isAllUnmarked

        public boolean isAllUnmarked()
        whether all bits are zero, i.e., no Null value
      • isAllMarked

        public boolean isAllMarked()
        whether all bits are one, i.e., all are Null
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • hashCode

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

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • clone

        public BitMap clone()
        Overrides:
        clone in class java.lang.Object
      • copyOfRange

        public static void copyOfRange​(BitMap src,
                                       int srcPos,
                                       BitMap dest,
                                       int destPos,
                                       int length)
        Copies a bitmap from the specified source bitmap, beginning at the specified position, to the specified position of the destination bitmap. A subsequence of bits are copied from the source bitmap referenced by src to the destination bitmap referenced by dest. The number of bits copied is equal to the length argument. The bits at positions srcPos through srcPos+length-1 in the source bitmap are copied into positions destPos through destPos+length-1, respectively, of the destination bitmap.
        Parameters:
        src - the source bitmap.
        srcPos - starting position in the source bitmap.
        dest - the destination bitmap.
        destPos - starting position in the destination bitmap.
        length - the number of bits to be copied.
        Throws:
        java.lang.IndexOutOfBoundsException - if copying would cause access of data outside bitmap bounds.
      • getRegion

        public BitMap getRegion​(int positionOffset,
                                int length)