- Added support for rotation in our blackbox test framework, and refactored the ways...
[zxing.git] / core / src / com / google / zxing / oned / AbstractOneDReader.java
index f06559d..fa1cbaf 100644 (file)
@@ -104,14 +104,11 @@ public abstract class AbstractOneDReader implements OneDReader {
       }
       image.getBlackRow(rowNumber, row, 0, width);
 
-      // We may try twice for each row, if "trying harder":
+      // While we have the image data in a BitArray, it's fairly cheap to reverse it in place to
+      // handle decoding upside down barcodes.
       for (int attempt = 0; attempt < 2; attempt++) {
         if (attempt == 1) { // trying again?
-          if (tryHarder) { // only if "trying harder"
-            row.reverse(); // reverse the row and continue
-          } else {
-            break;
-          }
+          row.reverse(); // reverse the row and continue
         }
         try {
           // Look for a barcode
@@ -143,7 +140,7 @@ public abstract class AbstractOneDReader implements OneDReader {
    * @param counters array into which to record counts
    * @throws ReaderException if counters cannot be filled entirely from row before running out of pixels
    */
-  public static void recordPattern(BitArray row, int start, int[] counters) throws ReaderException {
+  static void recordPattern(BitArray row, int start, int[] counters) throws ReaderException {
     int numCounters = counters.length;
     for (int i = 0; i < numCounters; i++) {
       counters[i] = 0;
@@ -186,7 +183,7 @@ public abstract class AbstractOneDReader implements OneDReader {
    * @param pattern expected pattern
    * @return average variance between counters and pattern
    */
-  public static float patternMatchVariance(int[] counters, int[] pattern) {
+  static float patternMatchVariance(int[] counters, int[] pattern) {
     int total = 0;
     int numCounters = counters.length;
     int patternLength = 0;
@@ -206,4 +203,11 @@ public abstract class AbstractOneDReader implements OneDReader {
     return totalVariance / (float) patternLength;
   }
 
+  // This declaration should not be necessary, since this class is
+  // abstract and so does not have to provide an implementation for every
+  // method of an interface it implements, but it is causing NoSuchMethodError
+  // issues on some Nokia JVMs. So we add this superfluous declaration:
+
+  public abstract Result decodeRow(int rowNumber, BitArray row, Hashtable hints) throws ReaderException;
+
 }