move all Result to RXingResult

This commit is contained in:
Henry Schimke
2022-08-20 12:12:30 -05:00
parent 9f72478dc8
commit 90ace738b7
149 changed files with 1658 additions and 1658 deletions

View File

@@ -65,12 +65,12 @@ final class DataBlock {
// Now establish DataBlocks of the appropriate size and number of data codewords
DataBlock[] result = new DataBlock[totalBlocks];
int numResultBlocks = 0;
int numRXingResultBlocks = 0;
for (Version.ECB ecBlock : ecBlockArray) {
for (int i = 0; i < ecBlock.getCount(); i++) {
int numDataCodewords = ecBlock.getDataCodewords();
int numBlockCodewords = ecBlocks.getECCodewordsPerBlock() + numDataCodewords;
result[numResultBlocks++] = new DataBlock(numDataCodewords, new byte[numBlockCodewords]);
result[numRXingResultBlocks++] = new DataBlock(numDataCodewords, new byte[numBlockCodewords]);
}
}
@@ -92,18 +92,18 @@ final class DataBlock {
// first fill out as many elements as all of them have
int rawCodewordsOffset = 0;
for (int i = 0; i < shorterBlocksNumDataCodewords; i++) {
for (int j = 0; j < numResultBlocks; j++) {
for (int j = 0; j < numRXingResultBlocks; j++) {
result[j].codewords[i] = rawCodewords[rawCodewordsOffset++];
}
}
// Fill out the last data block in the longer ones
for (int j = longerBlocksStartAt; j < numResultBlocks; j++) {
for (int j = longerBlocksStartAt; j < numRXingResultBlocks; j++) {
result[j].codewords[shorterBlocksNumDataCodewords] = rawCodewords[rawCodewordsOffset++];
}
// Now add in error correction blocks
int max = result[0].codewords.length;
for (int i = shorterBlocksNumDataCodewords; i < max; i++) {
for (int j = 0; j < numResultBlocks; j++) {
for (int j = 0; j < numRXingResultBlocks; j++) {
int iOffset = j < longerBlocksStartAt ? i : i + 1;
result[j].codewords[iOffset] = rawCodewords[rawCodewordsOffset++];
}

View File

@@ -20,7 +20,7 @@ import com.google.zxing.DecodeHintType;
import com.google.zxing.FormatException;
import com.google.zxing.common.BitSource;
import com.google.zxing.common.CharacterSetECI;
import com.google.zxing.common.DecoderResult;
import com.google.zxing.common.DecoderRXingResult;
import com.google.zxing.common.StringUtils;
import java.nio.charset.Charset;
@@ -49,7 +49,7 @@ final class DecodedBitStreamParser {
private DecodedBitStreamParser() {
}
static DecoderResult decode(byte[] bytes,
static DecoderRXingResult decode(byte[] bytes,
Version version,
ErrorCorrectionLevel ecLevel,
Map<DecodeHintType,?> hints) throws FormatException {
@@ -160,7 +160,7 @@ final class DecodedBitStreamParser {
throw FormatException.getFormatInstance();
}
return new DecoderResult(bytes,
return new DecoderRXingResult(bytes,
result.toString(),
byteSegments.isEmpty() ? null : byteSegments,
ecLevel == null ? null : ecLevel.toString(),

View File

@@ -20,7 +20,7 @@ import com.google.zxing.ChecksumException;
import com.google.zxing.DecodeHintType;
import com.google.zxing.FormatException;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.common.DecoderResult;
import com.google.zxing.common.DecoderRXingResult;
import com.google.zxing.common.reedsolomon.GenericGF;
import com.google.zxing.common.reedsolomon.ReedSolomonDecoder;
import com.google.zxing.common.reedsolomon.ReedSolomonException;
@@ -41,7 +41,7 @@ public final class Decoder {
rsDecoder = new ReedSolomonDecoder(GenericGF.QR_CODE_FIELD_256);
}
public DecoderResult decode(boolean[][] image) throws ChecksumException, FormatException {
public DecoderRXingResult decode(boolean[][] image) throws ChecksumException, FormatException {
return decode(image, null);
}
@@ -55,12 +55,12 @@ public final class Decoder {
* @throws FormatException if the QR Code cannot be decoded
* @throws ChecksumException if error correction fails
*/
public DecoderResult decode(boolean[][] image, Map<DecodeHintType,?> hints)
public DecoderRXingResult decode(boolean[][] image, Map<DecodeHintType,?> hints)
throws ChecksumException, FormatException {
return decode(BitMatrix.parse(image), hints);
}
public DecoderResult decode(BitMatrix bits) throws ChecksumException, FormatException {
public DecoderRXingResult decode(BitMatrix bits) throws ChecksumException, FormatException {
return decode(bits, null);
}
@@ -73,7 +73,7 @@ public final class Decoder {
* @throws FormatException if the QR Code cannot be decoded
* @throws ChecksumException if error correction fails
*/
public DecoderResult decode(BitMatrix bits, Map<DecodeHintType,?> hints)
public DecoderRXingResult decode(BitMatrix bits, Map<DecodeHintType,?> hints)
throws FormatException, ChecksumException {
// Construct a parser and read version, error-correction level
@@ -111,7 +111,7 @@ public final class Decoder {
// Prepare for a mirrored reading.
parser.mirror();
DecoderResult result = decode(parser, hints);
DecoderRXingResult result = decode(parser, hints);
// Success! Notify the caller that the code was mirrored.
result.setOther(new QRCodeDecoderMetaData(true));
@@ -127,7 +127,7 @@ public final class Decoder {
}
}
private DecoderResult decode(BitMatrixParser parser, Map<DecodeHintType,?> hints)
private DecoderRXingResult decode(BitMatrixParser parser, Map<DecodeHintType,?> hints)
throws FormatException, ChecksumException {
Version version = parser.readVersion();
ErrorCorrectionLevel ecLevel = parser.readFormatInformation().getErrorCorrectionLevel();

View File

@@ -16,13 +16,13 @@
package com.google.zxing.qrcode.decoder;
import com.google.zxing.ResultPoint;
import com.google.zxing.RXingResultPoint;
/**
* Meta-data container for QR Code decoding. Instances of this class may be used to convey information back to the
* decoding caller. Callers are expected to process this.
*
* @see com.google.zxing.common.DecoderResult#getOther()
* @see com.google.zxing.common.DecoderRXingResult#getOther()
*/
public final class QRCodeDecoderMetaData {
@@ -44,11 +44,11 @@ public final class QRCodeDecoderMetaData {
*
* @param points Array of points to apply mirror correction to.
*/
public void applyMirroredCorrection(ResultPoint[] points) {
public void applyMirroredCorrection(RXingResultPoint[] points) {
if (!mirrored || points == null || points.length < 3) {
return;
}
ResultPoint bottomLeft = points[0];
RXingResultPoint bottomLeft = points[0];
points[0] = points[2];
points[2] = bottomLeft;
// No need to 'fix' top-left and alignment pattern.