mirror of
https://github.com/zxing/zxing.git
synced 2025-01-12 11:47:26 -08:00
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:
parent
45bebd195c
commit
8ff9e7f4fa
|
@ -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);
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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<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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue