Documentation of 'ext.plantuml.com.google.zxing.common.BitArray' Java class
BitArray
ext.plantuml.com.google.zxing.common

Class BitArray



  • public final class BitArray
    extends java.lang.Object

    A simple, fast array of bits, represented compactly by an array of ints internally.

    • Field Summary

      Fields 
      Modifier and Type Field and Description
      int[] bits 
      int size 
    • Constructor Summary

      Constructors 
      Constructor and Description
      BitArray() 
      BitArray(int size) 
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void appendBit(boolean bit) 
      void appendBitArray(BitArray other) 
      void appendBits(int value, int numBits)
      Appends the least-significant bits, from value, in order from most-significant to least-significant.
      void clear()
      Clears all bits (sets to false).
      void flip(int i)
      Flips bit i.
      boolean get(int i) 
      int[] getBitArray() 
      int getSize() 
      int getSizeInBytes() 
      boolean isRange(int start, int end, boolean value)
      Efficient method to check if a range of bits is set, or not set.
      void reverse()
      Reverses all bits in the array.
      void set(int i)
      Sets bit i.
      void setBulk(int i, int newBits)
      Sets a block of 32 bits, starting at bit i.
      void toBytes(int bitOffset, byte[] array, int offset, int numBytes) 
      java.lang.String toString() 
      void xor(BitArray other) 
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • bits

        public int[] bits
      • size

        public int size
    • Constructor Detail

      • BitArray

        public BitArray()
      • BitArray

        public BitArray(int size)
    • Method Detail

      • getSize

        public int getSize()
      • getSizeInBytes

        public int getSizeInBytes()
      • get

        public boolean get(int i)
        Parameters:
        i - bit to get
        Returns:
        true iff bit i is set
      • set

        public void set(int i)
        Sets bit i.
        Parameters:
        i - bit to set
      • flip

        public void flip(int i)
        Flips bit i.
        Parameters:
        i - bit to set
      • setBulk

        public void setBulk(int i,
                            int newBits)
        Sets a block of 32 bits, starting at bit i.
        Parameters:
        i - first bit to set
        newBits - the new value of the next 32 bits. Note again that the least-significant bit corresponds to bit i, the next-least-significant to i+1, and so on.
      • clear

        public void clear()
        Clears all bits (sets to false).
      • isRange

        public boolean isRange(int start,
                               int end,
                               boolean value)
        Efficient method to check if a range of bits is set, or not set.
        Parameters:
        start - start of range, inclusive.
        end - end of range, exclusive
        value - if true, checks that bits in range are set, otherwise checks that they are not set
        Returns:
        true iff all bits are set or not set in range, according to value argument
        Throws:
        java.lang.IllegalArgumentException - if end is less than or equal to start
      • appendBit

        public void appendBit(boolean bit)
      • appendBits

        public void appendBits(int value,
                               int numBits)
        Appends the least-significant bits, from value, in order from most-significant to least-significant. For example, appending 6 bits from 0x000001E will append the bits 0, 1, 1, 1, 1, 0 in that order.
      • appendBitArray

        public void appendBitArray(BitArray other)
      • xor

        public void xor(BitArray other)
      • toBytes

        public void toBytes(int bitOffset,
                            byte[] array,
                            int offset,
                            int numBytes)
        Parameters:
        bitOffset - first bit to start writing
        array - array to write into. Bytes are written most-significant byte first. This is the opposite of the internal representation, which is exposed by getBitArray()
        offset - position in array to start writing
        numBytes - how many bytes to write
      • getBitArray

        public int[] getBitArray()
        Returns:
        underlying array of ints. The first element holds the first 32 bits, and the least significant bit is bit 0.
      • reverse

        public void reverse()
        Reverses all bits in the array.
      • toString

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

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.