Improved the statistics reporting for the CommandLineRunner.
authordswitkin <dswitkin@59b500cc-1b3d-0410-9834-0bbf25fbcc57>
Tue, 1 Apr 2008 18:30:38 +0000 (18:30 +0000)
committerdswitkin <dswitkin@59b500cc-1b3d-0410-9834-0bbf25fbcc57>
Tue, 1 Apr 2008 18:30:38 +0000 (18:30 +0000)
git-svn-id: http://zxing.googlecode.com/svn/trunk@333 59b500cc-1b3d-0410-9834-0bbf25fbcc57

javase/src/com/google/zxing/client/j2se/CommandLineRunner.java

index aee9f82..20d674b 100644 (file)
@@ -44,12 +44,15 @@ public final class CommandLineRunner {
     if (inputFile.exists()) {
       if (inputFile.isDirectory()) {
         int successful = 0;
+        int total = 0;
         for (File input : inputFile.listFiles()) {
           if (decode(input.toURI())) {
             successful++;
           }
+          total++;
         }
-        System.out.println("Decoded " + successful + " files successfully");
+        System.out.println("\nDecoded " + successful + " files out of " + total +
+            " successfully (" + (successful * 100 / total) + "%)");
       } else {
         decode(inputFile.toURI());
       }
@@ -77,16 +80,4 @@ public final class CommandLineRunner {
     }
   }
 
-  /*
-  public BufferedImage toBufferedImage() {
-    BufferedImage image = new BufferedImage(dimension, dimension, BufferedImage.TYPE_BYTE_BINARY);
-    for (int j = 0; j < dimension; j++) {
-      for (int i = 0; i < dimension; i++) {
-        image.setRGB(j, i, get(i, j) ? 0x00000000 : 0x00FFFFFF);
-      }
-    }
-    return image;
-  }
-   */
-
 }