Move BitSource to common package so that it can be reused by Data Matrix decoder
[zxing.git] / core / src / com / google / zxing / qrcode / decoder / Version.java
index 97ed382..d30fdeb 100755 (executable)
@@ -57,12 +57,11 @@ public final class Version {
     this.alignmentPatternCenters = alignmentPatternCenters;\r
     this.ecBlocks = new ECBlocks[]{ecBlocks1, ecBlocks2, ecBlocks3, ecBlocks4};\r
     int total = 0;\r
-    ECBlocks levelLECBlocks = ecBlocks1; // L,M,Q,H -- all the same total\r
-    int ecCodewords = levelLECBlocks.ecCodewords;\r
-    ECB[] ecbArray = levelLECBlocks.ecBlocks;\r
+    int ecCodewords = ecBlocks1.getECCodewords();\r
+    ECB[] ecbArray = ecBlocks1.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
@@ -182,8 +181,8 @@ public final class Version {
    * will be the same across all blocks within one version.</p>\r
    */\r
   static final class ECBlocks {\r
-    private int ecCodewords;\r
-    private ECB[] ecBlocks;\r
+    private final int ecCodewords;\r
+    private final ECB[] ecBlocks;\r
 \r
     private ECBlocks(int ecCodewords, ECB ecBlocks) {\r
       this.ecCodewords = ecCodewords;\r
@@ -210,8 +209,8 @@ public final class Version {
    * parameters is used consecutively in the QR code version's format.</p>\r
    */\r
   static final class ECB {\r
-    private int count;\r
-    private int dataCodewords;\r
+    private final int count;\r
+    private final int dataCodewords;\r
 \r
     private ECB(int count, int dataCodewords) {\r
       this.count = count;\r
@@ -422,7 +421,7 @@ public final class Version {
             new ECBlocks(30, new ECB(30, 16),\r
                 new ECB(2, 17))),\r
         new Version(25, new int[]{6, 32, 58, 84, 110},\r
-            new ECBlocks(26, new ECB(8, 1061),\r
+            new ECBlocks(26, new ECB(8, 106),\r
                 new ECB(4, 107)),\r
             new ECBlocks(28, new ECB(8, 47),\r
                 new ECB(13, 48)),\r