Small style stuff master
authorsrowen <srowen@59b500cc-1b3d-0410-9834-0bbf25fbcc57>
Tue, 12 Oct 2010 11:38:43 +0000 (11:38 +0000)
committersrowen <srowen@59b500cc-1b3d-0410-9834-0bbf25fbcc57>
Tue, 12 Oct 2010 11:38:43 +0000 (11:38 +0000)
git-svn-id: http://zxing.googlecode.com/svn/trunk@1622 59b500cc-1b3d-0410-9834-0bbf25fbcc57

core/src/com/google/zxing/datamatrix/decoder/BitMatrixParser.java
core/src/com/google/zxing/datamatrix/decoder/Decoder.java
core/src/com/google/zxing/qrcode/decoder/Decoder.java
core/src/com/google/zxing/qrcode/detector/FinderPatternFinder.java

index c8210b4..45ffd2d 100644 (file)
@@ -43,6 +43,10 @@ final class BitMatrixParser {
     this.readMappingMatrix = new BitMatrix(this.mappingBitMatrix.getWidth(), this.mappingBitMatrix.getHeight());\r
   }\r
 \r
     this.readMappingMatrix = new BitMatrix(this.mappingBitMatrix.getWidth(), this.mappingBitMatrix.getHeight());\r
   }\r
 \r
+  Version getVersion() {\r
+    return version;\r
+  }\r
+\r
   /**\r
    * <p>Creates the version object based on the dimension of the original bit matrix from \r
    * the datamatrix code.</p>\r
   /**\r
    * <p>Creates the version object based on the dimension of the original bit matrix from \r
    * the datamatrix code.</p>\r
@@ -54,15 +58,9 @@ final class BitMatrixParser {
    * @throws FormatException if the dimensions of the mapping matrix are not valid\r
    * Data Matrix dimensions.\r
    */\r
    * @throws FormatException if the dimensions of the mapping matrix are not valid\r
    * Data Matrix dimensions.\r
    */\r
-  Version readVersion(BitMatrix bitMatrix) throws FormatException {\r
-\r
-    if (version != null) {\r
-      return version;\r
-    }\r
-\r
+  private static Version readVersion(BitMatrix bitMatrix) throws FormatException {\r
     int numRows = bitMatrix.getHeight();\r
     int numColumns = bitMatrix.getWidth();\r
     int numRows = bitMatrix.getHeight();\r
     int numColumns = bitMatrix.getWidth();\r
-    \r
     return Version.getVersionForDimensions(numRows, numColumns);\r
   }\r
 \r
     return Version.getVersionForDimensions(numRows, numColumns);\r
   }\r
 \r
index 58f8c98..47ecac9 100644 (file)
@@ -73,7 +73,7 @@ public final class Decoder {
 \r
     // Construct a parser and read version, error-correction level\r
     BitMatrixParser parser = new BitMatrixParser(bits);\r
 \r
     // Construct a parser and read version, error-correction level\r
     BitMatrixParser parser = new BitMatrixParser(bits);\r
-    Version version = parser.readVersion(bits);\r
+    Version version = parser.getVersion();\r
 \r
     // Read codewords\r
     byte[] codewords = parser.readCodewords();\r
 \r
     // Read codewords\r
     byte[] codewords = parser.readCodewords();\r
index 22cdeb0..520e076 100644 (file)
@@ -52,12 +52,10 @@ public final class Decoder {
    *\r
    * @param image booleans representing white/black QR Code modules\r
    * @return text and bytes encoded within the QR Code\r
    *\r
    * @param image booleans representing white/black QR Code modules\r
    * @return text and bytes encoded within the QR Code\r
-   * @throws NotFoundException if the QR Code cannot be found\r
    * @throws FormatException if the QR Code cannot be decoded\r
    * @throws ChecksumException if error correction fails\r
    */\r
    * @throws FormatException if the QR Code cannot be decoded\r
    * @throws ChecksumException if error correction fails\r
    */\r
-  public DecoderResult decode(boolean[][] image, Hashtable hints)\r
-      throws ChecksumException, FormatException, NotFoundException {\r
+  public DecoderResult decode(boolean[][] image, Hashtable hints) throws ChecksumException, FormatException {\r
     int dimension = image.length;\r
     BitMatrix bits = new BitMatrix(dimension);\r
     for (int i = 0; i < dimension; i++) {\r
     int dimension = image.length;\r
     BitMatrix bits = new BitMatrix(dimension);\r
     for (int i = 0; i < dimension; i++) {\r
@@ -70,7 +68,7 @@ public final class Decoder {
     return decode(bits, hints);\r
   }\r
 \r
     return decode(bits, hints);\r
   }\r
 \r
-  public DecoderResult decode(BitMatrix bits) throws ChecksumException, FormatException, NotFoundException {\r
+  public DecoderResult decode(BitMatrix bits) throws ChecksumException, FormatException {\r
     return decode(bits, null);\r
   }\r
 \r
     return decode(bits, null);\r
   }\r
 \r
index ebed5d0..9968f00 100755 (executable)
@@ -553,7 +553,7 @@ public class FinderPatternFinder {
    */\r
   private static class FurthestFromAverageComparator implements Comparator {\r
     private final float average;\r
    */\r
   private static class FurthestFromAverageComparator implements Comparator {\r
     private final float average;\r
-    public FurthestFromAverageComparator(float f) {\r
+    private FurthestFromAverageComparator(float f) {\r
       average = f;\r
     }\r
     public int compare(Object center1, Object center2) {\r
       average = f;\r
     }\r
     public int compare(Object center1, Object center2) {\r
@@ -568,16 +568,16 @@ public class FinderPatternFinder {
    */\r
   private static class CenterComparator implements Comparator {\r
     private final float average;\r
    */\r
   private static class CenterComparator implements Comparator {\r
     private final float average;\r
-    public CenterComparator(float f) {\r
+    private CenterComparator(float f) {\r
       average = f;\r
     }\r
     public int compare(Object center1, Object center2) {\r
       average = f;\r
     }\r
     public int compare(Object center1, Object center2) {\r
-      if (((FinderPattern) center2).getCount() != ((FinderPattern) center1).getCount()) {\r
-        return ((FinderPattern) center2).getCount() - ((FinderPattern) center1).getCount();\r
-      } else {\r
+      if (((FinderPattern) center2).getCount() == ((FinderPattern) center1).getCount()) {\r
         float dA = Math.abs(((FinderPattern) center2).getEstimatedModuleSize() - average);\r
         float dB = Math.abs(((FinderPattern) center1).getEstimatedModuleSize() - average);\r
         return dA < dB ? 1 : (dA == dB ? 0 : -1);\r
         float dA = Math.abs(((FinderPattern) center2).getEstimatedModuleSize() - average);\r
         float dB = Math.abs(((FinderPattern) center1).getEstimatedModuleSize() - average);\r
         return dA < dB ? 1 : (dA == dB ? 0 : -1);\r
+      } else {\r
+        return ((FinderPattern) center2).getCount() - ((FinderPattern) center1).getCount();\r
       }\r
     }\r
   }\r
       }\r
     }\r
   }\r