From: srowen Date: Wed, 4 Nov 2009 22:00:27 +0000 (+0000) Subject: Added Code 39 check digit hint X-Git-Url: http://git.rot13.org/?a=commitdiff_plain;h=575d4709225e8c1ebacbefc1d5c860aebe848744;hp=58c5604309a11373b15e40f025138cace4eda8d2;p=zxing.git Added Code 39 check digit hint git-svn-id: http://zxing.googlecode.com/svn/trunk@1098 59b500cc-1b3d-0410-9834-0bbf25fbcc57 --- diff --git a/core/src/com/google/zxing/DecodeHintType.java b/core/src/com/google/zxing/DecodeHintType.java index 4b51e230..21a4de00 100644 --- a/core/src/com/google/zxing/DecodeHintType.java +++ b/core/src/com/google/zxing/DecodeHintType.java @@ -57,6 +57,11 @@ public final class DecodeHintType { */ public static final DecodeHintType ALLOWED_LENGTHS = new DecodeHintType(); + /** + * Assume Code 39 codes employ a check digit. Maps to {@link Boolean}. + */ + public static final DecodeHintType ASSUME_CODE_39_CHECK_DIGIT = new DecodeHintType(); + private DecodeHintType() { } diff --git a/core/src/com/google/zxing/oned/MultiFormatOneDReader.java b/core/src/com/google/zxing/oned/MultiFormatOneDReader.java index ea0d1974..c22437b9 100644 --- a/core/src/com/google/zxing/oned/MultiFormatOneDReader.java +++ b/core/src/com/google/zxing/oned/MultiFormatOneDReader.java @@ -35,6 +35,7 @@ public final class MultiFormatOneDReader extends AbstractOneDReader { public MultiFormatOneDReader(Hashtable hints) { Vector possibleFormats = hints == null ? null : (Vector) hints.get(DecodeHintType.POSSIBLE_FORMATS); + boolean useCode39CheckDigit = hints != null && hints.get(DecodeHintType.ASSUME_CODE_39_CHECK_DIGIT) != null; readers = new Vector(); if (possibleFormats != null) { if (possibleFormats.contains(BarcodeFormat.EAN_13) || @@ -44,7 +45,7 @@ public final class MultiFormatOneDReader extends AbstractOneDReader { readers.addElement(new MultiFormatUPCEANReader(hints)); } if (possibleFormats.contains(BarcodeFormat.CODE_39)) { - readers.addElement(new Code39Reader()); + readers.addElement(new Code39Reader(useCode39CheckDigit)); } if (possibleFormats.contains(BarcodeFormat.CODE_128)) { readers.addElement(new Code128Reader());