Class Version


  • final class Version
    extends java.lang.Object
    See ISO 18004:2006 Annex D.
    • Field Detail

      • VERSION_DECODE_INFO

        private static final int[] VERSION_DECODE_INFO
        See ISO 18004:2006 Annex D. Element i represents the raw version bits that specify version i + 7
      • VERSIONS

        private static final Version[] VERSIONS
      • versionNumber

        private final int versionNumber
      • alignmentPatternCenters

        private final int[] alignmentPatternCenters
      • totalCodewords

        private final int totalCodewords
    • Method Detail

      • getVersionNumber

        public int getVersionNumber()
        Returns:
        the version number
      • getAlignmentPatternCenters

        public int[] getAlignmentPatternCenters()
        Returns:
        int[] containing the positions of the alignment pattern centers
      • getTotalCodewords

        public int getTotalCodewords()
        Returns:
        total number of code words
      • getDimensionForVersion

        public int getDimensionForVersion()
        Returns:
        the square dimension for the current version number
      • getECBlocksForLevel

        public Version.ECBlocks getECBlocksForLevel​(ErrorCorrectionLevel ecLevel)
        Parameters:
        ecLevel - error correction level
        Returns:
        the number of EC blocks for the given error correction level
      • getProvisionalVersionForDimension

        public static Version getProvisionalVersionForDimension​(int dimension)
        Deduces version information purely from QR Code dimensions.
        Parameters:
        dimension - dimension in modules
        Returns:
        Version for a QR Code of that dimension
      • getVersionForNumber

        public static Version getVersionForNumber​(int versionNumber)
        Parameters:
        versionNumber - Version number
        Returns:
        the version for the given version number
      • decodeVersionInformation

        static Version decodeVersionInformation​(int versionBits)
        Decode the version information.
        Parameters:
        versionBits - bits stored as int containing
        Returns:
        Version decoded from the versionBits
      • buildFunctionPattern

        BitMatrix buildFunctionPattern()
        Build the function pattern, See ISO 18004:2006 Annex E.
        Returns:
        Bitmatrix containing the pattern
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
        Returns:
        The version number as a string
      • buildVersions

        private static Version[] buildVersions()
        See ISO 18004:2006 6.5.1 Table 9.