\r
package com.google.zxing.datamatrix.decoder;\r
\r
-import com.google.zxing.ReaderException;\r
+import com.google.zxing.FormatException;\r
\r
/**\r
* The Version object encapsulates attributes about a particular\r
\r
// Calculate the total number of codewords\r
int total = 0;\r
- int ecCodewords = ecBlocks.ecCodewords;\r
- ECB[] ecbArray = ecBlocks.ecBlocks;\r
+ int ecCodewords = ecBlocks.getECCodewords();\r
+ ECB[] ecbArray = ecBlocks.getECBlocks();\r
for (int i = 0; i < ecbArray.length; i++) {\r
ECB ecBlock = ecbArray[i];\r
- total += ecBlock.count * (ecBlock.dataCodewords + ecCodewords);\r
+ total += ecBlock.getCount() * (ecBlock.getDataCodewords() + ecCodewords);\r
}\r
this.totalCodewords = total;\r
}\r
* @param numRows Number of rows in modules\r
* @param numColumns Number of columns in modules\r
* @return {@link Version} for a Data Matrix Code of those dimensions\r
- * @throws ReaderException if dimensions do correspond to a valid Data Matrix size\r
+ * @throws FormatException if dimensions do correspond to a valid Data Matrix size\r
*/\r
- public static Version getVersionForDimensions(int numRows, int numColumns) throws ReaderException {\r
+ public static Version getVersionForDimensions(int numRows, int numColumns) throws FormatException {\r
if ((numRows & 0x01) != 0 || (numColumns & 0x01) != 0) {\r
- throw new ReaderException("Dimension must be 0 mod 2");\r
+ throw FormatException.getFormatInstance();\r
}\r
\r
// TODO(bbrown): This is doing a linear search through the array of versions.\r
}\r
}\r
\r
- throw new ReaderException("Dimensions do not correspond to a valid Data Matrix Version.");\r
+ throw FormatException.getFormatInstance();\r
}\r
\r
/**\r
new ECBlocks(14, new ECB(1, 16))),\r
new Version(28, 12, 36, 10, 16,\r
new ECBlocks(18, new ECB(1, 22))),\r
- new Version(29, 16, 36, 10, 16,\r
+ new Version(29, 16, 36, 14, 16,\r
new ECBlocks(24, new ECB(1, 32))),\r
new Version(30, 16, 48, 14, 22,\r
new ECBlocks(28, new ECB(1, 49)))\r