Class BitMap


  • public class BitMap
    extends Object
    • 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
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class 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:
        IndexOutOfBoundsException - if copying would cause access of data outside bitmap bounds.
      • getRegion

        public BitMap getRegion​(int positionOffset,
                                int length)