mirror of
https://github.com/starovoid/rxing.git
synced 2026-07-26 20:32:34 +00:00
move all Result to RXingResult
This commit is contained in:
@@ -22,7 +22,7 @@ import com.google.zxing.ChecksumException;
|
||||
import com.google.zxing.DecodeHintType;
|
||||
import com.google.zxing.FormatException;
|
||||
import com.google.zxing.NotFoundException;
|
||||
import com.google.zxing.Result;
|
||||
import com.google.zxing.RXingResult;
|
||||
import com.google.zxing.common.BitArray;
|
||||
|
||||
import java.util.Map;
|
||||
@@ -38,29 +38,29 @@ public final class UPCAReader extends UPCEANReader {
|
||||
private final UPCEANReader ean13Reader = new EAN13Reader();
|
||||
|
||||
@Override
|
||||
public Result decodeRow(int rowNumber,
|
||||
public RXingResult decodeRow(int rowNumber,
|
||||
BitArray row,
|
||||
int[] startGuardRange,
|
||||
Map<DecodeHintType,?> hints)
|
||||
throws NotFoundException, FormatException, ChecksumException {
|
||||
return maybeReturnResult(ean13Reader.decodeRow(rowNumber, row, startGuardRange, hints));
|
||||
return maybeReturnRXingResult(ean13Reader.decodeRow(rowNumber, row, startGuardRange, hints));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result decodeRow(int rowNumber, BitArray row, Map<DecodeHintType,?> hints)
|
||||
public RXingResult decodeRow(int rowNumber, BitArray row, Map<DecodeHintType,?> hints)
|
||||
throws NotFoundException, FormatException, ChecksumException {
|
||||
return maybeReturnResult(ean13Reader.decodeRow(rowNumber, row, hints));
|
||||
return maybeReturnRXingResult(ean13Reader.decodeRow(rowNumber, row, hints));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result decode(BinaryBitmap image) throws NotFoundException, FormatException {
|
||||
return maybeReturnResult(ean13Reader.decode(image));
|
||||
public RXingResult decode(BinaryBitmap image) throws NotFoundException, FormatException {
|
||||
return maybeReturnRXingResult(ean13Reader.decode(image));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result decode(BinaryBitmap image, Map<DecodeHintType,?> hints)
|
||||
public RXingResult decode(BinaryBitmap image, Map<DecodeHintType,?> hints)
|
||||
throws NotFoundException, FormatException {
|
||||
return maybeReturnResult(ean13Reader.decode(image, hints));
|
||||
return maybeReturnRXingResult(ean13Reader.decode(image, hints));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -74,14 +74,14 @@ public final class UPCAReader extends UPCEANReader {
|
||||
return ean13Reader.decodeMiddle(row, startRange, resultString);
|
||||
}
|
||||
|
||||
private static Result maybeReturnResult(Result result) throws FormatException {
|
||||
private static RXingResult maybeReturnRXingResult(RXingResult result) throws FormatException {
|
||||
String text = result.getText();
|
||||
if (text.charAt(0) == '0') {
|
||||
Result upcaResult = new Result(text.substring(1), null, result.getResultPoints(), BarcodeFormat.UPC_A);
|
||||
if (result.getResultMetadata() != null) {
|
||||
upcaResult.putAllMetadata(result.getResultMetadata());
|
||||
RXingResult upcaRXingResult = new RXingResult(text.substring(1), null, result.getRXingResultPoints(), BarcodeFormat.UPC_A);
|
||||
if (result.getRXingResultMetadata() != null) {
|
||||
upcaRXingResult.putAllMetadata(result.getRXingResultMetadata());
|
||||
}
|
||||
return upcaResult;
|
||||
return upcaRXingResult;
|
||||
} else {
|
||||
throw FormatException.getFormatInstance();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user