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
This commit is contained in:
dswitkin@google.com 2011-05-17 15:46:09 +00:00
parent 45bebd195c
commit 8ff9e7f4fa
12 changed files with 51 additions and 51 deletions

View file

@ -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<BarcodeFormat>(PRODUCT_FORMATS.size() + 4);
ONE_D_FORMATS.addAll(PRODUCT_FORMATS);
ONE_D_FORMATS.add(BarcodeFormat.CODE_39);

View file

@ -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) {

View file

@ -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

View file

@ -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)){

View file

@ -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) {

View file

@ -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() {

View file

@ -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);
}

View file

@ -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);
}

View file

@ -32,7 +32,7 @@ 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);
}
@ -41,7 +41,7 @@ public final class PDF417BlackBox1TestCase extends AbstractBlackBoxTestCase {
protected Hashtable<DecodeHintType, Object> getHints() {
Hashtable<DecodeHintType, Object> table = new Hashtable<DecodeHintType, Object>(3);
Vector<BarcodeFormat> v = new Vector<BarcodeFormat>(1);
v.add(BarcodeFormat.PDF417);
v.add(BarcodeFormat.PDF_417);
table.put(DecodeHintType.POSSIBLE_FORMATS, v);
return table;
}

View file

@ -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<DecodeHintType, Object> getHints() {
Hashtable<DecodeHintType, Object> table = new Hashtable<DecodeHintType, Object>(3);
Vector<BarcodeFormat> v = new Vector<BarcodeFormat>(1);
v.add(BarcodeFormat.PDF417);
v.add(BarcodeFormat.PDF_417);
table.put(DecodeHintType.POSSIBLE_FORMATS, v);
return table;
}

View file

@ -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);

View file

@ -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<DecodeHintType, Object>(HINTS);
HINTS_PURE.put(DecodeHintType.PURE_BARCODE, Boolean.TRUE);