mirror of
https://github.com/zxing/zxing.git
synced 2025-03-05 20:48:51 -08:00
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:
parent
fbae6e32e9
commit
9fd4391f8e
|
@ -57,6 +57,11 @@ public final class DecodeHintType {
|
||||||
*/
|
*/
|
||||||
public static final DecodeHintType ALLOWED_LENGTHS = new 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() {
|
private DecodeHintType() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,7 @@ public final class MultiFormatOneDReader extends AbstractOneDReader {
|
||||||
|
|
||||||
public MultiFormatOneDReader(Hashtable hints) {
|
public MultiFormatOneDReader(Hashtable hints) {
|
||||||
Vector possibleFormats = hints == null ? null : (Vector) hints.get(DecodeHintType.POSSIBLE_FORMATS);
|
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();
|
readers = new Vector();
|
||||||
if (possibleFormats != null) {
|
if (possibleFormats != null) {
|
||||||
if (possibleFormats.contains(BarcodeFormat.EAN_13) ||
|
if (possibleFormats.contains(BarcodeFormat.EAN_13) ||
|
||||||
|
@ -44,7 +45,7 @@ public final class MultiFormatOneDReader extends AbstractOneDReader {
|
||||||
readers.addElement(new MultiFormatUPCEANReader(hints));
|
readers.addElement(new MultiFormatUPCEANReader(hints));
|
||||||
}
|
}
|
||||||
if (possibleFormats.contains(BarcodeFormat.CODE_39)) {
|
if (possibleFormats.contains(BarcodeFormat.CODE_39)) {
|
||||||
readers.addElement(new Code39Reader());
|
readers.addElement(new Code39Reader(useCode39CheckDigit));
|
||||||
}
|
}
|
||||||
if (possibleFormats.contains(BarcodeFormat.CODE_128)) {
|
if (possibleFormats.contains(BarcodeFormat.CODE_128)) {
|
||||||
readers.addElement(new Code128Reader());
|
readers.addElement(new Code128Reader());
|
||||||
|
|
Loading…
Reference in a new issue