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

152 lines
6.5 KiB
Java

package com.google.zxing.datamatrix.encoder;
import androidx.compose.runtime.ComposerKt;
import androidx.core.location.LocationRequestCompat;
import com.google.zxing.Dimension;
/* loaded from: classes3.dex */
public class SymbolInfo {
static final SymbolInfo[] PROD_SYMBOLS;
private static SymbolInfo[] symbols;
private final int dataCapacity;
private final int dataRegions;
private final int errorCodewords;
public final int matrixHeight;
public final int matrixWidth;
private final boolean rectangular;
private final int rsBlockData;
private final int rsBlockError;
public static void overrideSymbolSet(SymbolInfo[] symbolInfoArr) {
symbols = symbolInfoArr;
}
public int getCodewordCount() {
return this.dataCapacity + this.errorCodewords;
}
public final int getDataCapacity() {
return this.dataCapacity;
}
public int getDataLengthForInterleavedBlock(int i) {
return this.rsBlockData;
}
public final int getErrorCodewords() {
return this.errorCodewords;
}
public final int getErrorLengthForInterleavedBlock(int i) {
return this.rsBlockError;
}
static {
SymbolInfo[] symbolInfoArr = {new SymbolInfo(false, 3, 5, 8, 8, 1), new SymbolInfo(false, 5, 7, 10, 10, 1), new SymbolInfo(true, 5, 7, 16, 6, 1), new SymbolInfo(false, 8, 10, 12, 12, 1), new SymbolInfo(true, 10, 11, 14, 6, 2), new SymbolInfo(false, 12, 12, 14, 14, 1), new SymbolInfo(true, 16, 14, 24, 10, 1), new SymbolInfo(false, 18, 14, 16, 16, 1), new SymbolInfo(false, 22, 18, 18, 18, 1), new SymbolInfo(true, 22, 18, 16, 10, 2), new SymbolInfo(false, 30, 20, 20, 20, 1), new SymbolInfo(true, 32, 24, 16, 14, 2), new SymbolInfo(false, 36, 24, 22, 22, 1), new SymbolInfo(false, 44, 28, 24, 24, 1), new SymbolInfo(true, 49, 28, 22, 14, 2), new SymbolInfo(false, 62, 36, 14, 14, 4), new SymbolInfo(false, 86, 42, 16, 16, 4), new SymbolInfo(false, 114, 48, 18, 18, 4), new SymbolInfo(false, 144, 56, 20, 20, 4), new SymbolInfo(false, 174, 68, 22, 22, 4), new SymbolInfo(false, ComposerKt.providerMapsKey, 84, 24, 24, 4, LocationRequestCompat.QUALITY_BALANCED_POWER_ACCURACY, 42), new SymbolInfo(false, 280, 112, 14, 14, 16, 140, 56), new SymbolInfo(false, 368, 144, 16, 16, 16, 92, 36), new SymbolInfo(false, 456, 192, 18, 18, 16, 114, 48), new SymbolInfo(false, 576, 224, 20, 20, 16, 144, 56), new SymbolInfo(false, 696, 272, 22, 22, 16, 174, 68), new SymbolInfo(false, 816, 336, 24, 24, 16, 136, 56), new SymbolInfo(false, 1050, 408, 18, 18, 36, 175, 68), new SymbolInfo(false, 1304, 496, 20, 20, 36, 163, 62), new DataMatrixSymbolInfo144()};
PROD_SYMBOLS = symbolInfoArr;
symbols = symbolInfoArr;
}
public SymbolInfo(boolean z, int i, int i2, int i3, int i4, int i5) {
this(z, i, i2, i3, i4, i5, i, i2);
}
/* JADX INFO: Access modifiers changed from: package-private */
public SymbolInfo(boolean z, int i, int i2, int i3, int i4, int i5, int i6, int i7) {
this.rectangular = z;
this.dataCapacity = i;
this.errorCodewords = i2;
this.matrixWidth = i3;
this.matrixHeight = i4;
this.dataRegions = i5;
this.rsBlockData = i6;
this.rsBlockError = i7;
}
public static SymbolInfo lookup(int i) {
return lookup(i, SymbolShapeHint.FORCE_NONE, true);
}
public static SymbolInfo lookup(int i, SymbolShapeHint symbolShapeHint) {
return lookup(i, symbolShapeHint, true);
}
public static SymbolInfo lookup(int i, boolean z, boolean z2) {
return lookup(i, z ? SymbolShapeHint.FORCE_NONE : SymbolShapeHint.FORCE_SQUARE, z2);
}
private static SymbolInfo lookup(int i, SymbolShapeHint symbolShapeHint, boolean z) {
return lookup(i, symbolShapeHint, null, null, z);
}
public static SymbolInfo lookup(int i, SymbolShapeHint symbolShapeHint, Dimension dimension, Dimension dimension2, boolean z) {
for (SymbolInfo symbolInfo : symbols) {
if (!(symbolShapeHint == SymbolShapeHint.FORCE_SQUARE && symbolInfo.rectangular) && ((symbolShapeHint != SymbolShapeHint.FORCE_RECTANGLE || symbolInfo.rectangular) && ((dimension == null || (symbolInfo.getSymbolWidth() >= dimension.getWidth() && symbolInfo.getSymbolHeight() >= dimension.getHeight())) && ((dimension2 == null || (symbolInfo.getSymbolWidth() <= dimension2.getWidth() && symbolInfo.getSymbolHeight() <= dimension2.getHeight())) && i <= symbolInfo.dataCapacity)))) {
return symbolInfo;
}
}
if (z) {
throw new IllegalArgumentException("Can't find a symbol arrangement that matches the message. Data codewords: ".concat(String.valueOf(i)));
}
return null;
}
private int getHorizontalDataRegions() {
int i = this.dataRegions;
int i2 = 1;
if (i != 1) {
i2 = 2;
if (i != 2 && i != 4) {
if (i == 16) {
return 4;
}
if (i == 36) {
return 6;
}
throw new IllegalStateException("Cannot handle this number of data regions");
}
}
return i2;
}
private int getVerticalDataRegions() {
int i = this.dataRegions;
if (i == 1 || i == 2) {
return 1;
}
if (i == 4) {
return 2;
}
if (i == 16) {
return 4;
}
if (i == 36) {
return 6;
}
throw new IllegalStateException("Cannot handle this number of data regions");
}
public final int getSymbolDataWidth() {
return getHorizontalDataRegions() * this.matrixWidth;
}
public final int getSymbolDataHeight() {
return getVerticalDataRegions() * this.matrixHeight;
}
public final int getSymbolWidth() {
return getSymbolDataWidth() + (getHorizontalDataRegions() << 1);
}
public final int getSymbolHeight() {
return getSymbolDataHeight() + (getVerticalDataRegions() << 1);
}
public int getInterleavedBlockCount() {
return this.dataCapacity / this.rsBlockData;
}
public final String toString() {
return (this.rectangular ? "Rectangular Symbol:" : "Square Symbol:") + " data region " + this.matrixWidth + 'x' + this.matrixHeight + ", symbol size " + getSymbolWidth() + 'x' + getSymbolHeight() + ", symbol data size " + getSymbolDataWidth() + 'x' + getSymbolDataHeight() + ", codewords " + this.dataCapacity + '+' + this.errorCodewords;
}
}