Rabbit-R1/android (non root)/java/sources/com/google/zxing/pdf417/decoder/DetectionResultColumn.java
2024-05-21 17:08:36 -04:00

93 lines
3.3 KiB
Java

package com.google.zxing.pdf417.decoder;
import java.util.Formatter;
/* loaded from: classes3.dex */
class DetectionResultColumn {
private static final int MAX_NEARBY_DISTANCE = 5;
private final BoundingBox boundingBox;
private final Codeword[] codewords;
/* JADX INFO: Access modifiers changed from: package-private */
public final BoundingBox getBoundingBox() {
return this.boundingBox;
}
/* JADX INFO: Access modifiers changed from: package-private */
public final Codeword[] getCodewords() {
return this.codewords;
}
/* JADX INFO: Access modifiers changed from: package-private */
public DetectionResultColumn(BoundingBox boundingBox) {
this.boundingBox = new BoundingBox(boundingBox);
this.codewords = new Codeword[(boundingBox.getMaxY() - boundingBox.getMinY()) + 1];
}
/* JADX INFO: Access modifiers changed from: package-private */
public final Codeword getCodewordNearby(int i) {
Codeword codeword;
Codeword codeword2;
Codeword codeword3 = getCodeword(i);
if (codeword3 != null) {
return codeword3;
}
for (int i2 = 1; i2 < 5; i2++) {
int imageRowToCodewordIndex = imageRowToCodewordIndex(i) - i2;
if (imageRowToCodewordIndex >= 0 && (codeword2 = this.codewords[imageRowToCodewordIndex]) != null) {
return codeword2;
}
int imageRowToCodewordIndex2 = imageRowToCodewordIndex(i) + i2;
Codeword[] codewordArr = this.codewords;
if (imageRowToCodewordIndex2 < codewordArr.length && (codeword = codewordArr[imageRowToCodewordIndex2]) != null) {
return codeword;
}
}
return null;
}
/* JADX INFO: Access modifiers changed from: package-private */
public final int imageRowToCodewordIndex(int i) {
return i - this.boundingBox.getMinY();
}
/* JADX INFO: Access modifiers changed from: package-private */
public final void setCodeword(int i, Codeword codeword) {
this.codewords[imageRowToCodewordIndex(i)] = codeword;
}
/* JADX INFO: Access modifiers changed from: package-private */
public final Codeword getCodeword(int i) {
return this.codewords[imageRowToCodewordIndex(i)];
}
public String toString() {
Formatter formatter = new Formatter();
try {
int i = 0;
for (Codeword codeword : this.codewords) {
if (codeword == null) {
formatter.format("%3d: | %n", Integer.valueOf(i));
i++;
} else {
formatter.format("%3d: %3d|%3d%n", Integer.valueOf(i), Integer.valueOf(codeword.getRowNumber()), Integer.valueOf(codeword.getValue()));
i++;
}
}
String formatter2 = formatter.toString();
formatter.close();
return formatter2;
} catch (Throwable th) {
try {
throw th;
} catch (Throwable th2) {
try {
formatter.close();
} catch (Throwable th3) {
th.addSuppressed(th3);
}
throw th2;
}
}
}
}