From cd86e6050f634084dd100567c4b1f44218aa7d8a Mon Sep 17 00:00:00 2001 From: "dswitkin@google.com" Date: Thu, 5 Aug 2010 15:22:30 +0000 Subject: [PATCH] Issue 495: Renamed DATAMATRIX to DATA_MATRIX for consistency. git-svn-id: http://zxing.googlecode.com/svn/trunk@1508 59b500cc-1b3d-0410-9834-0bbf25fbcc57 --- core/src/com/google/zxing/BarcodeFormat.java | 6 +++--- core/src/com/google/zxing/MultiFormatReader.java | 10 +++++----- .../com/google/zxing/datamatrix/DataMatrixReader.java | 9 +++++---- .../zxing/datamatrix/DataMatrixBlackBox1TestCase.java | 2 +- .../zxing/datamatrix/DataMatrixBlackBox2TestCase.java | 2 +- .../google/zxing/client/j2se/CommandLineRunner.java | 8 ++++---- zxingorg/src/com/google/zxing/web/DecodeServlet.java | 10 +++++----- 7 files changed, 24 insertions(+), 23 deletions(-) diff --git a/core/src/com/google/zxing/BarcodeFormat.java b/core/src/com/google/zxing/BarcodeFormat.java index e10a8a81..73e3cd07 100644 --- a/core/src/com/google/zxing/BarcodeFormat.java +++ b/core/src/com/google/zxing/BarcodeFormat.java @@ -33,7 +33,7 @@ public final class BarcodeFormat { public static final BarcodeFormat QR_CODE = new BarcodeFormat("QR_CODE"); /** DataMatrix 2D barcode format. */ - public static final BarcodeFormat DATAMATRIX = new BarcodeFormat("DATAMATRIX"); + public static final BarcodeFormat DATA_MATRIX = new BarcodeFormat("DATA_MATRIX"); /** UPC-E 1D format. */ public static final BarcodeFormat UPC_E = new BarcodeFormat("UPC_E"); @@ -58,7 +58,7 @@ 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"); @@ -70,7 +70,7 @@ public final class BarcodeFormat { /** PDF417 format. */ public static final BarcodeFormat PDF417 = new BarcodeFormat("PDF417"); - + /** RSS EXPANDED */ public static final BarcodeFormat RSS_EXPANDED = new BarcodeFormat("RSS_EXPANDED"); diff --git a/core/src/com/google/zxing/MultiFormatReader.java b/core/src/com/google/zxing/MultiFormatReader.java index 9784760c..c817d680 100644 --- a/core/src/com/google/zxing/MultiFormatReader.java +++ b/core/src/com/google/zxing/MultiFormatReader.java @@ -104,7 +104,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.RSS14) || formats.contains(BarcodeFormat.RSS_EXPANDED); // Put 1D readers upfront in "normal" mode if (addOneDReader && !tryHarder) { @@ -113,7 +113,7 @@ public final class MultiFormatReader implements Reader { if (formats.contains(BarcodeFormat.QR_CODE)) { readers.addElement(new QRCodeReader()); } - if (formats.contains(BarcodeFormat.DATAMATRIX)) { + if (formats.contains(BarcodeFormat.DATA_MATRIX)) { readers.addElement(new DataMatrixReader()); } if (formats.contains(BarcodeFormat.PDF417)) { @@ -129,13 +129,13 @@ public final class MultiFormatReader implements Reader { readers.addElement(new MultiFormatOneDReader(hints)); } readers.addElement(new QRCodeReader()); - + // TODO re-enable once Data Matrix is ready // readers.addElement(new DataMatrixReader()); - + // TODO: Enable once PDF417 has passed QA //readers.addElement(new PDF417Reader()); - + if (tryHarder) { readers.addElement(new MultiFormatOneDReader(hints)); } diff --git a/core/src/com/google/zxing/datamatrix/DataMatrixReader.java b/core/src/com/google/zxing/datamatrix/DataMatrixReader.java index 477a989e..25f8fa44 100644 --- a/core/src/com/google/zxing/datamatrix/DataMatrixReader.java +++ b/core/src/com/google/zxing/datamatrix/DataMatrixReader.java @@ -42,7 +42,7 @@ import java.util.Hashtable; public final class DataMatrixReader implements Reader { private static final ResultPoint[] NO_POINTS = new ResultPoint[0]; - + private final Decoder decoder = new Decoder(); /** @@ -70,7 +70,8 @@ public final class DataMatrixReader implements Reader { decoderResult = decoder.decode(detectorResult.getBits()); points = detectorResult.getPoints(); } - Result result = new Result(decoderResult.getText(), decoderResult.getRawBytes(), points, BarcodeFormat.DATAMATRIX); + Result result = new Result(decoderResult.getText(), decoderResult.getRawBytes(), points, + BarcodeFormat.DATA_MATRIX); if (decoderResult.getByteSegments() != null) { result.putMetadata(ResultMetadataType.BYTE_SEGMENTS, decoderResult.getByteSegments()); } @@ -90,7 +91,7 @@ public final class DataMatrixReader implements Reader { * around it. This is a specialized method that works exceptionally fast in this special * case. * - * @see com.google.zxing.qrcode.QRCodeReader#extractPureBits(BitMatrix) + * @see com.google.zxing.qrcode.QRCodeReader#extractPureBits(BitMatrix) */ private static BitMatrix extractPureBits(BitMatrix image) throws NotFoundException { @@ -132,7 +133,7 @@ public final class DataMatrixReader implements Reader { int dimension = 2 + ((rowEndOfSymbol - x) / moduleSize); y += moduleSize; - + // Push in the "border" by half the module width so that we start // sampling in the middle of the module. Just in case the image is a // little off, this will help recover. diff --git a/core/test/src/com/google/zxing/datamatrix/DataMatrixBlackBox1TestCase.java b/core/test/src/com/google/zxing/datamatrix/DataMatrixBlackBox1TestCase.java index 6514e5ef..a4cc8810 100644 --- a/core/test/src/com/google/zxing/datamatrix/DataMatrixBlackBox1TestCase.java +++ b/core/test/src/com/google/zxing/datamatrix/DataMatrixBlackBox1TestCase.java @@ -26,7 +26,7 @@ public final class DataMatrixBlackBox1TestCase extends AbstractBlackBoxTestCase public DataMatrixBlackBox1TestCase() { // TODO use MultiFormatReader here once Data Matrix decoder is done - super("test/data/blackbox/datamatrix-1", new DataMatrixReader(), BarcodeFormat.DATAMATRIX); + super("test/data/blackbox/datamatrix-1", new DataMatrixReader(), BarcodeFormat.DATA_MATRIX); addTest(7, 7, 0.0f); addTest(7, 7, 90.0f); addTest(6, 6, 180.0f); diff --git a/core/test/src/com/google/zxing/datamatrix/DataMatrixBlackBox2TestCase.java b/core/test/src/com/google/zxing/datamatrix/DataMatrixBlackBox2TestCase.java index 3508ff0d..b33a7963 100644 --- a/core/test/src/com/google/zxing/datamatrix/DataMatrixBlackBox2TestCase.java +++ b/core/test/src/com/google/zxing/datamatrix/DataMatrixBlackBox2TestCase.java @@ -26,7 +26,7 @@ public final class DataMatrixBlackBox2TestCase extends AbstractBlackBoxTestCase public DataMatrixBlackBox2TestCase() { // TODO use MultiFormatReader here once Data Matrix decoder is done - super("test/data/blackbox/datamatrix-2", new DataMatrixReader(), BarcodeFormat.DATAMATRIX); + super("test/data/blackbox/datamatrix-2", new DataMatrixReader(), BarcodeFormat.DATA_MATRIX); addTest(4, 4, 0.0f); addTest(1, 1, 90.0f); addTest(3, 3, 180.0f); diff --git a/javase/src/com/google/zxing/client/j2se/CommandLineRunner.java b/javase/src/com/google/zxing/client/j2se/CommandLineRunner.java index 235a80d8..a725d075 100644 --- a/javase/src/com/google/zxing/client/j2se/CommandLineRunner.java +++ b/javase/src/com/google/zxing/client/j2se/CommandLineRunner.java @@ -114,14 +114,14 @@ 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.RSS14); if (!productsOnly) { vector.addElement(BarcodeFormat.CODE_39); - vector.addElement(BarcodeFormat.CODE_93); + vector.addElement(BarcodeFormat.CODE_93); vector.addElement(BarcodeFormat.CODE_128); vector.addElement(BarcodeFormat.ITF); vector.addElement(BarcodeFormat.QR_CODE); - vector.addElement(BarcodeFormat.DATAMATRIX); + vector.addElement(BarcodeFormat.DATA_MATRIX); vector.addElement(BarcodeFormat.PDF417); //vector.addElement(BarcodeFormat.CODABAR); } @@ -239,7 +239,7 @@ public final class CommandLineRunner { System.out.println(uri.toString() + " (format: " + result.getBarcodeFormat() + ", type: " + parsedResult.getType() + "):\nRaw result:\n" + result.getText() + "\nParsed result:\n" + parsedResult.getDisplayResult()); - + System.out.println("Also, there were " + result.getResultPoints().length + " result points."); for (int i = 0; i < result.getResultPoints().length; i++) { ResultPoint rp = result.getResultPoints()[i]; diff --git a/zxingorg/src/com/google/zxing/web/DecodeServlet.java b/zxingorg/src/com/google/zxing/web/DecodeServlet.java index 8419c7ac..6a64c3ed 100644 --- a/zxingorg/src/com/google/zxing/web/DecodeServlet.java +++ b/zxingorg/src/com/google/zxing/web/DecodeServlet.java @@ -107,13 +107,13 @@ public final class DecodeServlet extends HttpServlet { possibleFormats.add(BarcodeFormat.EAN_8); possibleFormats.add(BarcodeFormat.EAN_13); possibleFormats.add(BarcodeFormat.CODE_39); - possibleFormats.add(BarcodeFormat.CODE_93); + possibleFormats.add(BarcodeFormat.CODE_93); possibleFormats.add(BarcodeFormat.CODE_128); //possibleFormats.add(BarcodeFormat.CODABAR); possibleFormats.add(BarcodeFormat.ITF); - possibleFormats.add(BarcodeFormat.RSS14); + possibleFormats.add(BarcodeFormat.RSS14); possibleFormats.add(BarcodeFormat.QR_CODE); - possibleFormats.add(BarcodeFormat.DATAMATRIX); + possibleFormats.add(BarcodeFormat.DATA_MATRIX); possibleFormats.add(BarcodeFormat.PDF417); HINTS.put(DecodeHintType.POSSIBLE_FORMATS, possibleFormats); HINTS_PURE = new Hashtable(HINTS); @@ -286,11 +286,11 @@ public final class DecodeServlet extends HttpServlet { } if (image == null) { response.sendRedirect("badimage.jspx"); - return; + return; } if (image.getHeight() <= 1 || image.getWidth() <= 1 || image.getHeight() * image.getWidth() > MAX_PIXELS) { - log.fine("Dimensions too large: " + image.getWidth() + 'x' + image.getHeight()); + log.fine("Dimensions too large: " + image.getWidth() + 'x' + image.getHeight()); response.sendRedirect("badimage.jspx"); return; } -- 2.20.1