RSSExpandedReader.java (zxing-zxing-3.4.1) | : | RSSExpandedReader.java (zxing-zxing-3.5.0) | ||
---|---|---|---|---|
skipping to change at line 34 | skipping to change at line 34 | |||
* http://www.piramidepse.com/ | * http://www.piramidepse.com/ | |||
*/ | */ | |||
package com.google.zxing.oned.rss.expanded; | package com.google.zxing.oned.rss.expanded; | |||
import com.google.zxing.BarcodeFormat; | import com.google.zxing.BarcodeFormat; | |||
import com.google.zxing.DecodeHintType; | import com.google.zxing.DecodeHintType; | |||
import com.google.zxing.FormatException; | import com.google.zxing.FormatException; | |||
import com.google.zxing.NotFoundException; | import com.google.zxing.NotFoundException; | |||
import com.google.zxing.Result; | import com.google.zxing.Result; | |||
import com.google.zxing.ResultMetadataType; | ||||
import com.google.zxing.ResultPoint; | import com.google.zxing.ResultPoint; | |||
import com.google.zxing.common.BitArray; | import com.google.zxing.common.BitArray; | |||
import com.google.zxing.common.detector.MathUtils; | import com.google.zxing.common.detector.MathUtils; | |||
import com.google.zxing.oned.rss.AbstractRSSReader; | import com.google.zxing.oned.rss.AbstractRSSReader; | |||
import com.google.zxing.oned.rss.DataCharacter; | import com.google.zxing.oned.rss.DataCharacter; | |||
import com.google.zxing.oned.rss.FinderPattern; | import com.google.zxing.oned.rss.FinderPattern; | |||
import com.google.zxing.oned.rss.RSSUtils; | import com.google.zxing.oned.rss.RSSUtils; | |||
import com.google.zxing.oned.rss.expanded.decoders.AbstractExpandedDecoder; | import com.google.zxing.oned.rss.expanded.decoders.AbstractExpandedDecoder; | |||
import java.util.Arrays; | import java.util.Arrays; | |||
skipping to change at line 103 | skipping to change at line 104 | |||
{ 45, 135, 194, 160, 58, 174, 100, 89} | { 45, 135, 194, 160, 58, 174, 100, 89} | |||
}; | }; | |||
private static final int FINDER_PAT_A = 0; | private static final int FINDER_PAT_A = 0; | |||
private static final int FINDER_PAT_B = 1; | private static final int FINDER_PAT_B = 1; | |||
private static final int FINDER_PAT_C = 2; | private static final int FINDER_PAT_C = 2; | |||
private static final int FINDER_PAT_D = 3; | private static final int FINDER_PAT_D = 3; | |||
private static final int FINDER_PAT_E = 4; | private static final int FINDER_PAT_E = 4; | |||
private static final int FINDER_PAT_F = 5; | private static final int FINDER_PAT_F = 5; | |||
@SuppressWarnings("checkstyle:lineLength") | ||||
private static final int[][] FINDER_PATTERN_SEQUENCES = { | private static final int[][] FINDER_PATTERN_SEQUENCES = { | |||
{ FINDER_PAT_A, FINDER_PAT_A }, | { FINDER_PAT_A, FINDER_PAT_A }, | |||
{ FINDER_PAT_A, FINDER_PAT_B, FINDER_PAT_B }, | { FINDER_PAT_A, FINDER_PAT_B, FINDER_PAT_B }, | |||
{ FINDER_PAT_A, FINDER_PAT_C, FINDER_PAT_B, FINDER_PAT_D }, | { FINDER_PAT_A, FINDER_PAT_C, FINDER_PAT_B, FINDER_PAT_D }, | |||
{ FINDER_PAT_A, FINDER_PAT_E, FINDER_PAT_B, FINDER_PAT_D, FINDER_PAT_C }, | { FINDER_PAT_A, FINDER_PAT_E, FINDER_PAT_B, FINDER_PAT_D, FINDER_PAT_C }, | |||
{ FINDER_PAT_A, FINDER_PAT_E, FINDER_PAT_B, FINDER_PAT_D, FINDER_PAT_D, FIND ER_PAT_F }, | { FINDER_PAT_A, FINDER_PAT_E, FINDER_PAT_B, FINDER_PAT_D, FINDER_PAT_D, FIND ER_PAT_F }, | |||
{ FINDER_PAT_A, FINDER_PAT_E, FINDER_PAT_B, FINDER_PAT_D, FINDER_PAT_E, FIND ER_PAT_F, FINDER_PAT_F }, | { FINDER_PAT_A, FINDER_PAT_E, FINDER_PAT_B, FINDER_PAT_D, FINDER_PAT_E, FIND ER_PAT_F, FINDER_PAT_F }, | |||
{ FINDER_PAT_A, FINDER_PAT_A, FINDER_PAT_B, FINDER_PAT_B, FINDER_PAT_C, FIND ER_PAT_C, FINDER_PAT_D, FINDER_PAT_D }, | { FINDER_PAT_A, FINDER_PAT_A, FINDER_PAT_B, FINDER_PAT_B, FINDER_PAT_C, FIND ER_PAT_C, FINDER_PAT_D, FINDER_PAT_D }, | |||
{ FINDER_PAT_A, FINDER_PAT_A, FINDER_PAT_B, FINDER_PAT_B, FINDER_PAT_C, FIND ER_PAT_C, FINDER_PAT_D, FINDER_PAT_E, FINDER_PAT_E }, | { FINDER_PAT_A, FINDER_PAT_A, FINDER_PAT_B, FINDER_PAT_B, FINDER_PAT_C, FIND ER_PAT_C, FINDER_PAT_D, FINDER_PAT_E, FINDER_PAT_E }, | |||
{ FINDER_PAT_A, FINDER_PAT_A, FINDER_PAT_B, FINDER_PAT_B, FINDER_PAT_C, FIND ER_PAT_C, FINDER_PAT_D, FINDER_PAT_E, FINDER_PAT_F, FINDER_PAT_F }, | { FINDER_PAT_A, FINDER_PAT_A, FINDER_PAT_B, FINDER_PAT_B, FINDER_PAT_C, FIND ER_PAT_C, FINDER_PAT_D, FINDER_PAT_E, FINDER_PAT_F, FINDER_PAT_F }, | |||
skipping to change at line 293 | skipping to change at line 295 | |||
// When the row was partially decoded (e.g. 2 pairs found instead of 3), | // When the row was partially decoded (e.g. 2 pairs found instead of 3), | |||
// it will prevent us from detecting the barcode. | // it will prevent us from detecting the barcode. | |||
// Try to merge partial rows | // Try to merge partial rows | |||
// Check whether the row is part of an already detected row | // Check whether the row is part of an already detected row | |||
if (isPartialRow(this.pairs, this.rows)) { | if (isPartialRow(this.pairs, this.rows)) { | |||
return; | return; | |||
} | } | |||
this.rows.add(insertPos, new ExpandedRow(this.pairs, rowNumber, false)); | this.rows.add(insertPos, new ExpandedRow(this.pairs, rowNumber)); | |||
removePartialRows(this.pairs, this.rows); | removePartialRows(this.pairs, this.rows); | |||
} | } | |||
// Remove all the rows that contains only specified pairs | // Remove all the rows that contains only specified pairs | |||
private static void removePartialRows(Collection<ExpandedPair> pairs, Collecti on<ExpandedRow> rows) { | private static void removePartialRows(Collection<ExpandedPair> pairs, Collecti on<ExpandedRow> rows) { | |||
for (Iterator<ExpandedRow> iterator = rows.iterator(); iterator.hasNext();) { | for (Iterator<ExpandedRow> iterator = rows.iterator(); iterator.hasNext();) { | |||
ExpandedRow r = iterator.next(); | ExpandedRow r = iterator.next(); | |||
if (r.getPairs().size() != pairs.size()) { | if (r.getPairs().size() != pairs.size()) { | |||
boolean allFound = true; | boolean allFound = true; | |||
skipping to change at line 358 | skipping to change at line 360 | |||
// Not private for unit testing | // Not private for unit testing | |||
static Result constructResult(List<ExpandedPair> pairs) throws NotFoundExcepti on, FormatException { | static Result constructResult(List<ExpandedPair> pairs) throws NotFoundExcepti on, FormatException { | |||
BitArray binary = BitArrayBuilder.buildBitArray(pairs); | BitArray binary = BitArrayBuilder.buildBitArray(pairs); | |||
AbstractExpandedDecoder decoder = AbstractExpandedDecoder.createDecoder(bina ry); | AbstractExpandedDecoder decoder = AbstractExpandedDecoder.createDecoder(bina ry); | |||
String resultingString = decoder.parseInformation(); | String resultingString = decoder.parseInformation(); | |||
ResultPoint[] firstPoints = pairs.get(0).getFinderPattern().getResultPoints( ); | ResultPoint[] firstPoints = pairs.get(0).getFinderPattern().getResultPoints( ); | |||
ResultPoint[] lastPoints = pairs.get(pairs.size() - 1).getFinderPattern().g etResultPoints(); | ResultPoint[] lastPoints = pairs.get(pairs.size() - 1).getFinderPattern().g etResultPoints(); | |||
return new Result( | Result result = new Result( | |||
resultingString, | resultingString, | |||
null, | null, | |||
new ResultPoint[]{firstPoints[0], firstPoints[1], lastPoints[0], lastP oints[1]}, | new ResultPoint[]{firstPoints[0], firstPoints[1], lastPoints[0], lastP oints[1]}, | |||
BarcodeFormat.RSS_EXPANDED | BarcodeFormat.RSS_EXPANDED | |||
); | ); | |||
result.putMetadata(ResultMetadataType.SYMBOLOGY_IDENTIFIER, "]e0"); | ||||
return result; | ||||
} | } | |||
private boolean checkChecksum() { | private boolean checkChecksum() { | |||
ExpandedPair firstPair = this.pairs.get(0); | ExpandedPair firstPair = this.pairs.get(0); | |||
DataCharacter checkCharacter = firstPair.getLeftChar(); | DataCharacter checkCharacter = firstPair.getLeftChar(); | |||
DataCharacter firstCharacter = firstPair.getRightChar(); | DataCharacter firstCharacter = firstPair.getRightChar(); | |||
if (firstCharacter == null) { | if (firstCharacter == null) { | |||
return false; | return false; | |||
} | } | |||
End of changes. 5 change blocks. | ||||
2 lines changed or deleted | 6 lines changed or added |