Added Code 39 check digit hint

git-svn-id: https://zxing.googlecode.com/svn/trunk@1098 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
srowen 2009-11-04 22:00:27 +00:00
parent fbae6e32e9
commit 9fd4391f8e
2 changed files with 7 additions and 1 deletions

View file

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

View file

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