From 8ff9e7f4faa3c6811c24ae0fe7dc29f9af165a24 Mon Sep 17 00:00:00 2001 From: "dswitkin@google.com" Date: Tue, 17 May 2011 15:46:09 +0000 Subject: [PATCH] Standardized the naming of our barcode formats and alphabetized them. git-svn-id: https://zxing.googlecode.com/svn/trunk@1775 59b500cc-1b3d-0410-9834-0bbf25fbcc57 --- .../client/android/DecodeFormatManager.java | 2 +- core/src/com/google/zxing/BarcodeFormat.java | 60 +++++++++---------- .../com/google/zxing/MultiFormatReader.java | 4 +- .../zxing/oned/MultiFormatOneDReader.java | 8 +-- .../google/zxing/oned/rss/RSS14Reader.java | 4 +- .../com/google/zxing/pdf417/PDF417Reader.java | 2 +- .../oned/rss/RSS14BlackBox1TestCase.java | 2 +- .../oned/rss/RSS14BlackBox2TestCase.java | 2 +- .../zxing/pdf417/PDF417BlackBox1TestCase.java | 6 +- .../zxing/pdf417/PDF417BlackBox2TestCase.java | 4 +- .../zxing/client/j2se/CommandLineRunner.java | 4 +- .../com/google/zxing/web/DecodeServlet.java | 4 +- 12 files changed, 51 insertions(+), 51 deletions(-) diff --git a/android/src/com/google/zxing/client/android/DecodeFormatManager.java b/android/src/com/google/zxing/client/android/DecodeFormatManager.java index 27b208fb5..799d15b18 100644 --- a/android/src/com/google/zxing/client/android/DecodeFormatManager.java +++ b/android/src/com/google/zxing/client/android/DecodeFormatManager.java @@ -39,7 +39,7 @@ final class DecodeFormatManager { PRODUCT_FORMATS.add(BarcodeFormat.UPC_E); PRODUCT_FORMATS.add(BarcodeFormat.EAN_13); PRODUCT_FORMATS.add(BarcodeFormat.EAN_8); - PRODUCT_FORMATS.add(BarcodeFormat.RSS14); + PRODUCT_FORMATS.add(BarcodeFormat.RSS_14); ONE_D_FORMATS = new Vector(PRODUCT_FORMATS.size() + 4); ONE_D_FORMATS.addAll(PRODUCT_FORMATS); ONE_D_FORMATS.add(BarcodeFormat.CODE_39); diff --git a/core/src/com/google/zxing/BarcodeFormat.java b/core/src/com/google/zxing/BarcodeFormat.java index 3dc60f7a3..1e5d47958 100644 --- a/core/src/com/google/zxing/BarcodeFormat.java +++ b/core/src/com/google/zxing/BarcodeFormat.java @@ -19,7 +19,7 @@ package com.google.zxing; import java.util.Hashtable; /** - * Enumerates barcode formats known to this package. + * Enumerates barcode formats known to this package. Please keep alphabetized. * * @author Sean Owen */ @@ -29,32 +29,11 @@ public final class BarcodeFormat { private static final Hashtable VALUES = new Hashtable(); - /** QR Code 2D barcode format. */ - public static final BarcodeFormat QR_CODE = new BarcodeFormat("QR_CODE"); - - /** Data Matrix 2D barcode format. */ - public static final BarcodeFormat DATA_MATRIX = new BarcodeFormat("DATA_MATRIX"); - /** Aztec 2D barcode format. */ public static final BarcodeFormat AZTEC = new BarcodeFormat("AZTEC"); - - /** UPC-E 1D format. */ - public static final BarcodeFormat UPC_E = new BarcodeFormat("UPC_E"); - /** UPC-A 1D format. */ - public static final BarcodeFormat UPC_A = new BarcodeFormat("UPC_A"); - - /** EAN-8 1D format. */ - public static final BarcodeFormat EAN_8 = new BarcodeFormat("EAN_8"); - - /** EAN-13 1D format. */ - public static final BarcodeFormat EAN_13 = new BarcodeFormat("EAN_13"); - - /** UPC/EAN extension format. Not a stand-alone format. */ - public static final BarcodeFormat UPC_EAN_EXTENSION = new BarcodeFormat("UPC_EAN_EXTENSION"); - - /** Code 128 1D format. */ - public static final BarcodeFormat CODE_128 = new BarcodeFormat("CODE_128"); + /** CODABAR 1D format. */ + public static final BarcodeFormat CODABAR = new BarcodeFormat("CODABAR"); /** Code 39 1D format. */ public static final BarcodeFormat CODE_39 = new BarcodeFormat("CODE_39"); @@ -62,21 +41,42 @@ public final class BarcodeFormat { /** Code 93 1D format. */ public static final BarcodeFormat CODE_93 = new BarcodeFormat("CODE_93"); - /** CODABAR 1D format. */ - public static final BarcodeFormat CODABAR = new BarcodeFormat("CODABAR"); + /** Code 128 1D format. */ + public static final BarcodeFormat CODE_128 = new BarcodeFormat("CODE_128"); + + /** Data Matrix 2D barcode format. */ + public static final BarcodeFormat DATA_MATRIX = new BarcodeFormat("DATA_MATRIX"); + + /** EAN-8 1D format. */ + public static final BarcodeFormat EAN_8 = new BarcodeFormat("EAN_8"); + + /** EAN-13 1D format. */ + public static final BarcodeFormat EAN_13 = new BarcodeFormat("EAN_13"); /** ITF (Interleaved Two of Five) 1D format. */ public static final BarcodeFormat ITF = new BarcodeFormat("ITF"); - /** RSS 14 */ - public static final BarcodeFormat RSS14 = new BarcodeFormat("RSS14"); - /** PDF417 format. */ - public static final BarcodeFormat PDF417 = new BarcodeFormat("PDF417"); + public static final BarcodeFormat PDF_417 = new BarcodeFormat("PDF_417"); + + /** QR Code 2D barcode format. */ + public static final BarcodeFormat QR_CODE = new BarcodeFormat("QR_CODE"); + + /** RSS 14 */ + public static final BarcodeFormat RSS_14 = new BarcodeFormat("RSS_14"); /** RSS EXPANDED */ public static final BarcodeFormat RSS_EXPANDED = new BarcodeFormat("RSS_EXPANDED"); + /** UPC-A 1D format. */ + public static final BarcodeFormat UPC_A = new BarcodeFormat("UPC_A"); + + /** UPC-E 1D format. */ + public static final BarcodeFormat UPC_E = new BarcodeFormat("UPC_E"); + + /** UPC/EAN extension format. Not a stand-alone format. */ + public static final BarcodeFormat UPC_EAN_EXTENSION = new BarcodeFormat("UPC_EAN_EXTENSION"); + private final String name; private BarcodeFormat(String name) { diff --git a/core/src/com/google/zxing/MultiFormatReader.java b/core/src/com/google/zxing/MultiFormatReader.java index e2bc48ecd..820d78021 100644 --- a/core/src/com/google/zxing/MultiFormatReader.java +++ b/core/src/com/google/zxing/MultiFormatReader.java @@ -105,7 +105,7 @@ public final class MultiFormatReader implements Reader { formats.contains(BarcodeFormat.CODE_93) || formats.contains(BarcodeFormat.CODE_128) || formats.contains(BarcodeFormat.ITF) || - formats.contains(BarcodeFormat.RSS14) || + formats.contains(BarcodeFormat.RSS_14) || formats.contains(BarcodeFormat.RSS_EXPANDED); // Put 1D readers upfront in "normal" mode if (addOneDReader && !tryHarder) { @@ -120,7 +120,7 @@ public final class MultiFormatReader implements Reader { if (formats.contains(BarcodeFormat.AZTEC)) { readers.addElement(new AztecReader()); } - if (formats.contains(BarcodeFormat.PDF417)) { + if (formats.contains(BarcodeFormat.PDF_417)) { readers.addElement(new PDF417Reader()); } // At end in "try harder" mode diff --git a/core/src/com/google/zxing/oned/MultiFormatOneDReader.java b/core/src/com/google/zxing/oned/MultiFormatOneDReader.java index fa3de5d99..ce14eee91 100644 --- a/core/src/com/google/zxing/oned/MultiFormatOneDReader.java +++ b/core/src/com/google/zxing/oned/MultiFormatOneDReader.java @@ -65,7 +65,7 @@ public final class MultiFormatOneDReader extends OneDReader { if (possibleFormats.contains(BarcodeFormat.CODABAR)) { readers.addElement(new CodaBarReader()); } - if (possibleFormats.contains(BarcodeFormat.RSS14)) { + if (possibleFormats.contains(BarcodeFormat.RSS_14)) { readers.addElement(new RSS14Reader()); } if (possibleFormats.contains(BarcodeFormat.RSS_EXPANDED)){ @@ -76,11 +76,11 @@ public final class MultiFormatOneDReader extends OneDReader { readers.addElement(new MultiFormatUPCEANReader(hints)); readers.addElement(new Code39Reader()); //readers.addElement(new CodaBarReader()); - readers.addElement(new Code93Reader()); + readers.addElement(new Code93Reader()); readers.addElement(new Code128Reader()); readers.addElement(new ITFReader()); - readers.addElement(new RSS14Reader()); - readers.addElement(new RSSExpandedReader()); + readers.addElement(new RSS14Reader()); + readers.addElement(new RSSExpandedReader()); } } diff --git a/core/src/com/google/zxing/oned/rss/RSS14Reader.java b/core/src/com/google/zxing/oned/rss/RSS14Reader.java index 1c99ac1f7..17de4b7da 100644 --- a/core/src/com/google/zxing/oned/rss/RSS14Reader.java +++ b/core/src/com/google/zxing/oned/rss/RSS14Reader.java @@ -136,7 +136,7 @@ public final class RSS14Reader extends AbstractRSSReader { String.valueOf(buffer.toString()), null, new ResultPoint[] { leftPoints[0], leftPoints[1], rightPoints[0], rightPoints[1], }, - BarcodeFormat.RSS14); + BarcodeFormat.RSS_14); } private static boolean checkChecksum(Pair leftPair, Pair rightPair) { @@ -488,7 +488,7 @@ public final class RSS14Reader extends AbstractRSSReader { if (decrementEven) { decrement(evenCounts, evenRoundingErrors); } - + } } diff --git a/core/src/com/google/zxing/pdf417/PDF417Reader.java b/core/src/com/google/zxing/pdf417/PDF417Reader.java index ff20eb9a7..60cf83ced 100644 --- a/core/src/com/google/zxing/pdf417/PDF417Reader.java +++ b/core/src/com/google/zxing/pdf417/PDF417Reader.java @@ -67,7 +67,7 @@ public final class PDF417Reader implements Reader { points = detectorResult.getPoints(); } return new Result(decoderResult.getText(), decoderResult.getRawBytes(), points, - BarcodeFormat.PDF417); + BarcodeFormat.PDF_417); } public void reset() { diff --git a/core/test/src/com/google/zxing/oned/rss/RSS14BlackBox1TestCase.java b/core/test/src/com/google/zxing/oned/rss/RSS14BlackBox1TestCase.java index 7e0e9243e..a01b79d0e 100644 --- a/core/test/src/com/google/zxing/oned/rss/RSS14BlackBox1TestCase.java +++ b/core/test/src/com/google/zxing/oned/rss/RSS14BlackBox1TestCase.java @@ -26,7 +26,7 @@ import com.google.zxing.common.AbstractBlackBoxTestCase; public final class RSS14BlackBox1TestCase extends AbstractBlackBoxTestCase { public RSS14BlackBox1TestCase() { - super("test/data/blackbox/rss14-1", new MultiFormatReader(), BarcodeFormat.RSS14); + super("test/data/blackbox/rss14-1", new MultiFormatReader(), BarcodeFormat.RSS_14); addTest(6, 6, 0.0f); addTest(6, 6, 180.0f); } diff --git a/core/test/src/com/google/zxing/oned/rss/RSS14BlackBox2TestCase.java b/core/test/src/com/google/zxing/oned/rss/RSS14BlackBox2TestCase.java index 208da2048..7c61cb42d 100644 --- a/core/test/src/com/google/zxing/oned/rss/RSS14BlackBox2TestCase.java +++ b/core/test/src/com/google/zxing/oned/rss/RSS14BlackBox2TestCase.java @@ -26,7 +26,7 @@ import com.google.zxing.common.AbstractBlackBoxTestCase; public final class RSS14BlackBox2TestCase extends AbstractBlackBoxTestCase { public RSS14BlackBox2TestCase() { - super("test/data/blackbox/rss14-2", new MultiFormatReader(), BarcodeFormat.RSS14); + super("test/data/blackbox/rss14-2", new MultiFormatReader(), BarcodeFormat.RSS_14); addTest(0, 8, 0.0f); addTest(0, 8, 180.0f); } diff --git a/core/test/src/com/google/zxing/pdf417/PDF417BlackBox1TestCase.java b/core/test/src/com/google/zxing/pdf417/PDF417BlackBox1TestCase.java index 2acb0137e..045e9301a 100644 --- a/core/test/src/com/google/zxing/pdf417/PDF417BlackBox1TestCase.java +++ b/core/test/src/com/google/zxing/pdf417/PDF417BlackBox1TestCase.java @@ -32,16 +32,16 @@ import java.util.Vector; public final class PDF417BlackBox1TestCase extends AbstractBlackBoxTestCase { public PDF417BlackBox1TestCase() { - super("test/data/blackbox/pdf417", new MultiFormatReader(), BarcodeFormat.PDF417); + super("test/data/blackbox/pdf417", new MultiFormatReader(), BarcodeFormat.PDF_417); addTest(3, 3, 0.0f); addTest(3, 3, 180.0f); } - + @Override protected Hashtable getHints() { Hashtable table = new Hashtable(3); Vector v = new Vector(1); - v.add(BarcodeFormat.PDF417); + v.add(BarcodeFormat.PDF_417); table.put(DecodeHintType.POSSIBLE_FORMATS, v); return table; } diff --git a/core/test/src/com/google/zxing/pdf417/PDF417BlackBox2TestCase.java b/core/test/src/com/google/zxing/pdf417/PDF417BlackBox2TestCase.java index c56ef878c..08bbc53e1 100644 --- a/core/test/src/com/google/zxing/pdf417/PDF417BlackBox2TestCase.java +++ b/core/test/src/com/google/zxing/pdf417/PDF417BlackBox2TestCase.java @@ -32,7 +32,7 @@ import java.util.Vector; public final class PDF417BlackBox2TestCase extends AbstractBlackBoxTestCase { public PDF417BlackBox2TestCase() { - super("test/data/blackbox/pdf417-2", new MultiFormatReader(), BarcodeFormat.PDF417); + super("test/data/blackbox/pdf417-2", new MultiFormatReader(), BarcodeFormat.PDF_417); addTest(13, 13, 0.0f); addTest(13, 13, 180.0f); } @@ -41,7 +41,7 @@ public final class PDF417BlackBox2TestCase extends AbstractBlackBoxTestCase { protected Hashtable getHints() { Hashtable table = new Hashtable(3); Vector v = new Vector(1); - v.add(BarcodeFormat.PDF417); + v.add(BarcodeFormat.PDF_417); table.put(DecodeHintType.POSSIBLE_FORMATS, v); return table; } diff --git a/javase/src/com/google/zxing/client/j2se/CommandLineRunner.java b/javase/src/com/google/zxing/client/j2se/CommandLineRunner.java index f8eaa651e..7dc1716be 100644 --- a/javase/src/com/google/zxing/client/j2se/CommandLineRunner.java +++ b/javase/src/com/google/zxing/client/j2se/CommandLineRunner.java @@ -151,7 +151,7 @@ public final class CommandLineRunner { vector.addElement(BarcodeFormat.UPC_E); vector.addElement(BarcodeFormat.EAN_13); vector.addElement(BarcodeFormat.EAN_8); - vector.addElement(BarcodeFormat.RSS14); + vector.addElement(BarcodeFormat.RSS_14); vector.addElement(BarcodeFormat.RSS_EXPANDED); if (!config.isProductsOnly()) { vector.addElement(BarcodeFormat.CODE_39); @@ -161,7 +161,7 @@ public final class CommandLineRunner { vector.addElement(BarcodeFormat.QR_CODE); vector.addElement(BarcodeFormat.DATA_MATRIX); vector.addElement(BarcodeFormat.AZTEC); - vector.addElement(BarcodeFormat.PDF417); + vector.addElement(BarcodeFormat.PDF_417); vector.addElement(BarcodeFormat.CODABAR); } hints.put(DecodeHintType.POSSIBLE_FORMATS, vector); diff --git a/zxingorg/src/com/google/zxing/web/DecodeServlet.java b/zxingorg/src/com/google/zxing/web/DecodeServlet.java index 26e9d2a1e..c8fb05da4 100644 --- a/zxingorg/src/com/google/zxing/web/DecodeServlet.java +++ b/zxingorg/src/com/google/zxing/web/DecodeServlet.java @@ -111,11 +111,11 @@ public final class DecodeServlet extends HttpServlet { possibleFormats.add(BarcodeFormat.CODE_128); possibleFormats.add(BarcodeFormat.CODABAR); possibleFormats.add(BarcodeFormat.ITF); - possibleFormats.add(BarcodeFormat.RSS14); + possibleFormats.add(BarcodeFormat.RSS_14); possibleFormats.add(BarcodeFormat.QR_CODE); possibleFormats.add(BarcodeFormat.DATA_MATRIX); possibleFormats.add(BarcodeFormat.AZTEC); - possibleFormats.add(BarcodeFormat.PDF417); + possibleFormats.add(BarcodeFormat.PDF_417); HINTS.put(DecodeHintType.POSSIBLE_FORMATS, possibleFormats); HINTS_PURE = new Hashtable(HINTS); HINTS_PURE.put(DecodeHintType.PURE_BARCODE, Boolean.TRUE);