mirror of
https://github.com/starovoid/rxing.git
synced 2026-07-27 12:52:34 +00:00
move all Result to RXingResult
This commit is contained in:
@@ -30,9 +30,9 @@ import com.google.zxing.BarcodeFormat;
|
||||
import com.google.zxing.DecodeHintType;
|
||||
import com.google.zxing.FormatException;
|
||||
import com.google.zxing.NotFoundException;
|
||||
import com.google.zxing.Result;
|
||||
import com.google.zxing.ResultMetadataType;
|
||||
import com.google.zxing.ResultPoint;
|
||||
import com.google.zxing.RXingResult;
|
||||
import com.google.zxing.RXingResultMetadataType;
|
||||
import com.google.zxing.RXingResultPoint;
|
||||
import com.google.zxing.common.BitArray;
|
||||
import com.google.zxing.common.detector.MathUtils;
|
||||
import com.google.zxing.oned.rss.AbstractRSSReader;
|
||||
@@ -123,7 +123,7 @@ public final class RSSExpandedReader extends AbstractRSSReader {
|
||||
private boolean startFromEven;
|
||||
|
||||
@Override
|
||||
public Result decodeRow(int rowNumber,
|
||||
public RXingResult decodeRow(int rowNumber,
|
||||
BitArray row,
|
||||
Map<DecodeHintType,?> hints) throws NotFoundException, FormatException {
|
||||
// Rows can start with even pattern in case in prev rows there where odd number of patters.
|
||||
@@ -131,14 +131,14 @@ public final class RSSExpandedReader extends AbstractRSSReader {
|
||||
this.pairs.clear();
|
||||
this.startFromEven = false;
|
||||
try {
|
||||
return constructResult(decodeRow2pairs(rowNumber, row));
|
||||
return constructRXingResult(decodeRow2pairs(rowNumber, row));
|
||||
} catch (NotFoundException e) {
|
||||
// OK
|
||||
}
|
||||
|
||||
this.pairs.clear();
|
||||
this.startFromEven = true;
|
||||
return constructResult(decodeRow2pairs(rowNumber, row));
|
||||
return constructRXingResult(decodeRow2pairs(rowNumber, row));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -348,22 +348,22 @@ public final class RSSExpandedReader extends AbstractRSSReader {
|
||||
}
|
||||
|
||||
// Not private for unit testing
|
||||
static Result constructResult(List<ExpandedPair> pairs) throws NotFoundException, FormatException {
|
||||
static RXingResult constructRXingResult(List<ExpandedPair> pairs) throws NotFoundException, FormatException {
|
||||
BitArray binary = BitArrayBuilder.buildBitArray(pairs);
|
||||
|
||||
AbstractExpandedDecoder decoder = AbstractExpandedDecoder.createDecoder(binary);
|
||||
String resultingString = decoder.parseInformation();
|
||||
|
||||
ResultPoint[] firstPoints = pairs.get(0).getFinderPattern().getResultPoints();
|
||||
ResultPoint[] lastPoints = pairs.get(pairs.size() - 1).getFinderPattern().getResultPoints();
|
||||
RXingResultPoint[] firstPoints = pairs.get(0).getFinderPattern().getRXingResultPoints();
|
||||
RXingResultPoint[] lastPoints = pairs.get(pairs.size() - 1).getFinderPattern().getRXingResultPoints();
|
||||
|
||||
Result result = new Result(
|
||||
RXingResult result = new RXingResult(
|
||||
resultingString,
|
||||
null,
|
||||
new ResultPoint[]{firstPoints[0], firstPoints[1], lastPoints[0], lastPoints[1]},
|
||||
new RXingResultPoint[]{firstPoints[0], firstPoints[1], lastPoints[0], lastPoints[1]},
|
||||
BarcodeFormat.RSS_EXPANDED
|
||||
);
|
||||
result.putMetadata(ResultMetadataType.SYMBOLOGY_IDENTIFIER, "]e0");
|
||||
result.putMetadata(RXingResultMetadataType.SYMBOLOGY_IDENTIFIER, "]e0");
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -30,16 +30,16 @@ package com.google.zxing.oned.rss.expanded.decoders;
|
||||
* @author Pablo Orduña, University of Deusto (pablo.orduna@deusto.es)
|
||||
* @author Eduardo Castillejo, University of Deusto (eduardo.castillejo@deusto.es)
|
||||
*/
|
||||
final class BlockParsedResult {
|
||||
final class BlockParsedRXingResult {
|
||||
|
||||
private final DecodedInformation decodedInformation;
|
||||
private final boolean finished;
|
||||
|
||||
BlockParsedResult() {
|
||||
BlockParsedRXingResult() {
|
||||
this(null, false);
|
||||
}
|
||||
|
||||
BlockParsedResult(DecodedInformation information, boolean finished) {
|
||||
BlockParsedRXingResult(DecodedInformation information, boolean finished) {
|
||||
this.finished = finished;
|
||||
this.decodedInformation = information;
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ final class GeneralAppIdDecoder {
|
||||
|
||||
private DecodedInformation parseBlocks() throws FormatException {
|
||||
boolean isFinished;
|
||||
BlockParsedResult result;
|
||||
BlockParsedRXingResult result;
|
||||
do {
|
||||
int initialPosition = current.getPosition();
|
||||
|
||||
@@ -158,7 +158,7 @@ final class GeneralAppIdDecoder {
|
||||
return result.getDecodedInformation();
|
||||
}
|
||||
|
||||
private BlockParsedResult parseNumericBlock() throws FormatException {
|
||||
private BlockParsedRXingResult parseNumericBlock() throws FormatException {
|
||||
while (isStillNumeric(current.getPosition())) {
|
||||
DecodedNumeric numeric = decodeNumeric(current.getPosition());
|
||||
current.setPosition(numeric.getNewPosition());
|
||||
@@ -170,13 +170,13 @@ final class GeneralAppIdDecoder {
|
||||
} else {
|
||||
information = new DecodedInformation(current.getPosition(), buffer.toString(), numeric.getSecondDigit());
|
||||
}
|
||||
return new BlockParsedResult(information, true);
|
||||
return new BlockParsedRXingResult(information, true);
|
||||
}
|
||||
buffer.append(numeric.getFirstDigit());
|
||||
|
||||
if (numeric.isSecondDigitFNC1()) {
|
||||
DecodedInformation information = new DecodedInformation(current.getPosition(), buffer.toString());
|
||||
return new BlockParsedResult(information, true);
|
||||
return new BlockParsedRXingResult(information, true);
|
||||
}
|
||||
buffer.append(numeric.getSecondDigit());
|
||||
}
|
||||
@@ -185,17 +185,17 @@ final class GeneralAppIdDecoder {
|
||||
current.setAlpha();
|
||||
current.incrementPosition(4);
|
||||
}
|
||||
return new BlockParsedResult();
|
||||
return new BlockParsedRXingResult();
|
||||
}
|
||||
|
||||
private BlockParsedResult parseIsoIec646Block() throws FormatException {
|
||||
private BlockParsedRXingResult parseIsoIec646Block() throws FormatException {
|
||||
while (isStillIsoIec646(current.getPosition())) {
|
||||
DecodedChar iso = decodeIsoIec646(current.getPosition());
|
||||
current.setPosition(iso.getNewPosition());
|
||||
|
||||
if (iso.isFNC1()) {
|
||||
DecodedInformation information = new DecodedInformation(current.getPosition(), buffer.toString());
|
||||
return new BlockParsedResult(information, true);
|
||||
return new BlockParsedRXingResult(information, true);
|
||||
}
|
||||
buffer.append(iso.getValue());
|
||||
}
|
||||
@@ -212,17 +212,17 @@ final class GeneralAppIdDecoder {
|
||||
|
||||
current.setAlpha();
|
||||
}
|
||||
return new BlockParsedResult();
|
||||
return new BlockParsedRXingResult();
|
||||
}
|
||||
|
||||
private BlockParsedResult parseAlphaBlock() {
|
||||
private BlockParsedRXingResult parseAlphaBlock() {
|
||||
while (isStillAlpha(current.getPosition())) {
|
||||
DecodedChar alpha = decodeAlphanumeric(current.getPosition());
|
||||
current.setPosition(alpha.getNewPosition());
|
||||
|
||||
if (alpha.isFNC1()) {
|
||||
DecodedInformation information = new DecodedInformation(current.getPosition(), buffer.toString());
|
||||
return new BlockParsedResult(information, true); //end of the char block
|
||||
return new BlockParsedRXingResult(information, true); //end of the char block
|
||||
}
|
||||
|
||||
buffer.append(alpha.getValue());
|
||||
@@ -240,7 +240,7 @@ final class GeneralAppIdDecoder {
|
||||
|
||||
current.setIsoIec646();
|
||||
}
|
||||
return new BlockParsedResult();
|
||||
return new BlockParsedRXingResult();
|
||||
}
|
||||
|
||||
private boolean isStillIsoIec646(int pos) {
|
||||
|
||||
Reference in New Issue
Block a user