Initial commit
This commit is contained in:
244
sources/com/google/zxing/oned/CodaBarReader.java
Normal file
244
sources/com/google/zxing/oned/CodaBarReader.java
Normal file
@@ -0,0 +1,244 @@
|
||||
package com.google.zxing.oned;
|
||||
|
||||
import com.google.zxing.BarcodeFormat;
|
||||
import com.google.zxing.DecodeHintType;
|
||||
import com.google.zxing.NotFoundException;
|
||||
import com.google.zxing.Result;
|
||||
import com.google.zxing.ResultPoint;
|
||||
import com.google.zxing.common.BitArray;
|
||||
import com.ubtrobot.jimu.robotapi.PeripheralType;
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class CodaBarReader extends OneDReader {
|
||||
static final char[] d = "0123456789-$:/.+ABCD".toCharArray();
|
||||
static final int[] e = {3, 6, 9, 96, 18, 66, 33, 36, 48, 72, 12, 24, 69, 81, 84, 21, 26, 41, 11, 14};
|
||||
private static final char[] f = {'A', 'B', 'C', 'D'};
|
||||
private final StringBuilder a = new StringBuilder(20);
|
||||
private int[] b = new int[80];
|
||||
private int c = 0;
|
||||
|
||||
private int b(int i) {
|
||||
int i2 = i + 7;
|
||||
if (i2 >= this.c) {
|
||||
return -1;
|
||||
}
|
||||
int[] iArr = this.b;
|
||||
int i3 = Integer.MAX_VALUE;
|
||||
int i4 = 0;
|
||||
int i5 = Integer.MAX_VALUE;
|
||||
int i6 = 0;
|
||||
for (int i7 = i; i7 < i2; i7 += 2) {
|
||||
int i8 = iArr[i7];
|
||||
if (i8 < i5) {
|
||||
i5 = i8;
|
||||
}
|
||||
if (i8 > i6) {
|
||||
i6 = i8;
|
||||
}
|
||||
}
|
||||
int i9 = (i5 + i6) / 2;
|
||||
int i10 = 0;
|
||||
for (int i11 = i + 1; i11 < i2; i11 += 2) {
|
||||
int i12 = iArr[i11];
|
||||
if (i12 < i3) {
|
||||
i3 = i12;
|
||||
}
|
||||
if (i12 > i10) {
|
||||
i10 = i12;
|
||||
}
|
||||
}
|
||||
int i13 = (i3 + i10) / 2;
|
||||
int i14 = PeripheralType.SERVO;
|
||||
int i15 = 0;
|
||||
for (int i16 = 0; i16 < 7; i16++) {
|
||||
i14 >>= 1;
|
||||
if (iArr[i + i16] > ((i16 & 1) == 0 ? i9 : i13)) {
|
||||
i15 |= i14;
|
||||
}
|
||||
}
|
||||
while (true) {
|
||||
int[] iArr2 = e;
|
||||
if (i4 >= iArr2.length) {
|
||||
return -1;
|
||||
}
|
||||
if (iArr2[i4] == i15) {
|
||||
return i4;
|
||||
}
|
||||
i4++;
|
||||
}
|
||||
}
|
||||
|
||||
private void c(int i) throws NotFoundException {
|
||||
int[] iArr = {0, 0, 0, 0};
|
||||
int[] iArr2 = {0, 0, 0, 0};
|
||||
int length = this.a.length() - 1;
|
||||
int i2 = 0;
|
||||
int i3 = i;
|
||||
int i4 = 0;
|
||||
while (true) {
|
||||
int i5 = e[this.a.charAt(i4)];
|
||||
for (int i6 = 6; i6 >= 0; i6--) {
|
||||
int i7 = (i6 & 1) + ((i5 & 1) << 1);
|
||||
iArr[i7] = iArr[i7] + this.b[i3 + i6];
|
||||
iArr2[i7] = iArr2[i7] + 1;
|
||||
i5 >>= 1;
|
||||
}
|
||||
if (i4 >= length) {
|
||||
break;
|
||||
}
|
||||
i3 += 8;
|
||||
i4++;
|
||||
}
|
||||
float[] fArr = new float[4];
|
||||
float[] fArr2 = new float[4];
|
||||
for (int i8 = 0; i8 < 2; i8++) {
|
||||
fArr2[i8] = 0.0f;
|
||||
int i9 = i8 + 2;
|
||||
fArr2[i9] = ((iArr[i8] / iArr2[i8]) + (iArr[i9] / iArr2[i9])) / 2.0f;
|
||||
fArr[i8] = fArr2[i9];
|
||||
fArr[i9] = ((iArr[i9] * 2.0f) + 1.5f) / iArr2[i9];
|
||||
}
|
||||
loop3: while (true) {
|
||||
int i10 = e[this.a.charAt(i2)];
|
||||
for (int i11 = 6; i11 >= 0; i11--) {
|
||||
int i12 = (i11 & 1) + ((i10 & 1) << 1);
|
||||
float f2 = this.b[i + i11];
|
||||
if (f2 < fArr2[i12] || f2 > fArr[i12]) {
|
||||
break loop3;
|
||||
}
|
||||
i10 >>= 1;
|
||||
}
|
||||
if (i2 >= length) {
|
||||
return;
|
||||
}
|
||||
i += 8;
|
||||
i2++;
|
||||
}
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.oned.OneDReader
|
||||
public Result a(int i, BitArray bitArray, Map<DecodeHintType, ?> map) throws NotFoundException {
|
||||
Arrays.fill(this.b, 0);
|
||||
a(bitArray);
|
||||
int a = a();
|
||||
this.a.setLength(0);
|
||||
int i2 = a;
|
||||
do {
|
||||
int b = b(i2);
|
||||
if (b == -1) {
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
this.a.append((char) b);
|
||||
i2 += 8;
|
||||
if (this.a.length() > 1 && a(f, d[b])) {
|
||||
break;
|
||||
}
|
||||
} while (i2 < this.c);
|
||||
int i3 = i2 - 1;
|
||||
int i4 = this.b[i3];
|
||||
int i5 = 0;
|
||||
for (int i6 = -8; i6 < -1; i6++) {
|
||||
i5 += this.b[i2 + i6];
|
||||
}
|
||||
if (i2 < this.c && i4 < i5 / 2) {
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
c(a);
|
||||
for (int i7 = 0; i7 < this.a.length(); i7++) {
|
||||
StringBuilder sb = this.a;
|
||||
sb.setCharAt(i7, d[sb.charAt(i7)]);
|
||||
}
|
||||
if (!a(f, this.a.charAt(0))) {
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
StringBuilder sb2 = this.a;
|
||||
if (!a(f, sb2.charAt(sb2.length() - 1))) {
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
if (this.a.length() <= 3) {
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
if (map == null || !map.containsKey(DecodeHintType.RETURN_CODABAR_START_END)) {
|
||||
StringBuilder sb3 = this.a;
|
||||
sb3.deleteCharAt(sb3.length() - 1);
|
||||
this.a.deleteCharAt(0);
|
||||
}
|
||||
int i8 = 0;
|
||||
for (int i9 = 0; i9 < a; i9++) {
|
||||
i8 += this.b[i9];
|
||||
}
|
||||
float f2 = i8;
|
||||
while (a < i3) {
|
||||
i8 += this.b[a];
|
||||
a++;
|
||||
}
|
||||
float f3 = i;
|
||||
return new Result(this.a.toString(), null, new ResultPoint[]{new ResultPoint(f2, f3), new ResultPoint(i8, f3)}, BarcodeFormat.CODABAR);
|
||||
}
|
||||
|
||||
private void a(BitArray bitArray) throws NotFoundException {
|
||||
int i = 0;
|
||||
this.c = 0;
|
||||
int c = bitArray.c(0);
|
||||
int h = bitArray.h();
|
||||
if (c < h) {
|
||||
boolean z = true;
|
||||
while (c < h) {
|
||||
if (bitArray.a(c) != z) {
|
||||
i++;
|
||||
} else {
|
||||
a(i);
|
||||
z = !z;
|
||||
i = 1;
|
||||
}
|
||||
c++;
|
||||
}
|
||||
a(i);
|
||||
return;
|
||||
}
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
|
||||
private void a(int i) {
|
||||
int[] iArr = this.b;
|
||||
int i2 = this.c;
|
||||
iArr[i2] = i;
|
||||
this.c = i2 + 1;
|
||||
int i3 = this.c;
|
||||
if (i3 >= iArr.length) {
|
||||
int[] iArr2 = new int[i3 << 1];
|
||||
System.arraycopy(iArr, 0, iArr2, 0, i3);
|
||||
this.b = iArr2;
|
||||
}
|
||||
}
|
||||
|
||||
private int a() throws NotFoundException {
|
||||
for (int i = 1; i < this.c; i += 2) {
|
||||
int b = b(i);
|
||||
if (b != -1 && a(f, d[b])) {
|
||||
int i2 = 0;
|
||||
for (int i3 = i; i3 < i + 7; i3++) {
|
||||
i2 += this.b[i3];
|
||||
}
|
||||
if (i == 1 || this.b[i - 1] >= i2 / 2) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
|
||||
static boolean a(char[] cArr, char c) {
|
||||
if (cArr != null) {
|
||||
for (char c2 : cArr) {
|
||||
if (c2 == c) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
99
sources/com/google/zxing/oned/CodaBarWriter.java
Normal file
99
sources/com/google/zxing/oned/CodaBarWriter.java
Normal file
@@ -0,0 +1,99 @@
|
||||
package com.google.zxing.oned;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class CodaBarWriter extends OneDimensionalCodeWriter {
|
||||
private static final char[] a = {'A', 'B', 'C', 'D'};
|
||||
private static final char[] b = {'T', 'N', '*', 'E'};
|
||||
private static final char[] c = {'/', ':', '+', '.'};
|
||||
private static final char d = a[0];
|
||||
|
||||
@Override // com.google.zxing.oned.OneDimensionalCodeWriter
|
||||
public boolean[] a(String str) {
|
||||
int i;
|
||||
if (str.length() < 2) {
|
||||
str = d + str + d;
|
||||
} else {
|
||||
char upperCase = Character.toUpperCase(str.charAt(0));
|
||||
char upperCase2 = Character.toUpperCase(str.charAt(str.length() - 1));
|
||||
boolean a2 = CodaBarReader.a(a, upperCase);
|
||||
boolean a3 = CodaBarReader.a(a, upperCase2);
|
||||
boolean a4 = CodaBarReader.a(b, upperCase);
|
||||
boolean a5 = CodaBarReader.a(b, upperCase2);
|
||||
if (a2) {
|
||||
if (!a3) {
|
||||
throw new IllegalArgumentException("Invalid start/end guards: ".concat(String.valueOf(str)));
|
||||
}
|
||||
} else if (!a4) {
|
||||
if (a3 || a5) {
|
||||
throw new IllegalArgumentException("Invalid start/end guards: ".concat(String.valueOf(str)));
|
||||
}
|
||||
str = d + str + d;
|
||||
} else if (!a5) {
|
||||
throw new IllegalArgumentException("Invalid start/end guards: ".concat(String.valueOf(str)));
|
||||
}
|
||||
}
|
||||
int i2 = 20;
|
||||
for (int i3 = 1; i3 < str.length() - 1; i3++) {
|
||||
if (Character.isDigit(str.charAt(i3)) || str.charAt(i3) == '-' || str.charAt(i3) == '$') {
|
||||
i2 += 9;
|
||||
} else {
|
||||
if (!CodaBarReader.a(c, str.charAt(i3))) {
|
||||
throw new IllegalArgumentException("Cannot encode : '" + str.charAt(i3) + '\'');
|
||||
}
|
||||
i2 += 10;
|
||||
}
|
||||
}
|
||||
boolean[] zArr = new boolean[i2 + (str.length() - 1)];
|
||||
int i4 = 0;
|
||||
for (int i5 = 0; i5 < str.length(); i5++) {
|
||||
char upperCase3 = Character.toUpperCase(str.charAt(i5));
|
||||
if (i5 == 0 || i5 == str.length() - 1) {
|
||||
if (upperCase3 == '*') {
|
||||
upperCase3 = 'C';
|
||||
} else if (upperCase3 == 'E') {
|
||||
upperCase3 = 'D';
|
||||
} else if (upperCase3 == 'N') {
|
||||
upperCase3 = 'B';
|
||||
} else if (upperCase3 == 'T') {
|
||||
upperCase3 = 'A';
|
||||
}
|
||||
}
|
||||
int i6 = 0;
|
||||
while (true) {
|
||||
char[] cArr = CodaBarReader.d;
|
||||
if (i6 >= cArr.length) {
|
||||
i = 0;
|
||||
break;
|
||||
}
|
||||
if (upperCase3 == cArr[i6]) {
|
||||
i = CodaBarReader.e[i6];
|
||||
break;
|
||||
}
|
||||
i6++;
|
||||
}
|
||||
int i7 = i4;
|
||||
int i8 = 0;
|
||||
boolean z = true;
|
||||
while (true) {
|
||||
int i9 = 0;
|
||||
while (i8 < 7) {
|
||||
zArr[i7] = z;
|
||||
i7++;
|
||||
if (((i >> (6 - i8)) & 1) == 0 || i9 == 1) {
|
||||
z = !z;
|
||||
i8++;
|
||||
} else {
|
||||
i9++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (i5 < str.length() - 1) {
|
||||
zArr[i7] = false;
|
||||
i7++;
|
||||
}
|
||||
i4 = i7;
|
||||
}
|
||||
return zArr;
|
||||
}
|
||||
}
|
128
sources/com/google/zxing/oned/Code128Reader.java
Normal file
128
sources/com/google/zxing/oned/Code128Reader.java
Normal file
@@ -0,0 +1,128 @@
|
||||
package com.google.zxing.oned;
|
||||
|
||||
import com.google.zxing.NotFoundException;
|
||||
import com.google.zxing.common.BitArray;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class Code128Reader extends OneDReader {
|
||||
static final int[][] a = {new int[]{2, 1, 2, 2, 2, 2}, new int[]{2, 2, 2, 1, 2, 2}, new int[]{2, 2, 2, 2, 2, 1}, new int[]{1, 2, 1, 2, 2, 3}, new int[]{1, 2, 1, 3, 2, 2}, new int[]{1, 3, 1, 2, 2, 2}, new int[]{1, 2, 2, 2, 1, 3}, new int[]{1, 2, 2, 3, 1, 2}, new int[]{1, 3, 2, 2, 1, 2}, new int[]{2, 2, 1, 2, 1, 3}, new int[]{2, 2, 1, 3, 1, 2}, new int[]{2, 3, 1, 2, 1, 2}, new int[]{1, 1, 2, 2, 3, 2}, new int[]{1, 2, 2, 1, 3, 2}, new int[]{1, 2, 2, 2, 3, 1}, new int[]{1, 1, 3, 2, 2, 2}, new int[]{1, 2, 3, 1, 2, 2}, new int[]{1, 2, 3, 2, 2, 1}, new int[]{2, 2, 3, 2, 1, 1}, new int[]{2, 2, 1, 1, 3, 2}, new int[]{2, 2, 1, 2, 3, 1}, new int[]{2, 1, 3, 2, 1, 2}, new int[]{2, 2, 3, 1, 1, 2}, new int[]{3, 1, 2, 1, 3, 1}, new int[]{3, 1, 1, 2, 2, 2}, new int[]{3, 2, 1, 1, 2, 2}, new int[]{3, 2, 1, 2, 2, 1}, new int[]{3, 1, 2, 2, 1, 2}, new int[]{3, 2, 2, 1, 1, 2}, new int[]{3, 2, 2, 2, 1, 1}, new int[]{2, 1, 2, 1, 2, 3}, new int[]{2, 1, 2, 3, 2, 1}, new int[]{2, 3, 2, 1, 2, 1}, new int[]{1, 1, 1, 3, 2, 3}, new int[]{1, 3, 1, 1, 2, 3}, new int[]{1, 3, 1, 3, 2, 1}, new int[]{1, 1, 2, 3, 1, 3}, new int[]{1, 3, 2, 1, 1, 3}, new int[]{1, 3, 2, 3, 1, 1}, new int[]{2, 1, 1, 3, 1, 3}, new int[]{2, 3, 1, 1, 1, 3}, new int[]{2, 3, 1, 3, 1, 1}, new int[]{1, 1, 2, 1, 3, 3}, new int[]{1, 1, 2, 3, 3, 1}, new int[]{1, 3, 2, 1, 3, 1}, new int[]{1, 1, 3, 1, 2, 3}, new int[]{1, 1, 3, 3, 2, 1}, new int[]{1, 3, 3, 1, 2, 1}, new int[]{3, 1, 3, 1, 2, 1}, new int[]{2, 1, 1, 3, 3, 1}, new int[]{2, 3, 1, 1, 3, 1}, new int[]{2, 1, 3, 1, 1, 3}, new int[]{2, 1, 3, 3, 1, 1}, new int[]{2, 1, 3, 1, 3, 1}, new int[]{3, 1, 1, 1, 2, 3}, new int[]{3, 1, 1, 3, 2, 1}, new int[]{3, 3, 1, 1, 2, 1}, new int[]{3, 1, 2, 1, 1, 3}, new int[]{3, 1, 2, 3, 1, 1}, new int[]{3, 3, 2, 1, 1, 1}, new int[]{3, 1, 4, 1, 1, 1}, new int[]{2, 2, 1, 4, 1, 1}, new int[]{4, 3, 1, 1, 1, 1}, new int[]{1, 1, 1, 2, 2, 4}, new int[]{1, 1, 1, 4, 2, 2}, new int[]{1, 2, 1, 1, 2, 4}, new int[]{1, 2, 1, 4, 2, 1}, new int[]{1, 4, 1, 1, 2, 2}, new int[]{1, 4, 1, 2, 2, 1}, new int[]{1, 1, 2, 2, 1, 4}, new int[]{1, 1, 2, 4, 1, 2}, new int[]{1, 2, 2, 1, 1, 4}, new int[]{1, 2, 2, 4, 1, 1}, new int[]{1, 4, 2, 1, 1, 2}, new int[]{1, 4, 2, 2, 1, 1}, new int[]{2, 4, 1, 2, 1, 1}, new int[]{2, 2, 1, 1, 1, 4}, new int[]{4, 1, 3, 1, 1, 1}, new int[]{2, 4, 1, 1, 1, 2}, new int[]{1, 3, 4, 1, 1, 1}, new int[]{1, 1, 1, 2, 4, 2}, new int[]{1, 2, 1, 1, 4, 2}, new int[]{1, 2, 1, 2, 4, 1}, new int[]{1, 1, 4, 2, 1, 2}, new int[]{1, 2, 4, 1, 1, 2}, new int[]{1, 2, 4, 2, 1, 1}, new int[]{4, 1, 1, 2, 1, 2}, new int[]{4, 2, 1, 1, 1, 2}, new int[]{4, 2, 1, 2, 1, 1}, new int[]{2, 1, 2, 1, 4, 1}, new int[]{2, 1, 4, 1, 2, 1}, new int[]{4, 1, 2, 1, 2, 1}, new int[]{1, 1, 1, 1, 4, 3}, new int[]{1, 1, 1, 3, 4, 1}, new int[]{1, 3, 1, 1, 4, 1}, new int[]{1, 1, 4, 1, 1, 3}, new int[]{1, 1, 4, 3, 1, 1}, new int[]{4, 1, 1, 1, 1, 3}, new int[]{4, 1, 1, 3, 1, 1}, new int[]{1, 1, 3, 1, 4, 1}, new int[]{1, 1, 4, 1, 3, 1}, new int[]{3, 1, 1, 1, 4, 1}, new int[]{4, 1, 1, 1, 3, 1}, new int[]{2, 1, 1, 4, 1, 2}, new int[]{2, 1, 1, 2, 1, 4}, new int[]{2, 1, 1, 2, 3, 2}, new int[]{2, 3, 3, 1, 1, 1, 2}};
|
||||
|
||||
private static int[] a(BitArray bitArray) throws NotFoundException {
|
||||
int h = bitArray.h();
|
||||
int b = bitArray.b(0);
|
||||
int[] iArr = new int[6];
|
||||
int i = b;
|
||||
boolean z = false;
|
||||
int i2 = 0;
|
||||
while (b < h) {
|
||||
if (bitArray.a(b) != z) {
|
||||
iArr[i2] = iArr[i2] + 1;
|
||||
} else {
|
||||
if (i2 == 5) {
|
||||
float f = 0.25f;
|
||||
int i3 = -1;
|
||||
for (int i4 = 103; i4 <= 105; i4++) {
|
||||
float a2 = OneDReader.a(iArr, a[i4], 0.7f);
|
||||
if (a2 < f) {
|
||||
i3 = i4;
|
||||
f = a2;
|
||||
}
|
||||
}
|
||||
if (i3 >= 0 && bitArray.a(Math.max(0, i - ((b - i) / 2)), i, false)) {
|
||||
return new int[]{i, b, i3};
|
||||
}
|
||||
i += iArr[0] + iArr[1];
|
||||
int i5 = i2 - 1;
|
||||
System.arraycopy(iArr, 2, iArr, 0, i5);
|
||||
iArr[i5] = 0;
|
||||
iArr[i2] = 0;
|
||||
i2--;
|
||||
} else {
|
||||
i2++;
|
||||
}
|
||||
iArr[i2] = 1;
|
||||
z = !z;
|
||||
}
|
||||
b++;
|
||||
}
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
|
||||
private static int a(BitArray bitArray, int[] iArr, int i) throws NotFoundException {
|
||||
OneDReader.a(bitArray, i, iArr);
|
||||
float f = 0.25f;
|
||||
int i2 = -1;
|
||||
int i3 = 0;
|
||||
while (true) {
|
||||
int[][] iArr2 = a;
|
||||
if (i3 >= iArr2.length) {
|
||||
break;
|
||||
}
|
||||
float a2 = OneDReader.a(iArr, iArr2[i3], 0.7f);
|
||||
if (a2 < f) {
|
||||
i2 = i3;
|
||||
f = a2;
|
||||
}
|
||||
i3++;
|
||||
}
|
||||
if (i2 >= 0) {
|
||||
return i2;
|
||||
}
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
|
||||
/* JADX WARN: Can't fix incorrect switch cases order, some code will duplicate */
|
||||
/* JADX WARN: Code restructure failed: missing block: B:64:0x00e1, code lost:
|
||||
|
||||
if (r5 != false) goto L82;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:65:0x0135, code lost:
|
||||
|
||||
r5 = false;
|
||||
r11 = false;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:93:0x0133, code lost:
|
||||
|
||||
if (r5 != false) goto L82;
|
||||
*/
|
||||
/* JADX WARN: Failed to find 'out' block for switch in B:54:0x00c1. Please report as an issue. */
|
||||
/* JADX WARN: Failed to find 'out' block for switch in B:83:0x010e. Please report as an issue. */
|
||||
/* JADX WARN: Removed duplicated region for block: B:14:0x0057 */
|
||||
/* JADX WARN: Removed duplicated region for block: B:72:0x013f A[PHI: r19
|
||||
0x013f: PHI (r19v9 boolean) = (r19v5 boolean), (r19v17 boolean) binds: [B:83:0x010e, B:54:0x00c1] A[DONT_GENERATE, DONT_INLINE]] */
|
||||
/* JADX WARN: Removed duplicated region for block: B:73:0x0149 A[PHI: r6 r19
|
||||
0x0149: PHI (r6v10 boolean) =
|
||||
(r6v2 boolean)
|
||||
(r6v2 boolean)
|
||||
(r6v2 boolean)
|
||||
(r6v2 boolean)
|
||||
(r6v9 boolean)
|
||||
(r6v2 boolean)
|
||||
(r6v2 boolean)
|
||||
(r6v2 boolean)
|
||||
(r6v2 boolean)
|
||||
binds: [B:83:0x010e, B:84:0x0112, B:88:0x011e, B:87:0x011a, B:74:0x0148, B:54:0x00c1, B:55:0x00c6, B:59:0x00d3, B:58:0x00ce] A[DONT_GENERATE, DONT_INLINE]
|
||||
0x0149: PHI (r19v8 boolean) =
|
||||
(r19v5 boolean)
|
||||
(r19v5 boolean)
|
||||
(r19v5 boolean)
|
||||
(r19v5 boolean)
|
||||
(r19v7 boolean)
|
||||
(r19v17 boolean)
|
||||
(r19v17 boolean)
|
||||
(r19v17 boolean)
|
||||
(r19v17 boolean)
|
||||
binds: [B:83:0x010e, B:84:0x0112, B:88:0x011e, B:87:0x011a, B:74:0x0148, B:54:0x00c1, B:55:0x00c6, B:59:0x00d3, B:58:0x00ce] A[DONT_GENERATE, DONT_INLINE]] */
|
||||
@Override // com.google.zxing.oned.OneDReader
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
||||
*/
|
||||
public com.google.zxing.Result a(int r25, com.google.zxing.common.BitArray r26, java.util.Map<com.google.zxing.DecodeHintType, ?> r27) throws com.google.zxing.NotFoundException, com.google.zxing.FormatException, com.google.zxing.ChecksumException {
|
||||
/*
|
||||
Method dump skipped, instructions count: 646
|
||||
To view this dump change 'Code comments level' option to 'DEBUG'
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: com.google.zxing.oned.Code128Reader.a(int, com.google.zxing.common.BitArray, java.util.Map):com.google.zxing.Result");
|
||||
}
|
||||
}
|
183
sources/com/google/zxing/oned/Code128Writer.java
Normal file
183
sources/com/google/zxing/oned/Code128Writer.java
Normal file
@@ -0,0 +1,183 @@
|
||||
package com.google.zxing.oned;
|
||||
|
||||
import com.google.zxing.BarcodeFormat;
|
||||
import com.google.zxing.EncodeHintType;
|
||||
import com.google.zxing.WriterException;
|
||||
import com.google.zxing.common.BitMatrix;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class Code128Writer extends OneDimensionalCodeWriter {
|
||||
|
||||
private enum CType {
|
||||
UNCODABLE,
|
||||
ONE_DIGIT,
|
||||
TWO_DIGITS,
|
||||
FNC_1
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.oned.OneDimensionalCodeWriter, com.google.zxing.Writer
|
||||
public BitMatrix a(String str, BarcodeFormat barcodeFormat, int i, int i2, Map<EncodeHintType, ?> map) throws WriterException {
|
||||
if (barcodeFormat == BarcodeFormat.CODE_128) {
|
||||
return super.a(str, barcodeFormat, i, i2, map);
|
||||
}
|
||||
throw new IllegalArgumentException("Can only encode CODE_128, but got ".concat(String.valueOf(barcodeFormat)));
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.oned.OneDimensionalCodeWriter
|
||||
public boolean[] a(String str) {
|
||||
int length = str.length();
|
||||
if (length > 0 && length <= 80) {
|
||||
int i = 0;
|
||||
for (int i2 = 0; i2 < length; i2++) {
|
||||
char charAt = str.charAt(i2);
|
||||
switch (charAt) {
|
||||
case 241:
|
||||
case 242:
|
||||
case 243:
|
||||
case 244:
|
||||
break;
|
||||
default:
|
||||
if (charAt > 127) {
|
||||
throw new IllegalArgumentException("Bad character in input: ".concat(String.valueOf(charAt)));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
ArrayList<int[]> arrayList = new ArrayList();
|
||||
int i3 = 0;
|
||||
int i4 = 0;
|
||||
int i5 = 0;
|
||||
int i6 = 1;
|
||||
while (i3 < length) {
|
||||
int a = a(str, i3, i5);
|
||||
int i7 = 100;
|
||||
if (a == i5) {
|
||||
switch (str.charAt(i3)) {
|
||||
case 241:
|
||||
i7 = 102;
|
||||
break;
|
||||
case 242:
|
||||
i7 = 97;
|
||||
break;
|
||||
case 243:
|
||||
i7 = 96;
|
||||
break;
|
||||
case 244:
|
||||
if (i5 == 101) {
|
||||
i7 = 101;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (i5 != 100) {
|
||||
if (i5 == 101) {
|
||||
i7 = str.charAt(i3) - ' ';
|
||||
if (i7 < 0) {
|
||||
i7 += 96;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
i7 = Integer.parseInt(str.substring(i3, i3 + 2));
|
||||
i3++;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
i7 = str.charAt(i3) - ' ';
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
i3++;
|
||||
} else {
|
||||
i7 = i5 == 0 ? a != 100 ? a != 101 ? 105 : 103 : 104 : a;
|
||||
i5 = a;
|
||||
}
|
||||
arrayList.add(Code128Reader.a[i7]);
|
||||
i4 += i7 * i6;
|
||||
if (i3 != 0) {
|
||||
i6++;
|
||||
}
|
||||
}
|
||||
arrayList.add(Code128Reader.a[i4 % 103]);
|
||||
arrayList.add(Code128Reader.a[106]);
|
||||
int i8 = 0;
|
||||
for (int[] iArr : arrayList) {
|
||||
int i9 = i8;
|
||||
for (int i10 : iArr) {
|
||||
i9 += i10;
|
||||
}
|
||||
i8 = i9;
|
||||
}
|
||||
boolean[] zArr = new boolean[i8];
|
||||
Iterator it = arrayList.iterator();
|
||||
while (it.hasNext()) {
|
||||
i += OneDimensionalCodeWriter.a(zArr, i, (int[]) it.next(), true);
|
||||
}
|
||||
return zArr;
|
||||
}
|
||||
throw new IllegalArgumentException("Contents length should be between 1 and 80 characters, but got ".concat(String.valueOf(length)));
|
||||
}
|
||||
|
||||
private static CType a(CharSequence charSequence, int i) {
|
||||
int length = charSequence.length();
|
||||
if (i >= length) {
|
||||
return CType.UNCODABLE;
|
||||
}
|
||||
char charAt = charSequence.charAt(i);
|
||||
if (charAt == 241) {
|
||||
return CType.FNC_1;
|
||||
}
|
||||
if (charAt < '0' || charAt > '9') {
|
||||
return CType.UNCODABLE;
|
||||
}
|
||||
int i2 = i + 1;
|
||||
if (i2 >= length) {
|
||||
return CType.ONE_DIGIT;
|
||||
}
|
||||
char charAt2 = charSequence.charAt(i2);
|
||||
if (charAt2 >= '0' && charAt2 <= '9') {
|
||||
return CType.TWO_DIGITS;
|
||||
}
|
||||
return CType.ONE_DIGIT;
|
||||
}
|
||||
|
||||
private static int a(CharSequence charSequence, int i, int i2) {
|
||||
CType a;
|
||||
CType a2;
|
||||
char charAt;
|
||||
CType a3 = a(charSequence, i);
|
||||
if (a3 == CType.ONE_DIGIT) {
|
||||
return 100;
|
||||
}
|
||||
if (a3 == CType.UNCODABLE) {
|
||||
return (i >= charSequence.length() || ((charAt = charSequence.charAt(i)) >= ' ' && (i2 != 101 || charAt >= '`'))) ? 100 : 101;
|
||||
}
|
||||
if (i2 == 99) {
|
||||
return 99;
|
||||
}
|
||||
if (i2 == 100) {
|
||||
if (a3 == CType.FNC_1 || (a = a(charSequence, i + 2)) == CType.UNCODABLE || a == CType.ONE_DIGIT) {
|
||||
return 100;
|
||||
}
|
||||
if (a == CType.FNC_1) {
|
||||
return a(charSequence, i + 3) == CType.TWO_DIGITS ? 99 : 100;
|
||||
}
|
||||
int i3 = i + 4;
|
||||
while (true) {
|
||||
a2 = a(charSequence, i3);
|
||||
if (a2 != CType.TWO_DIGITS) {
|
||||
break;
|
||||
}
|
||||
i3 += 2;
|
||||
}
|
||||
return a2 == CType.ONE_DIGIT ? 100 : 99;
|
||||
}
|
||||
if (a3 == CType.FNC_1) {
|
||||
a3 = a(charSequence, i + 1);
|
||||
}
|
||||
return a3 == CType.TWO_DIGITS ? 99 : 100;
|
||||
}
|
||||
}
|
252
sources/com/google/zxing/oned/Code39Reader.java
Normal file
252
sources/com/google/zxing/oned/Code39Reader.java
Normal file
@@ -0,0 +1,252 @@
|
||||
package com.google.zxing.oned;
|
||||
|
||||
import com.google.zxing.BarcodeFormat;
|
||||
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.ResultPoint;
|
||||
import com.google.zxing.common.BitArray;
|
||||
import com.ubt.jimu.diy.DiyRobotFile;
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class Code39Reader extends OneDReader {
|
||||
static final int[] e = {52, 289, 97, 352, 49, 304, 112, 37, 292, 100, 265, 73, 328, 25, 280, 88, 13, 268, 76, 28, DiyRobotFile.TYPE_LOGO, 67, 322, 19, 274, 82, 7, 262, 70, 22, 385, 193, 448, 145, 400, 208, 133, 388, 196, 168, 162, 138, 42};
|
||||
private final boolean a;
|
||||
private final boolean b;
|
||||
private final StringBuilder c;
|
||||
private final int[] d;
|
||||
|
||||
public Code39Reader() {
|
||||
this(false);
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.oned.OneDReader
|
||||
public Result a(int i, BitArray bitArray, Map<DecodeHintType, ?> map) throws NotFoundException, ChecksumException, FormatException {
|
||||
int[] iArr = this.d;
|
||||
Arrays.fill(iArr, 0);
|
||||
StringBuilder sb = this.c;
|
||||
sb.setLength(0);
|
||||
int b = bitArray.b(a(bitArray, iArr)[1]);
|
||||
int h = bitArray.h();
|
||||
while (true) {
|
||||
OneDReader.a(bitArray, b, iArr);
|
||||
int a = a(iArr);
|
||||
if (a < 0) {
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
char a2 = a(a);
|
||||
sb.append(a2);
|
||||
int i2 = b;
|
||||
for (int i3 : iArr) {
|
||||
i2 += i3;
|
||||
}
|
||||
int b2 = bitArray.b(i2);
|
||||
if (a2 == '*') {
|
||||
sb.setLength(sb.length() - 1);
|
||||
int i4 = 0;
|
||||
for (int i5 : iArr) {
|
||||
i4 += i5;
|
||||
}
|
||||
int i6 = (b2 - b) - i4;
|
||||
if (b2 != h && (i6 << 1) < i4) {
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
if (this.a) {
|
||||
int length = sb.length() - 1;
|
||||
int i7 = 0;
|
||||
for (int i8 = 0; i8 < length; i8++) {
|
||||
i7 += "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%".indexOf(this.c.charAt(i8));
|
||||
}
|
||||
if (sb.charAt(length) != "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%".charAt(i7 % 43)) {
|
||||
throw ChecksumException.getChecksumInstance();
|
||||
}
|
||||
sb.setLength(length);
|
||||
}
|
||||
if (sb.length() == 0) {
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
float f = i;
|
||||
return new Result(this.b ? a(sb) : sb.toString(), null, new ResultPoint[]{new ResultPoint((r2[1] + r2[0]) / 2.0f, f), new ResultPoint(b + (i4 / 2.0f), f)}, BarcodeFormat.CODE_39);
|
||||
}
|
||||
b = b2;
|
||||
}
|
||||
}
|
||||
|
||||
public Code39Reader(boolean z) {
|
||||
this(z, false);
|
||||
}
|
||||
|
||||
public Code39Reader(boolean z, boolean z2) {
|
||||
this.a = z;
|
||||
this.b = z2;
|
||||
this.c = new StringBuilder(20);
|
||||
this.d = new int[9];
|
||||
}
|
||||
|
||||
private static int[] a(BitArray bitArray, int[] iArr) throws NotFoundException {
|
||||
int h = bitArray.h();
|
||||
int b = bitArray.b(0);
|
||||
int length = iArr.length;
|
||||
int i = b;
|
||||
boolean z = false;
|
||||
int i2 = 0;
|
||||
while (b < h) {
|
||||
if (bitArray.a(b) != z) {
|
||||
iArr[i2] = iArr[i2] + 1;
|
||||
} else {
|
||||
if (i2 != length - 1) {
|
||||
i2++;
|
||||
} else {
|
||||
if (a(iArr) == 148 && bitArray.a(Math.max(0, i - ((b - i) / 2)), i, false)) {
|
||||
return new int[]{i, b};
|
||||
}
|
||||
i += iArr[0] + iArr[1];
|
||||
int i3 = i2 - 1;
|
||||
System.arraycopy(iArr, 2, iArr, 0, i3);
|
||||
iArr[i3] = 0;
|
||||
iArr[i2] = 0;
|
||||
i2--;
|
||||
}
|
||||
iArr[i2] = 1;
|
||||
z = !z;
|
||||
}
|
||||
b++;
|
||||
}
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
|
||||
private static int a(int[] iArr) {
|
||||
int length = iArr.length;
|
||||
int i = 0;
|
||||
while (true) {
|
||||
int i2 = Integer.MAX_VALUE;
|
||||
for (int i3 : iArr) {
|
||||
if (i3 < i2 && i3 > i) {
|
||||
i2 = i3;
|
||||
}
|
||||
}
|
||||
int i4 = 0;
|
||||
int i5 = 0;
|
||||
int i6 = 0;
|
||||
for (int i7 = 0; i7 < length; i7++) {
|
||||
int i8 = iArr[i7];
|
||||
if (i8 > i2) {
|
||||
i5 |= 1 << ((length - 1) - i7);
|
||||
i4++;
|
||||
i6 += i8;
|
||||
}
|
||||
}
|
||||
if (i4 == 3) {
|
||||
for (int i9 = 0; i9 < length && i4 > 0; i9++) {
|
||||
int i10 = iArr[i9];
|
||||
if (i10 > i2) {
|
||||
i4--;
|
||||
if ((i10 << 1) >= i6) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return i5;
|
||||
}
|
||||
if (i4 <= 3) {
|
||||
return -1;
|
||||
}
|
||||
i = i2;
|
||||
}
|
||||
}
|
||||
|
||||
private static char a(int i) throws NotFoundException {
|
||||
int i2 = 0;
|
||||
while (true) {
|
||||
int[] iArr = e;
|
||||
if (i2 >= iArr.length) {
|
||||
if (i == 148) {
|
||||
return '*';
|
||||
}
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
if (iArr[i2] == i) {
|
||||
return "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%".charAt(i2);
|
||||
}
|
||||
i2++;
|
||||
}
|
||||
}
|
||||
|
||||
private static String a(CharSequence charSequence) throws FormatException {
|
||||
int i;
|
||||
char c;
|
||||
int length = charSequence.length();
|
||||
StringBuilder sb = new StringBuilder(length);
|
||||
int i2 = 0;
|
||||
while (i2 < length) {
|
||||
char charAt = charSequence.charAt(i2);
|
||||
if (charAt != '+' && charAt != '$' && charAt != '%' && charAt != '/') {
|
||||
sb.append(charAt);
|
||||
} else {
|
||||
i2++;
|
||||
char charAt2 = charSequence.charAt(i2);
|
||||
if (charAt != '$') {
|
||||
if (charAt != '%') {
|
||||
if (charAt != '+') {
|
||||
if (charAt == '/') {
|
||||
if (charAt2 >= 'A' && charAt2 <= 'O') {
|
||||
i = charAt2 - ' ';
|
||||
} else {
|
||||
if (charAt2 != 'Z') {
|
||||
throw FormatException.getFormatInstance();
|
||||
}
|
||||
c = ':';
|
||||
sb.append(c);
|
||||
}
|
||||
}
|
||||
c = 0;
|
||||
sb.append(c);
|
||||
} else {
|
||||
if (charAt2 < 'A' || charAt2 > 'Z') {
|
||||
throw FormatException.getFormatInstance();
|
||||
}
|
||||
i = charAt2 + ' ';
|
||||
}
|
||||
} else if (charAt2 >= 'A' && charAt2 <= 'E') {
|
||||
i = charAt2 - '&';
|
||||
} else if (charAt2 >= 'F' && charAt2 <= 'J') {
|
||||
i = charAt2 - 11;
|
||||
} else if (charAt2 >= 'K' && charAt2 <= 'O') {
|
||||
i = charAt2 + 16;
|
||||
} else if (charAt2 < 'P' || charAt2 > 'T') {
|
||||
if (charAt2 != 'U') {
|
||||
if (charAt2 == 'V') {
|
||||
c = '@';
|
||||
} else if (charAt2 == 'W') {
|
||||
c = '`';
|
||||
} else {
|
||||
if (charAt2 != 'X' && charAt2 != 'Y' && charAt2 != 'Z') {
|
||||
throw FormatException.getFormatInstance();
|
||||
}
|
||||
c = 127;
|
||||
}
|
||||
sb.append(c);
|
||||
}
|
||||
c = 0;
|
||||
sb.append(c);
|
||||
} else {
|
||||
i = charAt2 + '+';
|
||||
}
|
||||
} else {
|
||||
if (charAt2 < 'A' || charAt2 > 'Z') {
|
||||
throw FormatException.getFormatInstance();
|
||||
}
|
||||
i = charAt2 - '@';
|
||||
}
|
||||
c = (char) i;
|
||||
sb.append(c);
|
||||
}
|
||||
i2++;
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
127
sources/com/google/zxing/oned/Code39Writer.java
Normal file
127
sources/com/google/zxing/oned/Code39Writer.java
Normal file
@@ -0,0 +1,127 @@
|
||||
package com.google.zxing.oned;
|
||||
|
||||
import com.google.zxing.BarcodeFormat;
|
||||
import com.google.zxing.EncodeHintType;
|
||||
import com.google.zxing.WriterException;
|
||||
import com.google.zxing.common.BitMatrix;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class Code39Writer extends OneDimensionalCodeWriter {
|
||||
private static String b(String str) {
|
||||
int length = str.length();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < length; i++) {
|
||||
char charAt = str.charAt(i);
|
||||
if (charAt != 0) {
|
||||
if (charAt != ' ') {
|
||||
if (charAt == '@') {
|
||||
sb.append("%V");
|
||||
} else if (charAt == '`') {
|
||||
sb.append("%W");
|
||||
} else if (charAt != '-' && charAt != '.') {
|
||||
if (charAt <= 26) {
|
||||
sb.append('$');
|
||||
sb.append((char) ((charAt - 1) + 65));
|
||||
} else if (charAt < ' ') {
|
||||
sb.append('%');
|
||||
sb.append((char) ((charAt - 27) + 65));
|
||||
} else if (charAt <= ',' || charAt == '/' || charAt == ':') {
|
||||
sb.append('/');
|
||||
sb.append((char) ((charAt - '!') + 65));
|
||||
} else if (charAt <= '9') {
|
||||
sb.append((char) ((charAt - '0') + 48));
|
||||
} else if (charAt <= '?') {
|
||||
sb.append('%');
|
||||
sb.append((char) ((charAt - ';') + 70));
|
||||
} else if (charAt <= 'Z') {
|
||||
sb.append((char) ((charAt - 'A') + 65));
|
||||
} else if (charAt <= '_') {
|
||||
sb.append('%');
|
||||
sb.append((char) ((charAt - '[') + 75));
|
||||
} else if (charAt <= 'z') {
|
||||
sb.append('+');
|
||||
sb.append((char) ((charAt - 'a') + 65));
|
||||
} else {
|
||||
if (charAt > 127) {
|
||||
throw new IllegalArgumentException("Requested content contains a non-encodable character: '" + str.charAt(i) + "'");
|
||||
}
|
||||
sb.append('%');
|
||||
sb.append((char) ((charAt - '{') + 80));
|
||||
}
|
||||
}
|
||||
}
|
||||
sb.append(charAt);
|
||||
} else {
|
||||
sb.append("%U");
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.oned.OneDimensionalCodeWriter, com.google.zxing.Writer
|
||||
public BitMatrix a(String str, BarcodeFormat barcodeFormat, int i, int i2, Map<EncodeHintType, ?> map) throws WriterException {
|
||||
if (barcodeFormat == BarcodeFormat.CODE_39) {
|
||||
return super.a(str, barcodeFormat, i, i2, map);
|
||||
}
|
||||
throw new IllegalArgumentException("Can only encode CODE_39, but got ".concat(String.valueOf(barcodeFormat)));
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.oned.OneDimensionalCodeWriter
|
||||
public boolean[] a(String str) {
|
||||
int length = str.length();
|
||||
if (length <= 80) {
|
||||
int i = 0;
|
||||
while (true) {
|
||||
if (i >= length) {
|
||||
break;
|
||||
}
|
||||
if ("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%".indexOf(str.charAt(i)) < 0) {
|
||||
str = b(str);
|
||||
length = str.length();
|
||||
if (length > 80) {
|
||||
throw new IllegalArgumentException("Requested contents should be less than 80 digits long, but got " + length + " (extended full ASCII mode)");
|
||||
}
|
||||
} else {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
int[] iArr = new int[9];
|
||||
int i2 = length + 25;
|
||||
int i3 = 0;
|
||||
while (i3 < length) {
|
||||
a(Code39Reader.e["0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%".indexOf(str.charAt(i3))], iArr);
|
||||
int i4 = i2;
|
||||
for (int i5 = 0; i5 < 9; i5++) {
|
||||
i4 += iArr[i5];
|
||||
}
|
||||
i3++;
|
||||
i2 = i4;
|
||||
}
|
||||
boolean[] zArr = new boolean[i2];
|
||||
a(148, iArr);
|
||||
int a = OneDimensionalCodeWriter.a(zArr, 0, iArr, true);
|
||||
int[] iArr2 = {1};
|
||||
int a2 = a + OneDimensionalCodeWriter.a(zArr, a, iArr2, false);
|
||||
for (int i6 = 0; i6 < length; i6++) {
|
||||
a(Code39Reader.e["0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%".indexOf(str.charAt(i6))], iArr);
|
||||
int a3 = a2 + OneDimensionalCodeWriter.a(zArr, a2, iArr, true);
|
||||
a2 = a3 + OneDimensionalCodeWriter.a(zArr, a3, iArr2, false);
|
||||
}
|
||||
a(148, iArr);
|
||||
OneDimensionalCodeWriter.a(zArr, a2, iArr, true);
|
||||
return zArr;
|
||||
}
|
||||
throw new IllegalArgumentException("Requested contents should be less than 80 digits long, but got ".concat(String.valueOf(length)));
|
||||
}
|
||||
|
||||
private static void a(int i, int[] iArr) {
|
||||
for (int i2 = 0; i2 < 9; i2++) {
|
||||
int i3 = 1;
|
||||
if (((1 << (8 - i2)) & i) != 0) {
|
||||
i3 = 2;
|
||||
}
|
||||
iArr[i2] = i3;
|
||||
}
|
||||
}
|
||||
}
|
244
sources/com/google/zxing/oned/Code93Reader.java
Normal file
244
sources/com/google/zxing/oned/Code93Reader.java
Normal file
@@ -0,0 +1,244 @@
|
||||
package com.google.zxing.oned;
|
||||
|
||||
import com.google.zxing.BarcodeFormat;
|
||||
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.ResultPoint;
|
||||
import com.google.zxing.common.BitArray;
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
import okhttp3.internal.http.StatusLine;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class Code93Reader extends OneDReader {
|
||||
private static final char[] c = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%abcd*".toCharArray();
|
||||
static final int[] d;
|
||||
private static final int e;
|
||||
private final StringBuilder a = new StringBuilder(20);
|
||||
private final int[] b = new int[6];
|
||||
|
||||
static {
|
||||
int[] iArr = {276, 328, 324, 322, 296, 292, 290, 336, 274, 266, 424, 420, 418, 404, 402, 394, 360, 356, 354, StatusLine.HTTP_PERM_REDIRECT, 282, 344, 332, 326, 300, 278, 436, 434, 428, 422, 406, 410, 364, 358, 310, 314, 302, 468, 466, 458, 366, 374, 430, 294, 474, 470, 306, 350};
|
||||
d = iArr;
|
||||
e = iArr[47];
|
||||
}
|
||||
|
||||
private static String b(CharSequence charSequence) throws FormatException {
|
||||
int i;
|
||||
char c2;
|
||||
int length = charSequence.length();
|
||||
StringBuilder sb = new StringBuilder(length);
|
||||
int i2 = 0;
|
||||
while (i2 < length) {
|
||||
char charAt = charSequence.charAt(i2);
|
||||
if (charAt < 'a' || charAt > 'd') {
|
||||
sb.append(charAt);
|
||||
} else {
|
||||
if (i2 >= length - 1) {
|
||||
throw FormatException.getFormatInstance();
|
||||
}
|
||||
i2++;
|
||||
char charAt2 = charSequence.charAt(i2);
|
||||
switch (charAt) {
|
||||
case 'a':
|
||||
if (charAt2 >= 'A' && charAt2 <= 'Z') {
|
||||
i = charAt2 - '@';
|
||||
c2 = (char) i;
|
||||
sb.append(c2);
|
||||
break;
|
||||
} else {
|
||||
throw FormatException.getFormatInstance();
|
||||
}
|
||||
break;
|
||||
case 'b':
|
||||
if (charAt2 >= 'A' && charAt2 <= 'E') {
|
||||
i = charAt2 - '&';
|
||||
} else if (charAt2 >= 'F' && charAt2 <= 'J') {
|
||||
i = charAt2 - 11;
|
||||
} else if (charAt2 >= 'K' && charAt2 <= 'O') {
|
||||
i = charAt2 + 16;
|
||||
} else if (charAt2 >= 'P' && charAt2 <= 'S') {
|
||||
i = charAt2 + '+';
|
||||
} else if (charAt2 >= 'T' && charAt2 <= 'Z') {
|
||||
c2 = 127;
|
||||
sb.append(c2);
|
||||
break;
|
||||
} else {
|
||||
throw FormatException.getFormatInstance();
|
||||
}
|
||||
c2 = (char) i;
|
||||
sb.append(c2);
|
||||
break;
|
||||
case 'c':
|
||||
if (charAt2 >= 'A' && charAt2 <= 'O') {
|
||||
i = charAt2 - ' ';
|
||||
c2 = (char) i;
|
||||
sb.append(c2);
|
||||
} else {
|
||||
if (charAt2 != 'Z') {
|
||||
throw FormatException.getFormatInstance();
|
||||
}
|
||||
c2 = ':';
|
||||
sb.append(c2);
|
||||
break;
|
||||
}
|
||||
case 'd':
|
||||
if (charAt2 >= 'A' && charAt2 <= 'Z') {
|
||||
i = charAt2 + ' ';
|
||||
c2 = (char) i;
|
||||
sb.append(c2);
|
||||
break;
|
||||
} else {
|
||||
throw FormatException.getFormatInstance();
|
||||
}
|
||||
default:
|
||||
c2 = 0;
|
||||
sb.append(c2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
i2++;
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.oned.OneDReader
|
||||
public Result a(int i, BitArray bitArray, Map<DecodeHintType, ?> map) throws NotFoundException, ChecksumException, FormatException {
|
||||
int b = bitArray.b(a(bitArray)[1]);
|
||||
int h = bitArray.h();
|
||||
int[] iArr = this.b;
|
||||
Arrays.fill(iArr, 0);
|
||||
StringBuilder sb = this.a;
|
||||
sb.setLength(0);
|
||||
while (true) {
|
||||
OneDReader.a(bitArray, b, iArr);
|
||||
int a = a(iArr);
|
||||
if (a < 0) {
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
char a2 = a(a);
|
||||
sb.append(a2);
|
||||
int i2 = b;
|
||||
for (int i3 : iArr) {
|
||||
i2 += i3;
|
||||
}
|
||||
int b2 = bitArray.b(i2);
|
||||
if (a2 == '*') {
|
||||
sb.deleteCharAt(sb.length() - 1);
|
||||
int i4 = 0;
|
||||
for (int i5 : iArr) {
|
||||
i4 += i5;
|
||||
}
|
||||
if (b2 == h || !bitArray.a(b2)) {
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
if (sb.length() < 2) {
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
a(sb);
|
||||
sb.setLength(sb.length() - 2);
|
||||
float f = i;
|
||||
return new Result(b(sb), null, new ResultPoint[]{new ResultPoint((r14[1] + r14[0]) / 2.0f, f), new ResultPoint(b + (i4 / 2.0f), f)}, BarcodeFormat.CODE_93);
|
||||
}
|
||||
b = b2;
|
||||
}
|
||||
}
|
||||
|
||||
private int[] a(BitArray bitArray) throws NotFoundException {
|
||||
int h = bitArray.h();
|
||||
int b = bitArray.b(0);
|
||||
Arrays.fill(this.b, 0);
|
||||
int[] iArr = this.b;
|
||||
int length = iArr.length;
|
||||
int i = b;
|
||||
boolean z = false;
|
||||
int i2 = 0;
|
||||
while (b < h) {
|
||||
if (bitArray.a(b) != z) {
|
||||
iArr[i2] = iArr[i2] + 1;
|
||||
} else {
|
||||
if (i2 != length - 1) {
|
||||
i2++;
|
||||
} else {
|
||||
if (a(iArr) == e) {
|
||||
return new int[]{i, b};
|
||||
}
|
||||
i += iArr[0] + iArr[1];
|
||||
int i3 = i2 - 1;
|
||||
System.arraycopy(iArr, 2, iArr, 0, i3);
|
||||
iArr[i3] = 0;
|
||||
iArr[i2] = 0;
|
||||
i2--;
|
||||
}
|
||||
iArr[i2] = 1;
|
||||
z = !z;
|
||||
}
|
||||
b++;
|
||||
}
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
|
||||
private static int a(int[] iArr) {
|
||||
int i = 0;
|
||||
for (int i2 : iArr) {
|
||||
i += i2;
|
||||
}
|
||||
int length = iArr.length;
|
||||
int i3 = 0;
|
||||
for (int i4 = 0; i4 < length; i4++) {
|
||||
int round = Math.round((iArr[i4] * 9.0f) / i);
|
||||
if (round <= 0 || round > 4) {
|
||||
return -1;
|
||||
}
|
||||
if ((i4 & 1) == 0) {
|
||||
int i5 = i3;
|
||||
for (int i6 = 0; i6 < round; i6++) {
|
||||
i5 = (i5 << 1) | 1;
|
||||
}
|
||||
i3 = i5;
|
||||
} else {
|
||||
i3 <<= round;
|
||||
}
|
||||
}
|
||||
return i3;
|
||||
}
|
||||
|
||||
private static char a(int i) throws NotFoundException {
|
||||
int i2 = 0;
|
||||
while (true) {
|
||||
int[] iArr = d;
|
||||
if (i2 < iArr.length) {
|
||||
if (iArr[i2] == i) {
|
||||
return c[i2];
|
||||
}
|
||||
i2++;
|
||||
} else {
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void a(CharSequence charSequence) throws ChecksumException {
|
||||
int length = charSequence.length();
|
||||
a(charSequence, length - 2, 20);
|
||||
a(charSequence, length - 1, 15);
|
||||
}
|
||||
|
||||
private static void a(CharSequence charSequence, int i, int i2) throws ChecksumException {
|
||||
int i3 = 0;
|
||||
int i4 = 1;
|
||||
for (int i5 = i - 1; i5 >= 0; i5--) {
|
||||
i3 += "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%abcd*".indexOf(charSequence.charAt(i5)) * i4;
|
||||
i4++;
|
||||
if (i4 > i2) {
|
||||
i4 = 1;
|
||||
}
|
||||
}
|
||||
if (charSequence.charAt(i) != c[i3 % 47]) {
|
||||
throw ChecksumException.getChecksumInstance();
|
||||
}
|
||||
}
|
||||
}
|
79
sources/com/google/zxing/oned/Code93Writer.java
Normal file
79
sources/com/google/zxing/oned/Code93Writer.java
Normal file
@@ -0,0 +1,79 @@
|
||||
package com.google.zxing.oned;
|
||||
|
||||
import com.google.zxing.BarcodeFormat;
|
||||
import com.google.zxing.EncodeHintType;
|
||||
import com.google.zxing.WriterException;
|
||||
import com.google.zxing.common.BitMatrix;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class Code93Writer extends OneDimensionalCodeWriter {
|
||||
@Override // com.google.zxing.oned.OneDimensionalCodeWriter, com.google.zxing.Writer
|
||||
public BitMatrix a(String str, BarcodeFormat barcodeFormat, int i, int i2, Map<EncodeHintType, ?> map) throws WriterException {
|
||||
if (barcodeFormat == BarcodeFormat.CODE_93) {
|
||||
return super.a(str, barcodeFormat, i, i2, map);
|
||||
}
|
||||
throw new IllegalArgumentException("Can only encode CODE_93, but got ".concat(String.valueOf(barcodeFormat)));
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.oned.OneDimensionalCodeWriter
|
||||
public boolean[] a(String str) {
|
||||
int length = str.length();
|
||||
if (length <= 80) {
|
||||
int[] iArr = new int[9];
|
||||
int length2 = ((str.length() + 2 + 2) * 9) + 1;
|
||||
a(Code93Reader.d[47], iArr);
|
||||
boolean[] zArr = new boolean[length2];
|
||||
int a = a(zArr, 0, iArr);
|
||||
for (int i = 0; i < length; i++) {
|
||||
a(Code93Reader.d["0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%abcd*".indexOf(str.charAt(i))], iArr);
|
||||
a += a(zArr, a, iArr);
|
||||
}
|
||||
int a2 = a(str, 20);
|
||||
a(Code93Reader.d[a2], iArr);
|
||||
int a3 = a + a(zArr, a, iArr);
|
||||
a(Code93Reader.d[a(str + "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%abcd*".charAt(a2), 15)], iArr);
|
||||
int a4 = a3 + a(zArr, a3, iArr);
|
||||
a(Code93Reader.d[47], iArr);
|
||||
zArr[a4 + a(zArr, a4, iArr)] = true;
|
||||
return zArr;
|
||||
}
|
||||
throw new IllegalArgumentException("Requested contents should be less than 80 digits long, but got ".concat(String.valueOf(length)));
|
||||
}
|
||||
|
||||
private static void a(int i, int[] iArr) {
|
||||
for (int i2 = 0; i2 < 9; i2++) {
|
||||
int i3 = 1;
|
||||
if (((1 << (8 - i2)) & i) == 0) {
|
||||
i3 = 0;
|
||||
}
|
||||
iArr[i2] = i3;
|
||||
}
|
||||
}
|
||||
|
||||
private static int a(boolean[] zArr, int i, int[] iArr) {
|
||||
int length = iArr.length;
|
||||
int i2 = i;
|
||||
int i3 = 0;
|
||||
while (i3 < length) {
|
||||
int i4 = i2 + 1;
|
||||
zArr[i2] = iArr[i3] != 0;
|
||||
i3++;
|
||||
i2 = i4;
|
||||
}
|
||||
return 9;
|
||||
}
|
||||
|
||||
private static int a(String str, int i) {
|
||||
int i2 = 0;
|
||||
int i3 = 1;
|
||||
for (int length = str.length() - 1; length >= 0; length--) {
|
||||
i2 += "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%abcd*".indexOf(str.charAt(length)) * i3;
|
||||
i3++;
|
||||
if (i3 > i) {
|
||||
i3 = 1;
|
||||
}
|
||||
}
|
||||
return i2 % 47;
|
||||
}
|
||||
}
|
65
sources/com/google/zxing/oned/EAN13Reader.java
Normal file
65
sources/com/google/zxing/oned/EAN13Reader.java
Normal file
@@ -0,0 +1,65 @@
|
||||
package com.google.zxing.oned;
|
||||
|
||||
import com.google.zxing.BarcodeFormat;
|
||||
import com.google.zxing.NotFoundException;
|
||||
import com.google.zxing.common.BitArray;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class EAN13Reader extends UPCEANReader {
|
||||
static final int[] j = {0, 11, 13, 14, 19, 25, 28, 21, 22, 26};
|
||||
private final int[] i = new int[4];
|
||||
|
||||
@Override // com.google.zxing.oned.UPCEANReader
|
||||
protected int a(BitArray bitArray, int[] iArr, StringBuilder sb) throws NotFoundException {
|
||||
int[] iArr2 = this.i;
|
||||
iArr2[0] = 0;
|
||||
iArr2[1] = 0;
|
||||
iArr2[2] = 0;
|
||||
iArr2[3] = 0;
|
||||
int h = bitArray.h();
|
||||
int i = iArr[1];
|
||||
int i2 = 0;
|
||||
int i3 = 0;
|
||||
while (i2 < 6 && i < h) {
|
||||
int a = UPCEANReader.a(bitArray, iArr2, i, UPCEANReader.h);
|
||||
sb.append((char) ((a % 10) + 48));
|
||||
int i4 = i;
|
||||
for (int i5 : iArr2) {
|
||||
i4 += i5;
|
||||
}
|
||||
if (a >= 10) {
|
||||
i3 = (1 << (5 - i2)) | i3;
|
||||
}
|
||||
i2++;
|
||||
i = i4;
|
||||
}
|
||||
a(sb, i3);
|
||||
int i6 = UPCEANReader.a(bitArray, i, true, UPCEANReader.e)[1];
|
||||
int i7 = 0;
|
||||
while (i7 < 6 && i6 < h) {
|
||||
sb.append((char) (UPCEANReader.a(bitArray, iArr2, i6, UPCEANReader.g) + 48));
|
||||
int i8 = i6;
|
||||
for (int i9 : iArr2) {
|
||||
i8 += i9;
|
||||
}
|
||||
i7++;
|
||||
i6 = i8;
|
||||
}
|
||||
return i6;
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.oned.UPCEANReader
|
||||
BarcodeFormat a() {
|
||||
return BarcodeFormat.EAN_13;
|
||||
}
|
||||
|
||||
private static void a(StringBuilder sb, int i) throws NotFoundException {
|
||||
for (int i2 = 0; i2 < 10; i2++) {
|
||||
if (i == j[i2]) {
|
||||
sb.insert(0, (char) (i2 + 48));
|
||||
return;
|
||||
}
|
||||
}
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
}
|
57
sources/com/google/zxing/oned/EAN13Writer.java
Normal file
57
sources/com/google/zxing/oned/EAN13Writer.java
Normal file
@@ -0,0 +1,57 @@
|
||||
package com.google.zxing.oned;
|
||||
|
||||
import com.google.zxing.BarcodeFormat;
|
||||
import com.google.zxing.EncodeHintType;
|
||||
import com.google.zxing.FormatException;
|
||||
import com.google.zxing.WriterException;
|
||||
import com.google.zxing.common.BitMatrix;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class EAN13Writer extends UPCEANWriter {
|
||||
@Override // com.google.zxing.oned.OneDimensionalCodeWriter, com.google.zxing.Writer
|
||||
public BitMatrix a(String str, BarcodeFormat barcodeFormat, int i, int i2, Map<EncodeHintType, ?> map) throws WriterException {
|
||||
if (barcodeFormat == BarcodeFormat.EAN_13) {
|
||||
return super.a(str, barcodeFormat, i, i2, map);
|
||||
}
|
||||
throw new IllegalArgumentException("Can only encode EAN_13, but got ".concat(String.valueOf(barcodeFormat)));
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.oned.OneDimensionalCodeWriter
|
||||
public boolean[] a(String str) {
|
||||
int length = str.length();
|
||||
if (length == 12) {
|
||||
try {
|
||||
str = str + UPCEANReader.b(str);
|
||||
} catch (FormatException e) {
|
||||
throw new IllegalArgumentException(e);
|
||||
}
|
||||
} else if (length == 13) {
|
||||
try {
|
||||
if (!UPCEANReader.a((CharSequence) str)) {
|
||||
throw new IllegalArgumentException("Contents do not pass checksum");
|
||||
}
|
||||
} catch (FormatException unused) {
|
||||
throw new IllegalArgumentException("Illegal contents");
|
||||
}
|
||||
} else {
|
||||
throw new IllegalArgumentException("Requested contents should be 12 or 13 digits long, but got ".concat(String.valueOf(length)));
|
||||
}
|
||||
int i = EAN13Reader.j[Character.digit(str.charAt(0), 10)];
|
||||
boolean[] zArr = new boolean[95];
|
||||
int a = OneDimensionalCodeWriter.a(zArr, 0, UPCEANReader.d, true) + 0;
|
||||
for (int i2 = 1; i2 <= 6; i2++) {
|
||||
int digit = Character.digit(str.charAt(i2), 10);
|
||||
if (((i >> (6 - i2)) & 1) == 1) {
|
||||
digit += 10;
|
||||
}
|
||||
a += OneDimensionalCodeWriter.a(zArr, a, UPCEANReader.h[digit], false);
|
||||
}
|
||||
int a2 = a + OneDimensionalCodeWriter.a(zArr, a, UPCEANReader.e, false);
|
||||
for (int i3 = 7; i3 <= 12; i3++) {
|
||||
a2 += OneDimensionalCodeWriter.a(zArr, a2, UPCEANReader.g[Character.digit(str.charAt(i3), 10)], true);
|
||||
}
|
||||
OneDimensionalCodeWriter.a(zArr, a2, UPCEANReader.d, true);
|
||||
return zArr;
|
||||
}
|
||||
}
|
48
sources/com/google/zxing/oned/EAN8Reader.java
Normal file
48
sources/com/google/zxing/oned/EAN8Reader.java
Normal file
@@ -0,0 +1,48 @@
|
||||
package com.google.zxing.oned;
|
||||
|
||||
import com.google.zxing.BarcodeFormat;
|
||||
import com.google.zxing.NotFoundException;
|
||||
import com.google.zxing.common.BitArray;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class EAN8Reader extends UPCEANReader {
|
||||
private final int[] i = new int[4];
|
||||
|
||||
@Override // com.google.zxing.oned.UPCEANReader
|
||||
protected int a(BitArray bitArray, int[] iArr, StringBuilder sb) throws NotFoundException {
|
||||
int[] iArr2 = this.i;
|
||||
iArr2[0] = 0;
|
||||
iArr2[1] = 0;
|
||||
iArr2[2] = 0;
|
||||
iArr2[3] = 0;
|
||||
int h = bitArray.h();
|
||||
int i = iArr[1];
|
||||
int i2 = 0;
|
||||
while (i2 < 4 && i < h) {
|
||||
sb.append((char) (UPCEANReader.a(bitArray, iArr2, i, UPCEANReader.g) + 48));
|
||||
int i3 = i;
|
||||
for (int i4 : iArr2) {
|
||||
i3 += i4;
|
||||
}
|
||||
i2++;
|
||||
i = i3;
|
||||
}
|
||||
int i5 = UPCEANReader.a(bitArray, i, true, UPCEANReader.e)[1];
|
||||
int i6 = 0;
|
||||
while (i6 < 4 && i5 < h) {
|
||||
sb.append((char) (UPCEANReader.a(bitArray, iArr2, i5, UPCEANReader.g) + 48));
|
||||
int i7 = i5;
|
||||
for (int i8 : iArr2) {
|
||||
i7 += i8;
|
||||
}
|
||||
i6++;
|
||||
i5 = i7;
|
||||
}
|
||||
return i5;
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.oned.UPCEANReader
|
||||
BarcodeFormat a() {
|
||||
return BarcodeFormat.EAN_8;
|
||||
}
|
||||
}
|
52
sources/com/google/zxing/oned/EAN8Writer.java
Normal file
52
sources/com/google/zxing/oned/EAN8Writer.java
Normal file
@@ -0,0 +1,52 @@
|
||||
package com.google.zxing.oned;
|
||||
|
||||
import com.google.zxing.BarcodeFormat;
|
||||
import com.google.zxing.EncodeHintType;
|
||||
import com.google.zxing.FormatException;
|
||||
import com.google.zxing.WriterException;
|
||||
import com.google.zxing.common.BitMatrix;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class EAN8Writer extends UPCEANWriter {
|
||||
@Override // com.google.zxing.oned.OneDimensionalCodeWriter, com.google.zxing.Writer
|
||||
public BitMatrix a(String str, BarcodeFormat barcodeFormat, int i, int i2, Map<EncodeHintType, ?> map) throws WriterException {
|
||||
if (barcodeFormat == BarcodeFormat.EAN_8) {
|
||||
return super.a(str, barcodeFormat, i, i2, map);
|
||||
}
|
||||
throw new IllegalArgumentException("Can only encode EAN_8, but got ".concat(String.valueOf(barcodeFormat)));
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.oned.OneDimensionalCodeWriter
|
||||
public boolean[] a(String str) {
|
||||
int length = str.length();
|
||||
if (length == 7) {
|
||||
try {
|
||||
str = str + UPCEANReader.b(str);
|
||||
} catch (FormatException e) {
|
||||
throw new IllegalArgumentException(e);
|
||||
}
|
||||
} else if (length == 8) {
|
||||
try {
|
||||
if (!UPCEANReader.a((CharSequence) str)) {
|
||||
throw new IllegalArgumentException("Contents do not pass checksum");
|
||||
}
|
||||
} catch (FormatException unused) {
|
||||
throw new IllegalArgumentException("Illegal contents");
|
||||
}
|
||||
} else {
|
||||
throw new IllegalArgumentException("Requested contents should be 8 digits long, but got ".concat(String.valueOf(length)));
|
||||
}
|
||||
boolean[] zArr = new boolean[67];
|
||||
int a = OneDimensionalCodeWriter.a(zArr, 0, UPCEANReader.d, true) + 0;
|
||||
for (int i = 0; i <= 3; i++) {
|
||||
a += OneDimensionalCodeWriter.a(zArr, a, UPCEANReader.g[Character.digit(str.charAt(i), 10)], false);
|
||||
}
|
||||
int a2 = a + OneDimensionalCodeWriter.a(zArr, a, UPCEANReader.e, false);
|
||||
for (int i2 = 4; i2 <= 7; i2++) {
|
||||
a2 += OneDimensionalCodeWriter.a(zArr, a2, UPCEANReader.g[Character.digit(str.charAt(i2), 10)], true);
|
||||
}
|
||||
OneDimensionalCodeWriter.a(zArr, a2, UPCEANReader.d, true);
|
||||
return zArr;
|
||||
}
|
||||
}
|
150
sources/com/google/zxing/oned/EANManufacturerOrgSupport.java
Normal file
150
sources/com/google/zxing/oned/EANManufacturerOrgSupport.java
Normal file
@@ -0,0 +1,150 @@
|
||||
package com.google.zxing.oned;
|
||||
|
||||
import com.baidu.cloud.media.player.IMediaPlayer;
|
||||
import com.ubt.jimu.base.mvp.SingleClickListener;
|
||||
import com.ubt.jimu.controller.data.widget.ControllerData;
|
||||
import com.ubt.jimu.diy.DiyRobotFile;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class EANManufacturerOrgSupport {
|
||||
private final List<int[]> a = new ArrayList();
|
||||
private final List<String> b = new ArrayList();
|
||||
|
||||
EANManufacturerOrgSupport() {
|
||||
}
|
||||
|
||||
String a(String str) {
|
||||
int[] iArr;
|
||||
int i;
|
||||
a();
|
||||
int parseInt = Integer.parseInt(str.substring(0, 3));
|
||||
int size = this.a.size();
|
||||
for (int i2 = 0; i2 < size && parseInt >= (i = (iArr = this.a.get(i2))[0]); i2++) {
|
||||
if (iArr.length != 1) {
|
||||
i = iArr[1];
|
||||
}
|
||||
if (parseInt <= i) {
|
||||
return this.b.get(i2);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void a(int[] iArr, String str) {
|
||||
this.a.add(iArr);
|
||||
this.b.add(str);
|
||||
}
|
||||
|
||||
private synchronized void a() {
|
||||
if (this.a.isEmpty()) {
|
||||
a(new int[]{0, 19}, "US/CA");
|
||||
a(new int[]{30, 39}, "US");
|
||||
a(new int[]{60, 139}, "US/CA");
|
||||
a(new int[]{300, 379}, "FR");
|
||||
a(new int[]{380}, "BG");
|
||||
a(new int[]{383}, "SI");
|
||||
a(new int[]{385}, "HR");
|
||||
a(new int[]{387}, "BA");
|
||||
a(new int[]{400, 440}, "DE");
|
||||
a(new int[]{450, 459}, "JP");
|
||||
a(new int[]{460, 469}, "RU");
|
||||
a(new int[]{471}, "TW");
|
||||
a(new int[]{474}, "EE");
|
||||
a(new int[]{475}, "LV");
|
||||
a(new int[]{476}, "AZ");
|
||||
a(new int[]{477}, "LT");
|
||||
a(new int[]{478}, "UZ");
|
||||
a(new int[]{479}, "LK");
|
||||
a(new int[]{480}, "PH");
|
||||
a(new int[]{481}, "BY");
|
||||
a(new int[]{482}, "UA");
|
||||
a(new int[]{484}, "MD");
|
||||
a(new int[]{485}, "AM");
|
||||
a(new int[]{486}, "GE");
|
||||
a(new int[]{487}, "KZ");
|
||||
a(new int[]{489}, "HK");
|
||||
a(new int[]{490, 499}, "JP");
|
||||
a(new int[]{SingleClickListener.FAST_CLICK_DELAY_TIME, 509}, "GB");
|
||||
a(new int[]{520}, "GR");
|
||||
a(new int[]{528}, "LB");
|
||||
a(new int[]{529}, "CY");
|
||||
a(new int[]{531}, "MK");
|
||||
a(new int[]{535}, "MT");
|
||||
a(new int[]{539}, "IE");
|
||||
a(new int[]{540, 549}, "BE/LU");
|
||||
a(new int[]{560}, "PT");
|
||||
a(new int[]{569}, "IS");
|
||||
a(new int[]{570, 579}, "DK");
|
||||
a(new int[]{590}, "PL");
|
||||
a(new int[]{594}, "RO");
|
||||
a(new int[]{599}, "HU");
|
||||
a(new int[]{600, 601}, "ZA");
|
||||
a(new int[]{603}, "GH");
|
||||
a(new int[]{608}, "BH");
|
||||
a(new int[]{609}, "MU");
|
||||
a(new int[]{611}, "MA");
|
||||
a(new int[]{613}, "DZ");
|
||||
a(new int[]{616}, "KE");
|
||||
a(new int[]{618}, "CI");
|
||||
a(new int[]{619}, "TN");
|
||||
a(new int[]{621}, "SY");
|
||||
a(new int[]{622}, "EG");
|
||||
a(new int[]{624}, "LY");
|
||||
a(new int[]{625}, "JO");
|
||||
a(new int[]{626}, "IR");
|
||||
a(new int[]{627}, "KW");
|
||||
a(new int[]{628}, "SA");
|
||||
a(new int[]{629}, "AE");
|
||||
a(new int[]{640, 649}, "FI");
|
||||
a(new int[]{690, 695}, "CN");
|
||||
a(new int[]{IMediaPlayer.MEDIA_INFO_VIDEO_TRACK_LAGGING, 709}, "NO");
|
||||
a(new int[]{729}, "IL");
|
||||
a(new int[]{730, 739}, "SE");
|
||||
a(new int[]{740}, "GT");
|
||||
a(new int[]{741}, "SV");
|
||||
a(new int[]{742}, "HN");
|
||||
a(new int[]{743}, "NI");
|
||||
a(new int[]{744}, "CR");
|
||||
a(new int[]{745}, "PA");
|
||||
a(new int[]{746}, "DO");
|
||||
a(new int[]{ControllerData.DEFAULT_SCREEN_HEIGHT}, "MX");
|
||||
a(new int[]{754, 755}, "CA");
|
||||
a(new int[]{759}, "VE");
|
||||
a(new int[]{760, DiyRobotFile.TYPE_PROGRAM}, "CH");
|
||||
a(new int[]{770}, "CO");
|
||||
a(new int[]{773}, "UY");
|
||||
a(new int[]{775}, "PE");
|
||||
a(new int[]{777}, "BO");
|
||||
a(new int[]{779}, "AR");
|
||||
a(new int[]{780}, "CL");
|
||||
a(new int[]{784}, "PY");
|
||||
a(new int[]{785}, "PE");
|
||||
a(new int[]{786}, "EC");
|
||||
a(new int[]{789, 790}, "BR");
|
||||
a(new int[]{800, 839}, "IT");
|
||||
a(new int[]{840, 849}, "ES");
|
||||
a(new int[]{850}, "CU");
|
||||
a(new int[]{858}, "SK");
|
||||
a(new int[]{859}, "CZ");
|
||||
a(new int[]{860}, "YU");
|
||||
a(new int[]{865}, "MN");
|
||||
a(new int[]{867}, "KP");
|
||||
a(new int[]{868, 869}, "TR");
|
||||
a(new int[]{870, 879}, "NL");
|
||||
a(new int[]{880}, "KR");
|
||||
a(new int[]{885}, "TH");
|
||||
a(new int[]{888}, "SG");
|
||||
a(new int[]{890}, "IN");
|
||||
a(new int[]{893}, "VN");
|
||||
a(new int[]{896}, "PK");
|
||||
a(new int[]{899}, "ID");
|
||||
a(new int[]{IMediaPlayer.MEDIA_INFO_TIMED_TEXT_ERROR, 919}, "AT");
|
||||
a(new int[]{930, 939}, "AU");
|
||||
a(new int[]{940, 949}, "AZ");
|
||||
a(new int[]{955}, "MY");
|
||||
a(new int[]{958}, "MO");
|
||||
}
|
||||
}
|
||||
}
|
203
sources/com/google/zxing/oned/ITFReader.java
Normal file
203
sources/com/google/zxing/oned/ITFReader.java
Normal file
@@ -0,0 +1,203 @@
|
||||
package com.google.zxing.oned;
|
||||
|
||||
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.ResultPoint;
|
||||
import com.google.zxing.common.BitArray;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class ITFReader extends OneDReader {
|
||||
private static final int[] b = {6, 8, 10, 12, 14};
|
||||
private static final int[] c = {1, 1, 1, 1};
|
||||
private static final int[][] d = {new int[]{1, 1, 2}, new int[]{1, 1, 3}};
|
||||
private static final int[][] e = {new int[]{1, 1, 2, 2, 1}, new int[]{2, 1, 1, 1, 2}, new int[]{1, 2, 1, 1, 2}, new int[]{2, 2, 1, 1, 1}, new int[]{1, 1, 2, 1, 2}, new int[]{2, 1, 2, 1, 1}, new int[]{1, 2, 2, 1, 1}, new int[]{1, 1, 1, 2, 2}, new int[]{2, 1, 1, 2, 1}, new int[]{1, 2, 1, 2, 1}, new int[]{1, 1, 3, 3, 1}, new int[]{3, 1, 1, 1, 3}, new int[]{1, 3, 1, 1, 3}, new int[]{3, 3, 1, 1, 1}, new int[]{1, 1, 3, 1, 3}, new int[]{3, 1, 3, 1, 1}, new int[]{1, 3, 3, 1, 1}, new int[]{1, 1, 1, 3, 3}, new int[]{3, 1, 1, 3, 1}, new int[]{1, 3, 1, 3, 1}};
|
||||
private int a = -1;
|
||||
|
||||
private int[] b(BitArray bitArray) throws NotFoundException {
|
||||
int[] c2 = c(bitArray, c(bitArray), c);
|
||||
this.a = (c2[1] - c2[0]) / 4;
|
||||
a(bitArray, c2[0]);
|
||||
return c2;
|
||||
}
|
||||
|
||||
private static int c(BitArray bitArray) throws NotFoundException {
|
||||
int h = bitArray.h();
|
||||
int b2 = bitArray.b(0);
|
||||
if (b2 != h) {
|
||||
return b2;
|
||||
}
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.oned.OneDReader
|
||||
public Result a(int i, BitArray bitArray, Map<DecodeHintType, ?> map) throws FormatException, NotFoundException {
|
||||
boolean z;
|
||||
int[] b2 = b(bitArray);
|
||||
int[] a = a(bitArray);
|
||||
StringBuilder sb = new StringBuilder(20);
|
||||
a(bitArray, b2[1], a[0], sb);
|
||||
String sb2 = sb.toString();
|
||||
int[] iArr = map != null ? (int[]) map.get(DecodeHintType.ALLOWED_LENGTHS) : null;
|
||||
if (iArr == null) {
|
||||
iArr = b;
|
||||
}
|
||||
int length = sb2.length();
|
||||
int length2 = iArr.length;
|
||||
int i2 = 0;
|
||||
int i3 = 0;
|
||||
while (true) {
|
||||
if (i2 >= length2) {
|
||||
z = false;
|
||||
break;
|
||||
}
|
||||
int i4 = iArr[i2];
|
||||
if (length == i4) {
|
||||
z = true;
|
||||
break;
|
||||
}
|
||||
if (i4 > i3) {
|
||||
i3 = i4;
|
||||
}
|
||||
i2++;
|
||||
}
|
||||
if (!z && length > i3) {
|
||||
z = true;
|
||||
}
|
||||
if (!z) {
|
||||
throw FormatException.getFormatInstance();
|
||||
}
|
||||
float f = i;
|
||||
return new Result(sb2, null, new ResultPoint[]{new ResultPoint(b2[1], f), new ResultPoint(a[0], f)}, BarcodeFormat.ITF);
|
||||
}
|
||||
|
||||
private static int[] c(BitArray bitArray, int i, int[] iArr) throws NotFoundException {
|
||||
int length = iArr.length;
|
||||
int[] iArr2 = new int[length];
|
||||
int h = bitArray.h();
|
||||
int i2 = i;
|
||||
boolean z = false;
|
||||
int i3 = 0;
|
||||
while (i < h) {
|
||||
if (bitArray.a(i) != z) {
|
||||
iArr2[i3] = iArr2[i3] + 1;
|
||||
} else {
|
||||
if (i3 != length - 1) {
|
||||
i3++;
|
||||
} else {
|
||||
if (OneDReader.a(iArr2, iArr, 0.5f) < 0.38f) {
|
||||
return new int[]{i2, i};
|
||||
}
|
||||
i2 += iArr2[0] + iArr2[1];
|
||||
int i4 = i3 - 1;
|
||||
System.arraycopy(iArr2, 2, iArr2, 0, i4);
|
||||
iArr2[i4] = 0;
|
||||
iArr2[i3] = 0;
|
||||
i3--;
|
||||
}
|
||||
iArr2[i3] = 1;
|
||||
z = !z;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
|
||||
private static void a(BitArray bitArray, int i, int i2, StringBuilder sb) throws NotFoundException {
|
||||
int[] iArr = new int[10];
|
||||
int[] iArr2 = new int[5];
|
||||
int[] iArr3 = new int[5];
|
||||
while (i < i2) {
|
||||
OneDReader.a(bitArray, i, iArr);
|
||||
for (int i3 = 0; i3 < 5; i3++) {
|
||||
int i4 = i3 * 2;
|
||||
iArr2[i3] = iArr[i4];
|
||||
iArr3[i3] = iArr[i4 + 1];
|
||||
}
|
||||
sb.append((char) (a(iArr2) + 48));
|
||||
sb.append((char) (a(iArr3) + 48));
|
||||
for (int i5 = 0; i5 < 10; i5++) {
|
||||
i += iArr[i5];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX WARN: Code restructure failed: missing block: B:12:0x001b, code lost:
|
||||
|
||||
return;
|
||||
*/
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
||||
*/
|
||||
private void a(com.google.zxing.common.BitArray r3, int r4) throws com.google.zxing.NotFoundException {
|
||||
/*
|
||||
r2 = this;
|
||||
int r0 = r2.a
|
||||
int r0 = r0 * 10
|
||||
if (r0 >= r4) goto L7
|
||||
goto L8
|
||||
L7:
|
||||
r0 = r4
|
||||
L8:
|
||||
int r4 = r4 + (-1)
|
||||
La:
|
||||
if (r0 <= 0) goto L19
|
||||
if (r4 < 0) goto L19
|
||||
boolean r1 = r3.a(r4)
|
||||
if (r1 != 0) goto L19
|
||||
int r0 = r0 + (-1)
|
||||
int r4 = r4 + (-1)
|
||||
goto La
|
||||
L19:
|
||||
if (r0 != 0) goto L1c
|
||||
return
|
||||
L1c:
|
||||
com.google.zxing.NotFoundException r3 = com.google.zxing.NotFoundException.getNotFoundInstance()
|
||||
throw r3
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: com.google.zxing.oned.ITFReader.a(com.google.zxing.common.BitArray, int):void");
|
||||
}
|
||||
|
||||
private int[] a(BitArray bitArray) throws NotFoundException {
|
||||
int[] c2;
|
||||
bitArray.j();
|
||||
try {
|
||||
int c3 = c(bitArray);
|
||||
try {
|
||||
c2 = c(bitArray, c3, d[0]);
|
||||
} catch (NotFoundException unused) {
|
||||
c2 = c(bitArray, c3, d[1]);
|
||||
}
|
||||
a(bitArray, c2[0]);
|
||||
int i = c2[0];
|
||||
c2[0] = bitArray.h() - c2[1];
|
||||
c2[1] = bitArray.h() - i;
|
||||
return c2;
|
||||
} finally {
|
||||
bitArray.j();
|
||||
}
|
||||
}
|
||||
|
||||
private static int a(int[] iArr) throws NotFoundException {
|
||||
int length = e.length;
|
||||
int i = -1;
|
||||
float f = 0.38f;
|
||||
for (int i2 = 0; i2 < length; i2++) {
|
||||
float a = OneDReader.a(iArr, e[i2], 0.5f);
|
||||
if (a < f) {
|
||||
i = i2;
|
||||
f = a;
|
||||
} else if (a == f) {
|
||||
i = -1;
|
||||
}
|
||||
}
|
||||
if (i >= 0) {
|
||||
return i % 10;
|
||||
}
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
}
|
49
sources/com/google/zxing/oned/ITFWriter.java
Normal file
49
sources/com/google/zxing/oned/ITFWriter.java
Normal file
@@ -0,0 +1,49 @@
|
||||
package com.google.zxing.oned;
|
||||
|
||||
import com.google.zxing.BarcodeFormat;
|
||||
import com.google.zxing.EncodeHintType;
|
||||
import com.google.zxing.WriterException;
|
||||
import com.google.zxing.common.BitMatrix;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class ITFWriter extends OneDimensionalCodeWriter {
|
||||
private static final int[] a = {1, 1, 1, 1};
|
||||
private static final int[] b = {3, 1, 1};
|
||||
private static final int[][] c = {new int[]{1, 1, 3, 3, 1}, new int[]{3, 1, 1, 1, 3}, new int[]{1, 3, 1, 1, 3}, new int[]{3, 3, 1, 1, 1}, new int[]{1, 1, 3, 1, 3}, new int[]{3, 1, 3, 1, 1}, new int[]{1, 3, 3, 1, 1}, new int[]{1, 1, 1, 3, 3}, new int[]{3, 1, 1, 3, 1}, new int[]{1, 3, 1, 3, 1}};
|
||||
|
||||
@Override // com.google.zxing.oned.OneDimensionalCodeWriter, com.google.zxing.Writer
|
||||
public BitMatrix a(String str, BarcodeFormat barcodeFormat, int i, int i2, Map<EncodeHintType, ?> map) throws WriterException {
|
||||
if (barcodeFormat == BarcodeFormat.ITF) {
|
||||
return super.a(str, barcodeFormat, i, i2, map);
|
||||
}
|
||||
throw new IllegalArgumentException("Can only encode ITF, but got ".concat(String.valueOf(barcodeFormat)));
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.oned.OneDimensionalCodeWriter
|
||||
public boolean[] a(String str) {
|
||||
int length = str.length();
|
||||
if (length % 2 != 0) {
|
||||
throw new IllegalArgumentException("The length of the input should be even");
|
||||
}
|
||||
if (length <= 80) {
|
||||
boolean[] zArr = new boolean[(length * 9) + 9];
|
||||
int a2 = OneDimensionalCodeWriter.a(zArr, 0, a, true);
|
||||
for (int i = 0; i < length; i += 2) {
|
||||
int digit = Character.digit(str.charAt(i), 10);
|
||||
int digit2 = Character.digit(str.charAt(i + 1), 10);
|
||||
int[] iArr = new int[10];
|
||||
for (int i2 = 0; i2 < 5; i2++) {
|
||||
int i3 = i2 * 2;
|
||||
int[][] iArr2 = c;
|
||||
iArr[i3] = iArr2[digit][i2];
|
||||
iArr[i3 + 1] = iArr2[digit2][i2];
|
||||
}
|
||||
a2 += OneDimensionalCodeWriter.a(zArr, a2, iArr, true);
|
||||
}
|
||||
OneDimensionalCodeWriter.a(zArr, a2, b, true);
|
||||
return zArr;
|
||||
}
|
||||
throw new IllegalArgumentException("Requested contents should be less than 80 digits long, but got ".concat(String.valueOf(length)));
|
||||
}
|
||||
}
|
79
sources/com/google/zxing/oned/MultiFormatOneDReader.java
Normal file
79
sources/com/google/zxing/oned/MultiFormatOneDReader.java
Normal file
@@ -0,0 +1,79 @@
|
||||
package com.google.zxing.oned;
|
||||
|
||||
import com.google.zxing.BarcodeFormat;
|
||||
import com.google.zxing.DecodeHintType;
|
||||
import com.google.zxing.NotFoundException;
|
||||
import com.google.zxing.ReaderException;
|
||||
import com.google.zxing.Result;
|
||||
import com.google.zxing.common.BitArray;
|
||||
import com.google.zxing.oned.rss.RSS14Reader;
|
||||
import com.google.zxing.oned.rss.expanded.RSSExpandedReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class MultiFormatOneDReader extends OneDReader {
|
||||
private final OneDReader[] a;
|
||||
|
||||
public MultiFormatOneDReader(Map<DecodeHintType, ?> map) {
|
||||
Collection collection = map == null ? null : (Collection) map.get(DecodeHintType.POSSIBLE_FORMATS);
|
||||
boolean z = (map == null || map.get(DecodeHintType.ASSUME_CODE_39_CHECK_DIGIT) == null) ? false : true;
|
||||
ArrayList arrayList = new ArrayList();
|
||||
if (collection != null) {
|
||||
if (collection.contains(BarcodeFormat.EAN_13) || collection.contains(BarcodeFormat.UPC_A) || collection.contains(BarcodeFormat.EAN_8) || collection.contains(BarcodeFormat.UPC_E)) {
|
||||
arrayList.add(new MultiFormatUPCEANReader(map));
|
||||
}
|
||||
if (collection.contains(BarcodeFormat.CODE_39)) {
|
||||
arrayList.add(new Code39Reader(z));
|
||||
}
|
||||
if (collection.contains(BarcodeFormat.CODE_93)) {
|
||||
arrayList.add(new Code93Reader());
|
||||
}
|
||||
if (collection.contains(BarcodeFormat.CODE_128)) {
|
||||
arrayList.add(new Code128Reader());
|
||||
}
|
||||
if (collection.contains(BarcodeFormat.ITF)) {
|
||||
arrayList.add(new ITFReader());
|
||||
}
|
||||
if (collection.contains(BarcodeFormat.CODABAR)) {
|
||||
arrayList.add(new CodaBarReader());
|
||||
}
|
||||
if (collection.contains(BarcodeFormat.RSS_14)) {
|
||||
arrayList.add(new RSS14Reader());
|
||||
}
|
||||
if (collection.contains(BarcodeFormat.RSS_EXPANDED)) {
|
||||
arrayList.add(new RSSExpandedReader());
|
||||
}
|
||||
}
|
||||
if (arrayList.isEmpty()) {
|
||||
arrayList.add(new MultiFormatUPCEANReader(map));
|
||||
arrayList.add(new Code39Reader());
|
||||
arrayList.add(new CodaBarReader());
|
||||
arrayList.add(new Code93Reader());
|
||||
arrayList.add(new Code128Reader());
|
||||
arrayList.add(new ITFReader());
|
||||
arrayList.add(new RSS14Reader());
|
||||
arrayList.add(new RSSExpandedReader());
|
||||
}
|
||||
this.a = (OneDReader[]) arrayList.toArray(new OneDReader[arrayList.size()]);
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.oned.OneDReader
|
||||
public Result a(int i, BitArray bitArray, Map<DecodeHintType, ?> map) throws NotFoundException {
|
||||
for (OneDReader oneDReader : this.a) {
|
||||
try {
|
||||
return oneDReader.a(i, bitArray, map);
|
||||
} catch (ReaderException unused) {
|
||||
}
|
||||
}
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.oned.OneDReader, com.google.zxing.Reader
|
||||
public void reset() {
|
||||
for (OneDReader oneDReader : this.a) {
|
||||
oneDReader.reset();
|
||||
}
|
||||
}
|
||||
}
|
75
sources/com/google/zxing/oned/MultiFormatUPCEANReader.java
Normal file
75
sources/com/google/zxing/oned/MultiFormatUPCEANReader.java
Normal file
@@ -0,0 +1,75 @@
|
||||
package com.google.zxing.oned;
|
||||
|
||||
import com.google.zxing.BarcodeFormat;
|
||||
import com.google.zxing.DecodeHintType;
|
||||
import com.google.zxing.NotFoundException;
|
||||
import com.google.zxing.ReaderException;
|
||||
import com.google.zxing.Result;
|
||||
import com.google.zxing.common.BitArray;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class MultiFormatUPCEANReader extends OneDReader {
|
||||
private final UPCEANReader[] a;
|
||||
|
||||
public MultiFormatUPCEANReader(Map<DecodeHintType, ?> map) {
|
||||
Collection collection = map == null ? null : (Collection) map.get(DecodeHintType.POSSIBLE_FORMATS);
|
||||
ArrayList arrayList = new ArrayList();
|
||||
if (collection != null) {
|
||||
if (collection.contains(BarcodeFormat.EAN_13)) {
|
||||
arrayList.add(new EAN13Reader());
|
||||
} else if (collection.contains(BarcodeFormat.UPC_A)) {
|
||||
arrayList.add(new UPCAReader());
|
||||
}
|
||||
if (collection.contains(BarcodeFormat.EAN_8)) {
|
||||
arrayList.add(new EAN8Reader());
|
||||
}
|
||||
if (collection.contains(BarcodeFormat.UPC_E)) {
|
||||
arrayList.add(new UPCEReader());
|
||||
}
|
||||
}
|
||||
if (arrayList.isEmpty()) {
|
||||
arrayList.add(new EAN13Reader());
|
||||
arrayList.add(new EAN8Reader());
|
||||
arrayList.add(new UPCEReader());
|
||||
}
|
||||
this.a = (UPCEANReader[]) arrayList.toArray(new UPCEANReader[arrayList.size()]);
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.oned.OneDReader
|
||||
public Result a(int i, BitArray bitArray, Map<DecodeHintType, ?> map) throws NotFoundException {
|
||||
boolean z;
|
||||
int[] a = UPCEANReader.a(bitArray);
|
||||
for (UPCEANReader uPCEANReader : this.a) {
|
||||
try {
|
||||
Result a2 = uPCEANReader.a(i, bitArray, a, map);
|
||||
boolean z2 = a2.a() == BarcodeFormat.EAN_13 && a2.e().charAt(0) == '0';
|
||||
Collection collection = map == null ? null : (Collection) map.get(DecodeHintType.POSSIBLE_FORMATS);
|
||||
if (collection != null && !collection.contains(BarcodeFormat.UPC_A)) {
|
||||
z = false;
|
||||
if (z2 || !z) {
|
||||
return a2;
|
||||
}
|
||||
Result result = new Result(a2.e().substring(1), a2.b(), a2.d(), BarcodeFormat.UPC_A);
|
||||
result.a(a2.c());
|
||||
return result;
|
||||
}
|
||||
z = true;
|
||||
if (z2) {
|
||||
}
|
||||
return a2;
|
||||
} catch (ReaderException unused) {
|
||||
}
|
||||
}
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.oned.OneDReader, com.google.zxing.Reader
|
||||
public void reset() {
|
||||
for (UPCEANReader uPCEANReader : this.a) {
|
||||
uPCEANReader.reset();
|
||||
}
|
||||
}
|
||||
}
|
196
sources/com/google/zxing/oned/OneDReader.java
Normal file
196
sources/com/google/zxing/oned/OneDReader.java
Normal file
@@ -0,0 +1,196 @@
|
||||
package com.google.zxing.oned;
|
||||
|
||||
import com.google.zxing.BinaryBitmap;
|
||||
import com.google.zxing.ChecksumException;
|
||||
import com.google.zxing.DecodeHintType;
|
||||
import com.google.zxing.FormatException;
|
||||
import com.google.zxing.NotFoundException;
|
||||
import com.google.zxing.Reader;
|
||||
import com.google.zxing.ReaderException;
|
||||
import com.google.zxing.Result;
|
||||
import com.google.zxing.ResultMetadataType;
|
||||
import com.google.zxing.ResultPoint;
|
||||
import com.google.zxing.common.BitArray;
|
||||
import java.util.Arrays;
|
||||
import java.util.EnumMap;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public abstract class OneDReader implements Reader {
|
||||
private Result b(BinaryBitmap binaryBitmap, Map<DecodeHintType, ?> map) throws NotFoundException {
|
||||
int i;
|
||||
int i2;
|
||||
int c = binaryBitmap.c();
|
||||
int b = binaryBitmap.b();
|
||||
BitArray bitArray = new BitArray(c);
|
||||
char c2 = 0;
|
||||
int i3 = 1;
|
||||
boolean z = map != null && map.containsKey(DecodeHintType.TRY_HARDER);
|
||||
int max = Math.max(1, b >> (z ? 8 : 5));
|
||||
int i4 = z ? b : 15;
|
||||
int i5 = b / 2;
|
||||
Map<DecodeHintType, ?> map2 = map;
|
||||
int i6 = 0;
|
||||
while (i6 < i4) {
|
||||
int i7 = i6 + 1;
|
||||
int i8 = i7 / 2;
|
||||
if (!((i6 & 1) == 0)) {
|
||||
i8 = -i8;
|
||||
}
|
||||
int i9 = (i8 * max) + i5;
|
||||
if (i9 < 0 || i9 >= b) {
|
||||
break;
|
||||
}
|
||||
try {
|
||||
bitArray = binaryBitmap.a(i9, bitArray);
|
||||
Map<DecodeHintType, ?> map3 = map2;
|
||||
int i10 = 0;
|
||||
while (i10 < 2) {
|
||||
if (i10 == i3) {
|
||||
bitArray.j();
|
||||
if (map3 != null && map3.containsKey(DecodeHintType.NEED_RESULT_POINT_CALLBACK)) {
|
||||
EnumMap enumMap = new EnumMap(DecodeHintType.class);
|
||||
enumMap.putAll(map3);
|
||||
enumMap.remove(DecodeHintType.NEED_RESULT_POINT_CALLBACK);
|
||||
map3 = enumMap;
|
||||
}
|
||||
}
|
||||
try {
|
||||
Result a = a(i9, bitArray, map3);
|
||||
if (i10 == i3) {
|
||||
a.a(ResultMetadataType.ORIENTATION, 180);
|
||||
ResultPoint[] d = a.d();
|
||||
if (d != null) {
|
||||
float f = c;
|
||||
i2 = c;
|
||||
try {
|
||||
d[0] = new ResultPoint((f - d[c2].a()) - 1.0f, d[c2].b());
|
||||
try {
|
||||
d[1] = new ResultPoint((f - d[1].a()) - 1.0f, d[1].b());
|
||||
} catch (ReaderException unused) {
|
||||
continue;
|
||||
i10++;
|
||||
c = i2;
|
||||
c2 = 0;
|
||||
i3 = 1;
|
||||
}
|
||||
} catch (ReaderException unused2) {
|
||||
i10++;
|
||||
c = i2;
|
||||
c2 = 0;
|
||||
i3 = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return a;
|
||||
} catch (ReaderException unused3) {
|
||||
i2 = c;
|
||||
}
|
||||
}
|
||||
i = c;
|
||||
map2 = map3;
|
||||
} catch (NotFoundException unused4) {
|
||||
i = c;
|
||||
}
|
||||
i6 = i7;
|
||||
c = i;
|
||||
c2 = 0;
|
||||
i3 = 1;
|
||||
}
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
|
||||
public abstract Result a(int i, BitArray bitArray, Map<DecodeHintType, ?> map) throws NotFoundException, ChecksumException, FormatException;
|
||||
|
||||
@Override // com.google.zxing.Reader
|
||||
public Result a(BinaryBitmap binaryBitmap, Map<DecodeHintType, ?> map) throws NotFoundException, FormatException {
|
||||
try {
|
||||
return b(binaryBitmap, map);
|
||||
} catch (NotFoundException e) {
|
||||
if (!(map != null && map.containsKey(DecodeHintType.TRY_HARDER)) || !binaryBitmap.d()) {
|
||||
throw e;
|
||||
}
|
||||
binaryBitmap.e();
|
||||
throw null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.Reader
|
||||
public void reset() {
|
||||
}
|
||||
|
||||
protected static void a(BitArray bitArray, int i, int[] iArr) throws NotFoundException {
|
||||
int length = iArr.length;
|
||||
int i2 = 0;
|
||||
Arrays.fill(iArr, 0, length, 0);
|
||||
int h = bitArray.h();
|
||||
if (i < h) {
|
||||
boolean z = !bitArray.a(i);
|
||||
while (i < h) {
|
||||
if (bitArray.a(i) == z) {
|
||||
i2++;
|
||||
if (i2 == length) {
|
||||
break;
|
||||
}
|
||||
iArr[i2] = 1;
|
||||
z = !z;
|
||||
} else {
|
||||
iArr[i2] = iArr[i2] + 1;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if (i2 != length) {
|
||||
if (i2 != length - 1 || i != h) {
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
|
||||
protected static float a(int[] iArr, int[] iArr2, float f) {
|
||||
int length = iArr.length;
|
||||
int i = 0;
|
||||
int i2 = 0;
|
||||
for (int i3 = 0; i3 < length; i3++) {
|
||||
i += iArr[i3];
|
||||
i2 += iArr2[i3];
|
||||
}
|
||||
if (i < i2) {
|
||||
return Float.POSITIVE_INFINITY;
|
||||
}
|
||||
float f2 = i;
|
||||
float f3 = f2 / i2;
|
||||
float f4 = f * f3;
|
||||
float f5 = 0.0f;
|
||||
for (int i4 = 0; i4 < length; i4++) {
|
||||
float f6 = iArr2[i4] * f3;
|
||||
float f7 = iArr[i4];
|
||||
float f8 = f7 > f6 ? f7 - f6 : f6 - f7;
|
||||
if (f8 > f4) {
|
||||
return Float.POSITIVE_INFINITY;
|
||||
}
|
||||
f5 += f8;
|
||||
}
|
||||
return f5 / f2;
|
||||
}
|
||||
|
||||
protected static void b(BitArray bitArray, int i, int[] iArr) throws NotFoundException {
|
||||
int length = iArr.length;
|
||||
boolean a = bitArray.a(i);
|
||||
while (i > 0 && length >= 0) {
|
||||
i--;
|
||||
if (bitArray.a(i) != a) {
|
||||
length--;
|
||||
a = !a;
|
||||
}
|
||||
}
|
||||
if (length < 0) {
|
||||
a(bitArray, i + 1, iArr);
|
||||
return;
|
||||
}
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
}
|
74
sources/com/google/zxing/oned/OneDimensionalCodeWriter.java
Normal file
74
sources/com/google/zxing/oned/OneDimensionalCodeWriter.java
Normal file
@@ -0,0 +1,74 @@
|
||||
package com.google.zxing.oned;
|
||||
|
||||
import com.google.zxing.BarcodeFormat;
|
||||
import com.google.zxing.EncodeHintType;
|
||||
import com.google.zxing.Writer;
|
||||
import com.google.zxing.WriterException;
|
||||
import com.google.zxing.common.BitMatrix;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public abstract class OneDimensionalCodeWriter implements Writer {
|
||||
public int a() {
|
||||
return 10;
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.Writer
|
||||
public BitMatrix a(String str, BarcodeFormat barcodeFormat, int i, int i2, Map<EncodeHintType, ?> map) throws WriterException {
|
||||
if (str.isEmpty()) {
|
||||
throw new IllegalArgumentException("Found empty contents");
|
||||
}
|
||||
if (i < 0 || i2 < 0) {
|
||||
throw new IllegalArgumentException("Negative size is not allowed. Input: " + i + 'x' + i2);
|
||||
}
|
||||
int a = a();
|
||||
if (map != null && map.containsKey(EncodeHintType.MARGIN)) {
|
||||
a = Integer.parseInt(map.get(EncodeHintType.MARGIN).toString());
|
||||
}
|
||||
return a(a(str), i, i2, a);
|
||||
}
|
||||
|
||||
public abstract boolean[] a(String str);
|
||||
|
||||
private static BitMatrix a(boolean[] zArr, int i, int i2, int i3) {
|
||||
int length = zArr.length;
|
||||
int i4 = i3 + length;
|
||||
int max = Math.max(i, i4);
|
||||
int max2 = Math.max(1, i2);
|
||||
int i5 = max / i4;
|
||||
BitMatrix bitMatrix = new BitMatrix(max, max2);
|
||||
int i6 = (max - (length * i5)) / 2;
|
||||
int i7 = 0;
|
||||
while (i7 < length) {
|
||||
if (zArr[i7]) {
|
||||
bitMatrix.a(i6, 0, i5, max2);
|
||||
}
|
||||
i7++;
|
||||
i6 += i5;
|
||||
}
|
||||
return bitMatrix;
|
||||
}
|
||||
|
||||
protected static int a(boolean[] zArr, int i, int[] iArr, boolean z) {
|
||||
int length = iArr.length;
|
||||
int i2 = i;
|
||||
boolean z2 = z;
|
||||
int i3 = 0;
|
||||
int i4 = 0;
|
||||
while (i3 < length) {
|
||||
int i5 = iArr[i3];
|
||||
int i6 = i2;
|
||||
int i7 = 0;
|
||||
while (i7 < i5) {
|
||||
zArr[i6] = z2;
|
||||
i7++;
|
||||
i6++;
|
||||
}
|
||||
i4 += i5;
|
||||
z2 = !z2;
|
||||
i3++;
|
||||
i2 = i6;
|
||||
}
|
||||
return i4;
|
||||
}
|
||||
}
|
53
sources/com/google/zxing/oned/UPCAReader.java
Normal file
53
sources/com/google/zxing/oned/UPCAReader.java
Normal file
@@ -0,0 +1,53 @@
|
||||
package com.google.zxing.oned;
|
||||
|
||||
import com.google.zxing.BarcodeFormat;
|
||||
import com.google.zxing.BinaryBitmap;
|
||||
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.common.BitArray;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class UPCAReader extends UPCEANReader {
|
||||
private final UPCEANReader i = new EAN13Reader();
|
||||
|
||||
@Override // com.google.zxing.oned.UPCEANReader
|
||||
public Result a(int i, BitArray bitArray, int[] iArr, Map<DecodeHintType, ?> map) throws NotFoundException, FormatException, ChecksumException {
|
||||
return a(this.i.a(i, bitArray, iArr, map));
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.oned.UPCEANReader, com.google.zxing.oned.OneDReader
|
||||
public Result a(int i, BitArray bitArray, Map<DecodeHintType, ?> map) throws NotFoundException, FormatException, ChecksumException {
|
||||
return a(this.i.a(i, bitArray, map));
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.oned.OneDReader, com.google.zxing.Reader
|
||||
public Result a(BinaryBitmap binaryBitmap, Map<DecodeHintType, ?> map) throws NotFoundException, FormatException {
|
||||
return a(this.i.a(binaryBitmap, map));
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.oned.UPCEANReader
|
||||
BarcodeFormat a() {
|
||||
return BarcodeFormat.UPC_A;
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.oned.UPCEANReader
|
||||
protected int a(BitArray bitArray, int[] iArr, StringBuilder sb) throws NotFoundException {
|
||||
return this.i.a(bitArray, iArr, sb);
|
||||
}
|
||||
|
||||
private static Result a(Result result) throws FormatException {
|
||||
String e = result.e();
|
||||
if (e.charAt(0) == '0') {
|
||||
Result result2 = new Result(e.substring(1), null, result.d(), BarcodeFormat.UPC_A);
|
||||
if (result.c() != null) {
|
||||
result2.a(result.c());
|
||||
}
|
||||
return result2;
|
||||
}
|
||||
throw FormatException.getFormatInstance();
|
||||
}
|
||||
}
|
21
sources/com/google/zxing/oned/UPCAWriter.java
Normal file
21
sources/com/google/zxing/oned/UPCAWriter.java
Normal file
@@ -0,0 +1,21 @@
|
||||
package com.google.zxing.oned;
|
||||
|
||||
import com.google.zxing.BarcodeFormat;
|
||||
import com.google.zxing.EncodeHintType;
|
||||
import com.google.zxing.Writer;
|
||||
import com.google.zxing.WriterException;
|
||||
import com.google.zxing.common.BitMatrix;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class UPCAWriter implements Writer {
|
||||
private final EAN13Writer a = new EAN13Writer();
|
||||
|
||||
@Override // com.google.zxing.Writer
|
||||
public BitMatrix a(String str, BarcodeFormat barcodeFormat, int i, int i2, Map<EncodeHintType, ?> map) throws WriterException {
|
||||
if (barcodeFormat == BarcodeFormat.UPC_A) {
|
||||
return this.a.a("0".concat(String.valueOf(str)), BarcodeFormat.EAN_13, i, i2, map);
|
||||
}
|
||||
throw new IllegalArgumentException("Can only encode UPC-A, but got ".concat(String.valueOf(barcodeFormat)));
|
||||
}
|
||||
}
|
74
sources/com/google/zxing/oned/UPCEANExtension2Support.java
Normal file
74
sources/com/google/zxing/oned/UPCEANExtension2Support.java
Normal file
@@ -0,0 +1,74 @@
|
||||
package com.google.zxing.oned;
|
||||
|
||||
import com.google.zxing.BarcodeFormat;
|
||||
import com.google.zxing.NotFoundException;
|
||||
import com.google.zxing.Result;
|
||||
import com.google.zxing.ResultMetadataType;
|
||||
import com.google.zxing.ResultPoint;
|
||||
import com.google.zxing.common.BitArray;
|
||||
import java.util.EnumMap;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class UPCEANExtension2Support {
|
||||
private final int[] a = new int[4];
|
||||
private final StringBuilder b = new StringBuilder();
|
||||
|
||||
UPCEANExtension2Support() {
|
||||
}
|
||||
|
||||
Result a(int i, BitArray bitArray, int[] iArr) throws NotFoundException {
|
||||
StringBuilder sb = this.b;
|
||||
sb.setLength(0);
|
||||
int a = a(bitArray, iArr, sb);
|
||||
String sb2 = sb.toString();
|
||||
Map<ResultMetadataType, Object> a2 = a(sb2);
|
||||
float f = i;
|
||||
Result result = new Result(sb2, null, new ResultPoint[]{new ResultPoint((iArr[0] + iArr[1]) / 2.0f, f), new ResultPoint(a, f)}, BarcodeFormat.UPC_EAN_EXTENSION);
|
||||
if (a2 != null) {
|
||||
result.a(a2);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private int a(BitArray bitArray, int[] iArr, StringBuilder sb) throws NotFoundException {
|
||||
int[] iArr2 = this.a;
|
||||
iArr2[0] = 0;
|
||||
iArr2[1] = 0;
|
||||
iArr2[2] = 0;
|
||||
iArr2[3] = 0;
|
||||
int h = bitArray.h();
|
||||
int i = iArr[1];
|
||||
int i2 = 0;
|
||||
int i3 = 0;
|
||||
while (i2 < 2 && i < h) {
|
||||
int a = UPCEANReader.a(bitArray, iArr2, i, UPCEANReader.h);
|
||||
sb.append((char) ((a % 10) + 48));
|
||||
int i4 = i;
|
||||
for (int i5 : iArr2) {
|
||||
i4 += i5;
|
||||
}
|
||||
if (a >= 10) {
|
||||
i3 = (1 << (1 - i2)) | i3;
|
||||
}
|
||||
i = i2 != 1 ? bitArray.c(bitArray.b(i4)) : i4;
|
||||
i2++;
|
||||
}
|
||||
if (sb.length() == 2) {
|
||||
if (Integer.parseInt(sb.toString()) % 4 == i3) {
|
||||
return i;
|
||||
}
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
|
||||
private static Map<ResultMetadataType, Object> a(String str) {
|
||||
if (str.length() != 2) {
|
||||
return null;
|
||||
}
|
||||
EnumMap enumMap = new EnumMap(ResultMetadataType.class);
|
||||
enumMap.put((EnumMap) ResultMetadataType.ISSUE_NUMBER, (ResultMetadataType) Integer.valueOf(str));
|
||||
return enumMap;
|
||||
}
|
||||
}
|
198
sources/com/google/zxing/oned/UPCEANExtension5Support.java
Normal file
198
sources/com/google/zxing/oned/UPCEANExtension5Support.java
Normal file
@@ -0,0 +1,198 @@
|
||||
package com.google.zxing.oned;
|
||||
|
||||
import com.google.zxing.BarcodeFormat;
|
||||
import com.google.zxing.NotFoundException;
|
||||
import com.google.zxing.Result;
|
||||
import com.google.zxing.ResultMetadataType;
|
||||
import com.google.zxing.ResultPoint;
|
||||
import com.google.zxing.common.BitArray;
|
||||
import java.util.EnumMap;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class UPCEANExtension5Support {
|
||||
private static final int[] c = {24, 20, 18, 17, 12, 6, 3, 10, 9, 5};
|
||||
private final int[] a = new int[4];
|
||||
private final StringBuilder b = new StringBuilder();
|
||||
|
||||
UPCEANExtension5Support() {
|
||||
}
|
||||
|
||||
private static Map<ResultMetadataType, Object> b(String str) {
|
||||
String a;
|
||||
if (str.length() != 5 || (a = a(str)) == null) {
|
||||
return null;
|
||||
}
|
||||
EnumMap enumMap = new EnumMap(ResultMetadataType.class);
|
||||
enumMap.put((EnumMap) ResultMetadataType.SUGGESTED_PRICE, (ResultMetadataType) a);
|
||||
return enumMap;
|
||||
}
|
||||
|
||||
Result a(int i, BitArray bitArray, int[] iArr) throws NotFoundException {
|
||||
StringBuilder sb = this.b;
|
||||
sb.setLength(0);
|
||||
int a = a(bitArray, iArr, sb);
|
||||
String sb2 = sb.toString();
|
||||
Map<ResultMetadataType, Object> b = b(sb2);
|
||||
float f = i;
|
||||
Result result = new Result(sb2, null, new ResultPoint[]{new ResultPoint((iArr[0] + iArr[1]) / 2.0f, f), new ResultPoint(a, f)}, BarcodeFormat.UPC_EAN_EXTENSION);
|
||||
if (b != null) {
|
||||
result.a(b);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private int a(BitArray bitArray, int[] iArr, StringBuilder sb) throws NotFoundException {
|
||||
int[] iArr2 = this.a;
|
||||
iArr2[0] = 0;
|
||||
iArr2[1] = 0;
|
||||
iArr2[2] = 0;
|
||||
iArr2[3] = 0;
|
||||
int h = bitArray.h();
|
||||
int i = iArr[1];
|
||||
int i2 = 0;
|
||||
int i3 = 0;
|
||||
while (i2 < 5 && i < h) {
|
||||
int a = UPCEANReader.a(bitArray, iArr2, i, UPCEANReader.h);
|
||||
sb.append((char) ((a % 10) + 48));
|
||||
int i4 = i;
|
||||
for (int i5 : iArr2) {
|
||||
i4 += i5;
|
||||
}
|
||||
if (a >= 10) {
|
||||
i3 |= 1 << (4 - i2);
|
||||
}
|
||||
i = i2 != 4 ? bitArray.c(bitArray.b(i4)) : i4;
|
||||
i2++;
|
||||
}
|
||||
if (sb.length() == 5) {
|
||||
if (a((CharSequence) sb.toString()) == a(i3)) {
|
||||
return i;
|
||||
}
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
|
||||
private static int a(CharSequence charSequence) {
|
||||
int length = charSequence.length();
|
||||
int i = 0;
|
||||
for (int i2 = length - 2; i2 >= 0; i2 -= 2) {
|
||||
i += charSequence.charAt(i2) - '0';
|
||||
}
|
||||
int i3 = i * 3;
|
||||
for (int i4 = length - 1; i4 >= 0; i4 -= 2) {
|
||||
i3 += charSequence.charAt(i4) - '0';
|
||||
}
|
||||
return (i3 * 3) % 10;
|
||||
}
|
||||
|
||||
private static int a(int i) throws NotFoundException {
|
||||
for (int i2 = 0; i2 < 10; i2++) {
|
||||
if (i == c[i2]) {
|
||||
return i2;
|
||||
}
|
||||
}
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
|
||||
/* JADX WARN: Can't fix incorrect switch cases order, some code will duplicate */
|
||||
/* JADX WARN: Code restructure failed: missing block: B:23:0x0039, code lost:
|
||||
|
||||
if (r6.equals("90000") != false) goto L22;
|
||||
*/
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
||||
*/
|
||||
private static java.lang.String a(java.lang.String r6) {
|
||||
/*
|
||||
r0 = 0
|
||||
char r1 = r6.charAt(r0)
|
||||
r2 = 48
|
||||
java.lang.String r3 = ""
|
||||
r4 = 1
|
||||
if (r1 == r2) goto L4f
|
||||
r2 = 53
|
||||
if (r1 == r2) goto L4c
|
||||
r2 = 57
|
||||
if (r1 == r2) goto L15
|
||||
goto L51
|
||||
L15:
|
||||
r1 = -1
|
||||
int r2 = r6.hashCode()
|
||||
r5 = 2
|
||||
switch(r2) {
|
||||
case 54118329: goto L33;
|
||||
case 54395376: goto L29;
|
||||
case 54395377: goto L1f;
|
||||
default: goto L1e;
|
||||
}
|
||||
L1e:
|
||||
goto L3c
|
||||
L1f:
|
||||
java.lang.String r0 = "99991"
|
||||
boolean r0 = r6.equals(r0)
|
||||
if (r0 == 0) goto L3c
|
||||
r0 = 1
|
||||
goto L3d
|
||||
L29:
|
||||
java.lang.String r0 = "99990"
|
||||
boolean r0 = r6.equals(r0)
|
||||
if (r0 == 0) goto L3c
|
||||
r0 = 2
|
||||
goto L3d
|
||||
L33:
|
||||
java.lang.String r2 = "90000"
|
||||
boolean r2 = r6.equals(r2)
|
||||
if (r2 == 0) goto L3c
|
||||
goto L3d
|
||||
L3c:
|
||||
r0 = -1
|
||||
L3d:
|
||||
if (r0 == 0) goto L4a
|
||||
if (r0 == r4) goto L47
|
||||
if (r0 == r5) goto L44
|
||||
goto L51
|
||||
L44:
|
||||
java.lang.String r6 = "Used"
|
||||
return r6
|
||||
L47:
|
||||
java.lang.String r6 = "0.00"
|
||||
return r6
|
||||
L4a:
|
||||
r6 = 0
|
||||
return r6
|
||||
L4c:
|
||||
java.lang.String r3 = "$"
|
||||
goto L51
|
||||
L4f:
|
||||
java.lang.String r3 = "£"
|
||||
L51:
|
||||
java.lang.String r6 = r6.substring(r4)
|
||||
int r6 = java.lang.Integer.parseInt(r6)
|
||||
int r0 = r6 / 100
|
||||
java.lang.String r0 = java.lang.String.valueOf(r0)
|
||||
int r6 = r6 % 100
|
||||
r1 = 10
|
||||
if (r6 >= r1) goto L70
|
||||
java.lang.String r6 = java.lang.String.valueOf(r6)
|
||||
java.lang.String r1 = "0"
|
||||
java.lang.String r6 = r1.concat(r6)
|
||||
goto L74
|
||||
L70:
|
||||
java.lang.String r6 = java.lang.String.valueOf(r6)
|
||||
L74:
|
||||
java.lang.StringBuilder r1 = new java.lang.StringBuilder
|
||||
r1.<init>()
|
||||
r1.append(r3)
|
||||
r1.append(r0)
|
||||
r0 = 46
|
||||
r1.append(r0)
|
||||
r1.append(r6)
|
||||
java.lang.String r6 = r1.toString()
|
||||
return r6
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: com.google.zxing.oned.UPCEANExtension5Support.a(java.lang.String):java.lang.String");
|
||||
}
|
||||
}
|
25
sources/com/google/zxing/oned/UPCEANExtensionSupport.java
Normal file
25
sources/com/google/zxing/oned/UPCEANExtensionSupport.java
Normal file
@@ -0,0 +1,25 @@
|
||||
package com.google.zxing.oned;
|
||||
|
||||
import com.google.zxing.NotFoundException;
|
||||
import com.google.zxing.ReaderException;
|
||||
import com.google.zxing.Result;
|
||||
import com.google.zxing.common.BitArray;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class UPCEANExtensionSupport {
|
||||
private static final int[] c = {1, 1, 2};
|
||||
private final UPCEANExtension2Support a = new UPCEANExtension2Support();
|
||||
private final UPCEANExtension5Support b = new UPCEANExtension5Support();
|
||||
|
||||
UPCEANExtensionSupport() {
|
||||
}
|
||||
|
||||
Result a(int i, BitArray bitArray, int i2) throws NotFoundException {
|
||||
int[] a = UPCEANReader.a(bitArray, i2, false, c);
|
||||
try {
|
||||
return this.b.a(i, bitArray, a);
|
||||
} catch (ReaderException unused) {
|
||||
return this.a.a(i, bitArray, a);
|
||||
}
|
||||
}
|
||||
}
|
227
sources/com/google/zxing/oned/UPCEANReader.java
Normal file
227
sources/com/google/zxing/oned/UPCEANReader.java
Normal file
@@ -0,0 +1,227 @@
|
||||
package com.google.zxing.oned;
|
||||
|
||||
import com.google.zxing.BarcodeFormat;
|
||||
import com.google.zxing.ChecksumException;
|
||||
import com.google.zxing.DecodeHintType;
|
||||
import com.google.zxing.FormatException;
|
||||
import com.google.zxing.NotFoundException;
|
||||
import com.google.zxing.ReaderException;
|
||||
import com.google.zxing.Result;
|
||||
import com.google.zxing.ResultMetadataType;
|
||||
import com.google.zxing.ResultPoint;
|
||||
import com.google.zxing.ResultPointCallback;
|
||||
import com.google.zxing.common.BitArray;
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public abstract class UPCEANReader extends OneDReader {
|
||||
static final int[] d = {1, 1, 1};
|
||||
static final int[] e = {1, 1, 1, 1, 1};
|
||||
static final int[] f = {1, 1, 1, 1, 1, 1};
|
||||
static final int[][] g = {new int[]{3, 2, 1, 1}, new int[]{2, 2, 2, 1}, new int[]{2, 1, 2, 2}, new int[]{1, 4, 1, 1}, new int[]{1, 1, 3, 2}, new int[]{1, 2, 3, 1}, new int[]{1, 1, 1, 4}, new int[]{1, 3, 1, 2}, new int[]{1, 2, 1, 3}, new int[]{3, 1, 1, 2}};
|
||||
static final int[][] h = new int[20][];
|
||||
private final StringBuilder a = new StringBuilder(20);
|
||||
private final UPCEANExtensionSupport b = new UPCEANExtensionSupport();
|
||||
private final EANManufacturerOrgSupport c = new EANManufacturerOrgSupport();
|
||||
|
||||
static {
|
||||
System.arraycopy(g, 0, h, 0, 10);
|
||||
for (int i = 10; i < 20; i++) {
|
||||
int[] iArr = g[i - 10];
|
||||
int[] iArr2 = new int[iArr.length];
|
||||
for (int i2 = 0; i2 < iArr.length; i2++) {
|
||||
iArr2[i2] = iArr[(iArr.length - i2) - 1];
|
||||
}
|
||||
h[i] = iArr2;
|
||||
}
|
||||
}
|
||||
|
||||
protected UPCEANReader() {
|
||||
}
|
||||
|
||||
static int[] a(BitArray bitArray) throws NotFoundException {
|
||||
int[] iArr = new int[d.length];
|
||||
int[] iArr2 = null;
|
||||
boolean z = false;
|
||||
int i = 0;
|
||||
while (!z) {
|
||||
Arrays.fill(iArr, 0, d.length, 0);
|
||||
iArr2 = a(bitArray, i, false, d, iArr);
|
||||
int i2 = iArr2[0];
|
||||
int i3 = iArr2[1];
|
||||
int i4 = i2 - (i3 - i2);
|
||||
if (i4 >= 0) {
|
||||
z = bitArray.a(i4, i2, false);
|
||||
}
|
||||
i = i3;
|
||||
}
|
||||
return iArr2;
|
||||
}
|
||||
|
||||
static int b(CharSequence charSequence) throws FormatException {
|
||||
int length = charSequence.length();
|
||||
int i = 0;
|
||||
for (int i2 = length - 1; i2 >= 0; i2 -= 2) {
|
||||
int charAt = charSequence.charAt(i2) - '0';
|
||||
if (charAt < 0 || charAt > 9) {
|
||||
throw FormatException.getFormatInstance();
|
||||
}
|
||||
i += charAt;
|
||||
}
|
||||
int i3 = i * 3;
|
||||
for (int i4 = length - 2; i4 >= 0; i4 -= 2) {
|
||||
int charAt2 = charSequence.charAt(i4) - '0';
|
||||
if (charAt2 < 0 || charAt2 > 9) {
|
||||
throw FormatException.getFormatInstance();
|
||||
}
|
||||
i3 += charAt2;
|
||||
}
|
||||
return (1000 - i3) % 10;
|
||||
}
|
||||
|
||||
protected abstract int a(BitArray bitArray, int[] iArr, StringBuilder sb) throws NotFoundException;
|
||||
|
||||
abstract BarcodeFormat a();
|
||||
|
||||
@Override // com.google.zxing.oned.OneDReader
|
||||
public Result a(int i, BitArray bitArray, Map<DecodeHintType, ?> map) throws NotFoundException, ChecksumException, FormatException {
|
||||
return a(i, bitArray, a(bitArray), map);
|
||||
}
|
||||
|
||||
public Result a(int i, BitArray bitArray, int[] iArr, Map<DecodeHintType, ?> map) throws NotFoundException, ChecksumException, FormatException {
|
||||
int i2;
|
||||
String a;
|
||||
ResultPointCallback resultPointCallback = map == null ? null : (ResultPointCallback) map.get(DecodeHintType.NEED_RESULT_POINT_CALLBACK);
|
||||
boolean z = true;
|
||||
if (resultPointCallback != null) {
|
||||
resultPointCallback.a(new ResultPoint((iArr[0] + iArr[1]) / 2.0f, i));
|
||||
}
|
||||
StringBuilder sb = this.a;
|
||||
sb.setLength(0);
|
||||
int a2 = a(bitArray, iArr, sb);
|
||||
if (resultPointCallback != null) {
|
||||
resultPointCallback.a(new ResultPoint(a2, i));
|
||||
}
|
||||
int[] a3 = a(bitArray, a2);
|
||||
if (resultPointCallback != null) {
|
||||
resultPointCallback.a(new ResultPoint((a3[0] + a3[1]) / 2.0f, i));
|
||||
}
|
||||
int i3 = a3[1];
|
||||
int i4 = (i3 - a3[0]) + i3;
|
||||
if (i4 < bitArray.h() && bitArray.a(i3, i4, false)) {
|
||||
String sb2 = sb.toString();
|
||||
if (sb2.length() >= 8) {
|
||||
if (a(sb2)) {
|
||||
BarcodeFormat a4 = a();
|
||||
float f2 = i;
|
||||
Result result = new Result(sb2, null, new ResultPoint[]{new ResultPoint((iArr[1] + iArr[0]) / 2.0f, f2), new ResultPoint((a3[1] + a3[0]) / 2.0f, f2)}, a4);
|
||||
try {
|
||||
Result a5 = this.b.a(i, bitArray, a3[1]);
|
||||
result.a(ResultMetadataType.UPC_EAN_EXTENSION, a5.e());
|
||||
result.a(a5.c());
|
||||
result.a(a5.d());
|
||||
i2 = a5.e().length();
|
||||
} catch (ReaderException unused) {
|
||||
i2 = 0;
|
||||
}
|
||||
int[] iArr2 = map != null ? (int[]) map.get(DecodeHintType.ALLOWED_EAN_EXTENSIONS) : null;
|
||||
if (iArr2 != null) {
|
||||
int length = iArr2.length;
|
||||
int i5 = 0;
|
||||
while (true) {
|
||||
if (i5 >= length) {
|
||||
z = false;
|
||||
break;
|
||||
}
|
||||
if (i2 == iArr2[i5]) {
|
||||
break;
|
||||
}
|
||||
i5++;
|
||||
}
|
||||
if (!z) {
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
}
|
||||
if ((a4 == BarcodeFormat.EAN_13 || a4 == BarcodeFormat.UPC_A) && (a = this.c.a(sb2)) != null) {
|
||||
result.a(ResultMetadataType.POSSIBLE_COUNTRY, a);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
throw ChecksumException.getChecksumInstance();
|
||||
}
|
||||
throw FormatException.getFormatInstance();
|
||||
}
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
|
||||
boolean a(String str) throws FormatException {
|
||||
return a((CharSequence) str);
|
||||
}
|
||||
|
||||
static boolean a(CharSequence charSequence) throws FormatException {
|
||||
int length = charSequence.length();
|
||||
if (length == 0) {
|
||||
return false;
|
||||
}
|
||||
int i = length - 1;
|
||||
return b(charSequence.subSequence(0, i)) == Character.digit(charSequence.charAt(i), 10);
|
||||
}
|
||||
|
||||
int[] a(BitArray bitArray, int i) throws NotFoundException {
|
||||
return a(bitArray, i, false, d);
|
||||
}
|
||||
|
||||
static int[] a(BitArray bitArray, int i, boolean z, int[] iArr) throws NotFoundException {
|
||||
return a(bitArray, i, z, iArr, new int[iArr.length]);
|
||||
}
|
||||
|
||||
private static int[] a(BitArray bitArray, int i, boolean z, int[] iArr, int[] iArr2) throws NotFoundException {
|
||||
int h2 = bitArray.h();
|
||||
int c = z ? bitArray.c(i) : bitArray.b(i);
|
||||
int length = iArr.length;
|
||||
int i2 = c;
|
||||
int i3 = 0;
|
||||
while (c < h2) {
|
||||
if (bitArray.a(c) != z) {
|
||||
iArr2[i3] = iArr2[i3] + 1;
|
||||
} else {
|
||||
if (i3 != length - 1) {
|
||||
i3++;
|
||||
} else {
|
||||
if (OneDReader.a(iArr2, iArr, 0.7f) < 0.48f) {
|
||||
return new int[]{i2, c};
|
||||
}
|
||||
i2 += iArr2[0] + iArr2[1];
|
||||
int i4 = i3 - 1;
|
||||
System.arraycopy(iArr2, 2, iArr2, 0, i4);
|
||||
iArr2[i4] = 0;
|
||||
iArr2[i3] = 0;
|
||||
i3--;
|
||||
}
|
||||
iArr2[i3] = 1;
|
||||
z = !z;
|
||||
}
|
||||
c++;
|
||||
}
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
|
||||
static int a(BitArray bitArray, int[] iArr, int i, int[][] iArr2) throws NotFoundException {
|
||||
OneDReader.a(bitArray, i, iArr);
|
||||
int length = iArr2.length;
|
||||
float f2 = 0.48f;
|
||||
int i2 = -1;
|
||||
for (int i3 = 0; i3 < length; i3++) {
|
||||
float a = OneDReader.a(iArr, iArr2[i3], 0.7f);
|
||||
if (a < f2) {
|
||||
i2 = i3;
|
||||
f2 = a;
|
||||
}
|
||||
}
|
||||
if (i2 >= 0) {
|
||||
return i2;
|
||||
}
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
}
|
9
sources/com/google/zxing/oned/UPCEANWriter.java
Normal file
9
sources/com/google/zxing/oned/UPCEANWriter.java
Normal file
@@ -0,0 +1,9 @@
|
||||
package com.google.zxing.oned;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public abstract class UPCEANWriter extends OneDimensionalCodeWriter {
|
||||
@Override // com.google.zxing.oned.OneDimensionalCodeWriter
|
||||
public int a() {
|
||||
return 9;
|
||||
}
|
||||
}
|
106
sources/com/google/zxing/oned/UPCEReader.java
Normal file
106
sources/com/google/zxing/oned/UPCEReader.java
Normal file
@@ -0,0 +1,106 @@
|
||||
package com.google.zxing.oned;
|
||||
|
||||
import com.google.zxing.BarcodeFormat;
|
||||
import com.google.zxing.FormatException;
|
||||
import com.google.zxing.NotFoundException;
|
||||
import com.google.zxing.common.BitArray;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class UPCEReader extends UPCEANReader {
|
||||
private static final int[] j = {1, 1, 1, 1, 1, 1};
|
||||
static final int[][] k = {new int[]{56, 52, 50, 49, 44, 38, 35, 42, 41, 37}, new int[]{7, 11, 13, 14, 19, 25, 28, 21, 22, 26}};
|
||||
private final int[] i = new int[4];
|
||||
|
||||
public static String b(String str) {
|
||||
char[] cArr = new char[6];
|
||||
str.getChars(1, 7, cArr, 0);
|
||||
StringBuilder sb = new StringBuilder(12);
|
||||
sb.append(str.charAt(0));
|
||||
char c = cArr[5];
|
||||
switch (c) {
|
||||
case '0':
|
||||
case '1':
|
||||
case '2':
|
||||
sb.append(cArr, 0, 2);
|
||||
sb.append(c);
|
||||
sb.append("0000");
|
||||
sb.append(cArr, 2, 3);
|
||||
break;
|
||||
case '3':
|
||||
sb.append(cArr, 0, 3);
|
||||
sb.append("00000");
|
||||
sb.append(cArr, 3, 2);
|
||||
break;
|
||||
case '4':
|
||||
sb.append(cArr, 0, 4);
|
||||
sb.append("00000");
|
||||
sb.append(cArr[4]);
|
||||
break;
|
||||
default:
|
||||
sb.append(cArr, 0, 5);
|
||||
sb.append("0000");
|
||||
sb.append(c);
|
||||
break;
|
||||
}
|
||||
if (str.length() >= 8) {
|
||||
sb.append(str.charAt(7));
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.oned.UPCEANReader
|
||||
protected int a(BitArray bitArray, int[] iArr, StringBuilder sb) throws NotFoundException {
|
||||
int[] iArr2 = this.i;
|
||||
iArr2[0] = 0;
|
||||
iArr2[1] = 0;
|
||||
iArr2[2] = 0;
|
||||
iArr2[3] = 0;
|
||||
int h = bitArray.h();
|
||||
int i = iArr[1];
|
||||
int i2 = 0;
|
||||
int i3 = 0;
|
||||
while (i2 < 6 && i < h) {
|
||||
int a = UPCEANReader.a(bitArray, iArr2, i, UPCEANReader.h);
|
||||
sb.append((char) ((a % 10) + 48));
|
||||
int i4 = i;
|
||||
for (int i5 : iArr2) {
|
||||
i4 += i5;
|
||||
}
|
||||
if (a >= 10) {
|
||||
i3 = (1 << (5 - i2)) | i3;
|
||||
}
|
||||
i2++;
|
||||
i = i4;
|
||||
}
|
||||
a(sb, i3);
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.oned.UPCEANReader
|
||||
protected int[] a(BitArray bitArray, int i) throws NotFoundException {
|
||||
return UPCEANReader.a(bitArray, i, true, j);
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.oned.UPCEANReader
|
||||
protected boolean a(String str) throws FormatException {
|
||||
return super.a(b(str));
|
||||
}
|
||||
|
||||
private static void a(StringBuilder sb, int i) throws NotFoundException {
|
||||
for (int i2 = 0; i2 <= 1; i2++) {
|
||||
for (int i3 = 0; i3 < 10; i3++) {
|
||||
if (i == k[i2][i3]) {
|
||||
sb.insert(0, (char) (i2 + 48));
|
||||
sb.append((char) (i3 + 48));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.oned.UPCEANReader
|
||||
BarcodeFormat a() {
|
||||
return BarcodeFormat.UPC_E;
|
||||
}
|
||||
}
|
57
sources/com/google/zxing/oned/UPCEWriter.java
Normal file
57
sources/com/google/zxing/oned/UPCEWriter.java
Normal file
@@ -0,0 +1,57 @@
|
||||
package com.google.zxing.oned;
|
||||
|
||||
import com.google.zxing.BarcodeFormat;
|
||||
import com.google.zxing.EncodeHintType;
|
||||
import com.google.zxing.FormatException;
|
||||
import com.google.zxing.WriterException;
|
||||
import com.google.zxing.common.BitMatrix;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class UPCEWriter extends UPCEANWriter {
|
||||
@Override // com.google.zxing.oned.OneDimensionalCodeWriter, com.google.zxing.Writer
|
||||
public BitMatrix a(String str, BarcodeFormat barcodeFormat, int i, int i2, Map<EncodeHintType, ?> map) throws WriterException {
|
||||
if (barcodeFormat == BarcodeFormat.UPC_E) {
|
||||
return super.a(str, barcodeFormat, i, i2, map);
|
||||
}
|
||||
throw new IllegalArgumentException("Can only encode UPC_E, but got ".concat(String.valueOf(barcodeFormat)));
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.oned.OneDimensionalCodeWriter
|
||||
public boolean[] a(String str) {
|
||||
int length = str.length();
|
||||
if (length == 7) {
|
||||
try {
|
||||
str = str + UPCEANReader.b(UPCEReader.b(str));
|
||||
} catch (FormatException e) {
|
||||
throw new IllegalArgumentException(e);
|
||||
}
|
||||
} else if (length == 8) {
|
||||
try {
|
||||
if (!UPCEANReader.a((CharSequence) str)) {
|
||||
throw new IllegalArgumentException("Contents do not pass checksum");
|
||||
}
|
||||
} catch (FormatException unused) {
|
||||
throw new IllegalArgumentException("Illegal contents");
|
||||
}
|
||||
} else {
|
||||
throw new IllegalArgumentException("Requested contents should be 8 digits long, but got ".concat(String.valueOf(length)));
|
||||
}
|
||||
int digit = Character.digit(str.charAt(0), 10);
|
||||
if (digit != 0 && digit != 1) {
|
||||
throw new IllegalArgumentException("Number system must be 0 or 1");
|
||||
}
|
||||
int i = UPCEReader.k[digit][Character.digit(str.charAt(7), 10)];
|
||||
boolean[] zArr = new boolean[51];
|
||||
int a = OneDimensionalCodeWriter.a(zArr, 0, UPCEANReader.d, true) + 0;
|
||||
for (int i2 = 1; i2 <= 6; i2++) {
|
||||
int digit2 = Character.digit(str.charAt(i2), 10);
|
||||
if (((i >> (6 - i2)) & 1) == 1) {
|
||||
digit2 += 10;
|
||||
}
|
||||
a += OneDimensionalCodeWriter.a(zArr, a, UPCEANReader.h[digit2], false);
|
||||
}
|
||||
OneDimensionalCodeWriter.a(zArr, a, UPCEANReader.f, false);
|
||||
return zArr;
|
||||
}
|
||||
}
|
97
sources/com/google/zxing/oned/rss/AbstractRSSReader.java
Normal file
97
sources/com/google/zxing/oned/rss/AbstractRSSReader.java
Normal file
@@ -0,0 +1,97 @@
|
||||
package com.google.zxing.oned.rss;
|
||||
|
||||
import com.google.zxing.NotFoundException;
|
||||
import com.google.zxing.oned.OneDReader;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public abstract class AbstractRSSReader extends OneDReader {
|
||||
private final int[] a = new int[4];
|
||||
private final int[] b = new int[8];
|
||||
private final float[] c = new float[4];
|
||||
private final float[] d = new float[4];
|
||||
private final int[] e;
|
||||
private final int[] f;
|
||||
|
||||
protected AbstractRSSReader() {
|
||||
int[] iArr = this.b;
|
||||
this.e = new int[iArr.length / 2];
|
||||
this.f = new int[iArr.length / 2];
|
||||
}
|
||||
|
||||
protected final int[] a() {
|
||||
return this.b;
|
||||
}
|
||||
|
||||
protected final int[] b() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
protected final int[] c() {
|
||||
return this.f;
|
||||
}
|
||||
|
||||
protected final float[] d() {
|
||||
return this.d;
|
||||
}
|
||||
|
||||
protected final int[] e() {
|
||||
return this.e;
|
||||
}
|
||||
|
||||
protected final float[] f() {
|
||||
return this.c;
|
||||
}
|
||||
|
||||
protected static int a(int[] iArr, int[][] iArr2) throws NotFoundException {
|
||||
for (int i = 0; i < iArr2.length; i++) {
|
||||
if (OneDReader.a(iArr, iArr2[i], 0.45f) < 0.2f) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
|
||||
protected static void b(int[] iArr, float[] fArr) {
|
||||
float f = fArr[0];
|
||||
int i = 0;
|
||||
for (int i2 = 1; i2 < iArr.length; i2++) {
|
||||
if (fArr[i2] > f) {
|
||||
f = fArr[i2];
|
||||
i = i2;
|
||||
}
|
||||
}
|
||||
iArr[i] = iArr[i] + 1;
|
||||
}
|
||||
|
||||
protected static void a(int[] iArr, float[] fArr) {
|
||||
float f = fArr[0];
|
||||
int i = 0;
|
||||
for (int i2 = 1; i2 < iArr.length; i2++) {
|
||||
if (fArr[i2] < f) {
|
||||
f = fArr[i2];
|
||||
i = i2;
|
||||
}
|
||||
}
|
||||
iArr[i] = iArr[i] - 1;
|
||||
}
|
||||
|
||||
protected static boolean a(int[] iArr) {
|
||||
float f = (iArr[0] + iArr[1]) / ((iArr[2] + r1) + iArr[3]);
|
||||
if (f >= 0.7916667f && f <= 0.89285713f) {
|
||||
int i = Integer.MIN_VALUE;
|
||||
int i2 = Integer.MAX_VALUE;
|
||||
for (int i3 : iArr) {
|
||||
if (i3 > i) {
|
||||
i = i3;
|
||||
}
|
||||
if (i3 < i2) {
|
||||
i2 = i3;
|
||||
}
|
||||
}
|
||||
if (i < i2 * 10) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
36
sources/com/google/zxing/oned/rss/DataCharacter.java
Normal file
36
sources/com/google/zxing/oned/rss/DataCharacter.java
Normal file
@@ -0,0 +1,36 @@
|
||||
package com.google.zxing.oned.rss;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class DataCharacter {
|
||||
private final int a;
|
||||
private final int b;
|
||||
|
||||
public DataCharacter(int i, int i2) {
|
||||
this.a = i;
|
||||
this.b = i2;
|
||||
}
|
||||
|
||||
public final int a() {
|
||||
return this.b;
|
||||
}
|
||||
|
||||
public final int b() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
public final boolean equals(Object obj) {
|
||||
if (!(obj instanceof DataCharacter)) {
|
||||
return false;
|
||||
}
|
||||
DataCharacter dataCharacter = (DataCharacter) obj;
|
||||
return this.a == dataCharacter.a && this.b == dataCharacter.b;
|
||||
}
|
||||
|
||||
public final int hashCode() {
|
||||
return this.a ^ this.b;
|
||||
}
|
||||
|
||||
public final String toString() {
|
||||
return this.a + "(" + this.b + ')';
|
||||
}
|
||||
}
|
37
sources/com/google/zxing/oned/rss/FinderPattern.java
Normal file
37
sources/com/google/zxing/oned/rss/FinderPattern.java
Normal file
@@ -0,0 +1,37 @@
|
||||
package com.google.zxing.oned.rss;
|
||||
|
||||
import com.google.zxing.ResultPoint;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class FinderPattern {
|
||||
private final int a;
|
||||
private final int[] b;
|
||||
private final ResultPoint[] c;
|
||||
|
||||
public FinderPattern(int i, int[] iArr, int i2, int i3, int i4) {
|
||||
this.a = i;
|
||||
this.b = iArr;
|
||||
float f = i4;
|
||||
this.c = new ResultPoint[]{new ResultPoint(i2, f), new ResultPoint(i3, f)};
|
||||
}
|
||||
|
||||
public ResultPoint[] a() {
|
||||
return this.c;
|
||||
}
|
||||
|
||||
public int[] b() {
|
||||
return this.b;
|
||||
}
|
||||
|
||||
public int c() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
return (obj instanceof FinderPattern) && this.a == ((FinderPattern) obj).a;
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return this.a;
|
||||
}
|
||||
}
|
24
sources/com/google/zxing/oned/rss/Pair.java
Normal file
24
sources/com/google/zxing/oned/rss/Pair.java
Normal file
@@ -0,0 +1,24 @@
|
||||
package com.google.zxing.oned.rss;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class Pair extends DataCharacter {
|
||||
private final FinderPattern c;
|
||||
private int d;
|
||||
|
||||
Pair(int i, int i2, FinderPattern finderPattern) {
|
||||
super(i, i2);
|
||||
this.c = finderPattern;
|
||||
}
|
||||
|
||||
int c() {
|
||||
return this.d;
|
||||
}
|
||||
|
||||
FinderPattern d() {
|
||||
return this.c;
|
||||
}
|
||||
|
||||
void e() {
|
||||
this.d++;
|
||||
}
|
||||
}
|
303
sources/com/google/zxing/oned/rss/RSS14Reader.java
Normal file
303
sources/com/google/zxing/oned/rss/RSS14Reader.java
Normal file
@@ -0,0 +1,303 @@
|
||||
package com.google.zxing.oned.rss;
|
||||
|
||||
import com.google.zxing.BarcodeFormat;
|
||||
import com.google.zxing.DecodeHintType;
|
||||
import com.google.zxing.NotFoundException;
|
||||
import com.google.zxing.Result;
|
||||
import com.google.zxing.ResultPoint;
|
||||
import com.google.zxing.ResultPointCallback;
|
||||
import com.google.zxing.common.BitArray;
|
||||
import com.google.zxing.common.detector.MathUtils;
|
||||
import com.google.zxing.oned.OneDReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class RSS14Reader extends AbstractRSSReader {
|
||||
private static final int[] i = {1, 10, 34, 70, 126};
|
||||
private static final int[] j = {4, 20, 48, 81};
|
||||
private static final int[] k = {0, 161, 961, 2015, 2715};
|
||||
private static final int[] l = {0, 336, 1036, 1516};
|
||||
private static final int[] m = {8, 6, 4, 3, 1};
|
||||
private static final int[] n = {2, 4, 6, 8};
|
||||
private static final int[][] o = {new int[]{3, 8, 2, 1}, new int[]{3, 5, 5, 1}, new int[]{3, 3, 7, 1}, new int[]{3, 1, 9, 1}, new int[]{2, 7, 4, 1}, new int[]{2, 5, 6, 1}, new int[]{2, 3, 8, 1}, new int[]{1, 5, 7, 1}, new int[]{1, 3, 9, 1}};
|
||||
private final List<Pair> g = new ArrayList();
|
||||
private final List<Pair> h = new ArrayList();
|
||||
|
||||
private static Result b(Pair pair, Pair pair2) {
|
||||
String valueOf = String.valueOf((pair.b() * 4537077) + pair2.b());
|
||||
StringBuilder sb = new StringBuilder(14);
|
||||
for (int length = 13 - valueOf.length(); length > 0; length--) {
|
||||
sb.append('0');
|
||||
}
|
||||
sb.append(valueOf);
|
||||
int i2 = 0;
|
||||
for (int i3 = 0; i3 < 13; i3++) {
|
||||
int charAt = sb.charAt(i3) - '0';
|
||||
if ((i3 & 1) == 0) {
|
||||
charAt *= 3;
|
||||
}
|
||||
i2 += charAt;
|
||||
}
|
||||
int i4 = 10 - (i2 % 10);
|
||||
if (i4 == 10) {
|
||||
i4 = 0;
|
||||
}
|
||||
sb.append(i4);
|
||||
ResultPoint[] a = pair.d().a();
|
||||
ResultPoint[] a2 = pair2.d().a();
|
||||
return new Result(sb.toString(), null, new ResultPoint[]{a[0], a[1], a2[0], a2[1]}, BarcodeFormat.RSS_14);
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.oned.OneDReader
|
||||
public Result a(int i2, BitArray bitArray, Map<DecodeHintType, ?> map) throws NotFoundException {
|
||||
a(this.g, a(bitArray, false, i2, map));
|
||||
bitArray.j();
|
||||
a(this.h, a(bitArray, true, i2, map));
|
||||
bitArray.j();
|
||||
for (Pair pair : this.g) {
|
||||
if (pair.c() > 1) {
|
||||
for (Pair pair2 : this.h) {
|
||||
if (pair2.c() > 1 && a(pair, pair2)) {
|
||||
return b(pair, pair2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.oned.OneDReader, com.google.zxing.Reader
|
||||
public void reset() {
|
||||
this.g.clear();
|
||||
this.h.clear();
|
||||
}
|
||||
|
||||
private static void a(Collection<Pair> collection, Pair pair) {
|
||||
if (pair == null) {
|
||||
return;
|
||||
}
|
||||
boolean z = false;
|
||||
Iterator<Pair> it = collection.iterator();
|
||||
while (true) {
|
||||
if (!it.hasNext()) {
|
||||
break;
|
||||
}
|
||||
Pair next = it.next();
|
||||
if (next.b() == pair.b()) {
|
||||
next.e();
|
||||
z = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (z) {
|
||||
return;
|
||||
}
|
||||
collection.add(pair);
|
||||
}
|
||||
|
||||
private static boolean a(Pair pair, Pair pair2) {
|
||||
int a = (pair.a() + (pair2.a() * 16)) % 79;
|
||||
int c = (pair.d().c() * 9) + pair2.d().c();
|
||||
if (c > 72) {
|
||||
c--;
|
||||
}
|
||||
if (c > 8) {
|
||||
c--;
|
||||
}
|
||||
return a == c;
|
||||
}
|
||||
|
||||
private Pair a(BitArray bitArray, boolean z, int i2, Map<DecodeHintType, ?> map) {
|
||||
try {
|
||||
FinderPattern a = a(bitArray, i2, z, a(bitArray, z));
|
||||
ResultPointCallback resultPointCallback = map == null ? null : (ResultPointCallback) map.get(DecodeHintType.NEED_RESULT_POINT_CALLBACK);
|
||||
if (resultPointCallback != null) {
|
||||
float f = (r1[0] + r1[1]) / 2.0f;
|
||||
if (z) {
|
||||
f = (bitArray.h() - 1) - f;
|
||||
}
|
||||
resultPointCallback.a(new ResultPoint(f, i2));
|
||||
}
|
||||
DataCharacter a2 = a(bitArray, a, true);
|
||||
DataCharacter a3 = a(bitArray, a, false);
|
||||
return new Pair((a2.b() * 1597) + a3.b(), a2.a() + (a3.a() * 4), a);
|
||||
} catch (NotFoundException unused) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private DataCharacter a(BitArray bitArray, FinderPattern finderPattern, boolean z) throws NotFoundException {
|
||||
int[] a = a();
|
||||
for (int i2 = 0; i2 < a.length; i2++) {
|
||||
a[i2] = 0;
|
||||
}
|
||||
if (z) {
|
||||
OneDReader.b(bitArray, finderPattern.b()[0], a);
|
||||
} else {
|
||||
OneDReader.a(bitArray, finderPattern.b()[1] + 1, a);
|
||||
int i3 = 0;
|
||||
for (int length = a.length - 1; i3 < length; length--) {
|
||||
int i4 = a[i3];
|
||||
a[i3] = a[length];
|
||||
a[length] = i4;
|
||||
i3++;
|
||||
}
|
||||
}
|
||||
int i5 = z ? 16 : 15;
|
||||
float a2 = MathUtils.a(a) / i5;
|
||||
int[] e = e();
|
||||
int[] c = c();
|
||||
float[] f = f();
|
||||
float[] d = d();
|
||||
for (int i6 = 0; i6 < a.length; i6++) {
|
||||
float f2 = a[i6] / a2;
|
||||
int i7 = (int) (0.5f + f2);
|
||||
if (i7 <= 0) {
|
||||
i7 = 1;
|
||||
} else if (i7 > 8) {
|
||||
i7 = 8;
|
||||
}
|
||||
int i8 = i6 / 2;
|
||||
if ((i6 & 1) == 0) {
|
||||
e[i8] = i7;
|
||||
f[i8] = f2 - i7;
|
||||
} else {
|
||||
c[i8] = i7;
|
||||
d[i8] = f2 - i7;
|
||||
}
|
||||
}
|
||||
a(z, i5);
|
||||
int i9 = 0;
|
||||
int i10 = 0;
|
||||
for (int length2 = e.length - 1; length2 >= 0; length2--) {
|
||||
i9 = (i9 * 9) + e[length2];
|
||||
i10 += e[length2];
|
||||
}
|
||||
int i11 = 0;
|
||||
int i12 = 0;
|
||||
for (int length3 = c.length - 1; length3 >= 0; length3--) {
|
||||
i11 = (i11 * 9) + c[length3];
|
||||
i12 += c[length3];
|
||||
}
|
||||
int i13 = i9 + (i11 * 3);
|
||||
if (!z) {
|
||||
if ((i12 & 1) == 0 && i12 <= 10 && i12 >= 4) {
|
||||
int i14 = (10 - i12) / 2;
|
||||
int i15 = n[i14];
|
||||
return new DataCharacter((RSSUtils.a(c, 9 - i15, false) * j[i14]) + RSSUtils.a(e, i15, true) + l[i14], i13);
|
||||
}
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
if ((i10 & 1) == 0 && i10 <= 12 && i10 >= 4) {
|
||||
int i16 = (12 - i10) / 2;
|
||||
int i17 = m[i16];
|
||||
return new DataCharacter((RSSUtils.a(e, i17, false) * i[i16]) + RSSUtils.a(c, 9 - i17, true) + k[i16], i13);
|
||||
}
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
|
||||
private int[] a(BitArray bitArray, boolean z) throws NotFoundException {
|
||||
int[] b = b();
|
||||
b[0] = 0;
|
||||
b[1] = 0;
|
||||
b[2] = 0;
|
||||
b[3] = 0;
|
||||
int h = bitArray.h();
|
||||
int i2 = 0;
|
||||
boolean z2 = false;
|
||||
while (i2 < h) {
|
||||
z2 = !bitArray.a(i2);
|
||||
if (z == z2) {
|
||||
break;
|
||||
}
|
||||
i2++;
|
||||
}
|
||||
int i3 = i2;
|
||||
int i4 = 0;
|
||||
while (i2 < h) {
|
||||
if (bitArray.a(i2) != z2) {
|
||||
b[i4] = b[i4] + 1;
|
||||
} else {
|
||||
if (i4 != 3) {
|
||||
i4++;
|
||||
} else {
|
||||
if (AbstractRSSReader.a(b)) {
|
||||
return new int[]{i3, i2};
|
||||
}
|
||||
i3 += b[0] + b[1];
|
||||
b[0] = b[2];
|
||||
b[1] = b[3];
|
||||
b[2] = 0;
|
||||
b[3] = 0;
|
||||
i4--;
|
||||
}
|
||||
b[i4] = 1;
|
||||
z2 = !z2;
|
||||
}
|
||||
i2++;
|
||||
}
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
|
||||
private FinderPattern a(BitArray bitArray, int i2, boolean z, int[] iArr) throws NotFoundException {
|
||||
int i3;
|
||||
int i4;
|
||||
boolean a = bitArray.a(iArr[0]);
|
||||
int i5 = iArr[0] - 1;
|
||||
while (i5 >= 0 && a != bitArray.a(i5)) {
|
||||
i5--;
|
||||
}
|
||||
int i6 = i5 + 1;
|
||||
int i7 = iArr[0] - i6;
|
||||
int[] b = b();
|
||||
System.arraycopy(b, 0, b, 1, b.length - 1);
|
||||
b[0] = i7;
|
||||
int a2 = AbstractRSSReader.a(b, o);
|
||||
int i8 = iArr[1];
|
||||
if (z) {
|
||||
int h = (bitArray.h() - 1) - i6;
|
||||
i3 = (bitArray.h() - 1) - i8;
|
||||
i4 = h;
|
||||
} else {
|
||||
i3 = i8;
|
||||
i4 = i6;
|
||||
}
|
||||
return new FinderPattern(a2, new int[]{i6, iArr[1]}, i4, i3, i2);
|
||||
}
|
||||
|
||||
/* JADX WARN: Code restructure failed: missing block: B:68:0x0029, code lost:
|
||||
|
||||
if (r1 < 4) goto L28;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:69:0x0045, code lost:
|
||||
|
||||
r2 = false;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:70:0x0046, code lost:
|
||||
|
||||
r7 = false;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:71:0x0043, code lost:
|
||||
|
||||
r2 = true;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:81:0x0041, code lost:
|
||||
|
||||
if (r1 < 4) goto L28;
|
||||
*/
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
||||
*/
|
||||
private void a(boolean r10, int r11) throws com.google.zxing.NotFoundException {
|
||||
/*
|
||||
Method dump skipped, instructions count: 229
|
||||
To view this dump change 'Code comments level' option to 'DEBUG'
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: com.google.zxing.oned.rss.RSS14Reader.a(boolean, int):void");
|
||||
}
|
||||
}
|
80
sources/com/google/zxing/oned/rss/RSSUtils.java
Normal file
80
sources/com/google/zxing/oned/rss/RSSUtils.java
Normal file
@@ -0,0 +1,80 @@
|
||||
package com.google.zxing.oned.rss;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class RSSUtils {
|
||||
public static int a(int[] iArr, int i, boolean z) {
|
||||
int[] iArr2 = iArr;
|
||||
int i2 = 0;
|
||||
for (int i3 : iArr2) {
|
||||
i2 += i3;
|
||||
}
|
||||
int length = iArr2.length;
|
||||
int i4 = i2;
|
||||
int i5 = 0;
|
||||
int i6 = 0;
|
||||
int i7 = 0;
|
||||
while (true) {
|
||||
int i8 = length - 1;
|
||||
if (i5 >= i8) {
|
||||
return i6;
|
||||
}
|
||||
int i9 = 1 << i5;
|
||||
int i10 = i7 | i9;
|
||||
int i11 = i6;
|
||||
int i12 = 1;
|
||||
while (i12 < iArr2[i5]) {
|
||||
int i13 = i4 - i12;
|
||||
int i14 = length - i5;
|
||||
int i15 = i14 - 2;
|
||||
int a = a(i13 - 1, i15);
|
||||
if (z && i10 == 0) {
|
||||
int i16 = i14 - 1;
|
||||
if (i13 - i16 >= i16) {
|
||||
a -= a(i13 - i14, i15);
|
||||
}
|
||||
}
|
||||
if (i14 - 1 > 1) {
|
||||
int i17 = 0;
|
||||
for (int i18 = i13 - i15; i18 > i; i18--) {
|
||||
i17 += a((i13 - i18) - 1, i14 - 3);
|
||||
}
|
||||
a -= i17 * (i8 - i5);
|
||||
} else if (i13 > i) {
|
||||
a--;
|
||||
}
|
||||
i11 += a;
|
||||
i12++;
|
||||
i10 &= ~i9;
|
||||
iArr2 = iArr;
|
||||
}
|
||||
i4 -= i12;
|
||||
i5++;
|
||||
iArr2 = iArr;
|
||||
i6 = i11;
|
||||
i7 = i10;
|
||||
}
|
||||
}
|
||||
|
||||
private static int a(int i, int i2) {
|
||||
int i3 = i - i2;
|
||||
if (i3 > i2) {
|
||||
i3 = i2;
|
||||
i2 = i3;
|
||||
}
|
||||
int i4 = 1;
|
||||
int i5 = 1;
|
||||
while (i > i2) {
|
||||
i4 *= i;
|
||||
if (i5 <= i3) {
|
||||
i4 /= i5;
|
||||
i5++;
|
||||
}
|
||||
i--;
|
||||
}
|
||||
while (i5 <= i3) {
|
||||
i4 /= i5;
|
||||
i5++;
|
||||
}
|
||||
return i4;
|
||||
}
|
||||
}
|
@@ -0,0 +1,45 @@
|
||||
package com.google.zxing.oned.rss.expanded;
|
||||
|
||||
import com.google.zxing.common.BitArray;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class BitArrayBuilder {
|
||||
static BitArray a(List<ExpandedPair> list) {
|
||||
int size = (list.size() << 1) - 1;
|
||||
if (list.get(list.size() - 1).c() == null) {
|
||||
size--;
|
||||
}
|
||||
BitArray bitArray = new BitArray(size * 12);
|
||||
int b = list.get(0).c().b();
|
||||
int i = 0;
|
||||
for (int i2 = 11; i2 >= 0; i2--) {
|
||||
if (((1 << i2) & b) != 0) {
|
||||
bitArray.d(i);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
for (int i3 = 1; i3 < list.size(); i3++) {
|
||||
ExpandedPair expandedPair = list.get(i3);
|
||||
int b2 = expandedPair.b().b();
|
||||
int i4 = i;
|
||||
for (int i5 = 11; i5 >= 0; i5--) {
|
||||
if (((1 << i5) & b2) != 0) {
|
||||
bitArray.d(i4);
|
||||
}
|
||||
i4++;
|
||||
}
|
||||
if (expandedPair.c() != null) {
|
||||
int b3 = expandedPair.c().b();
|
||||
for (int i6 = 11; i6 >= 0; i6--) {
|
||||
if (((1 << i6) & b3) != 0) {
|
||||
bitArray.d(i4);
|
||||
}
|
||||
i4++;
|
||||
}
|
||||
}
|
||||
i = i4;
|
||||
}
|
||||
return bitArray;
|
||||
}
|
||||
}
|
68
sources/com/google/zxing/oned/rss/expanded/ExpandedPair.java
Normal file
68
sources/com/google/zxing/oned/rss/expanded/ExpandedPair.java
Normal file
@@ -0,0 +1,68 @@
|
||||
package com.google.zxing.oned.rss.expanded;
|
||||
|
||||
import com.google.zxing.oned.rss.DataCharacter;
|
||||
import com.google.zxing.oned.rss.FinderPattern;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class ExpandedPair {
|
||||
private final DataCharacter a;
|
||||
private final DataCharacter b;
|
||||
private final FinderPattern c;
|
||||
|
||||
ExpandedPair(DataCharacter dataCharacter, DataCharacter dataCharacter2, FinderPattern finderPattern, boolean z) {
|
||||
this.a = dataCharacter;
|
||||
this.b = dataCharacter2;
|
||||
this.c = finderPattern;
|
||||
}
|
||||
|
||||
FinderPattern a() {
|
||||
return this.c;
|
||||
}
|
||||
|
||||
DataCharacter b() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
DataCharacter c() {
|
||||
return this.b;
|
||||
}
|
||||
|
||||
public boolean d() {
|
||||
return this.b == null;
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (!(obj instanceof ExpandedPair)) {
|
||||
return false;
|
||||
}
|
||||
ExpandedPair expandedPair = (ExpandedPair) obj;
|
||||
return a(this.a, expandedPair.a) && a(this.b, expandedPair.b) && a(this.c, expandedPair.c);
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return (a(this.a) ^ a(this.b)) ^ a(this.c);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("[ ");
|
||||
sb.append(this.a);
|
||||
sb.append(" , ");
|
||||
sb.append(this.b);
|
||||
sb.append(" : ");
|
||||
FinderPattern finderPattern = this.c;
|
||||
sb.append(finderPattern == null ? "null" : Integer.valueOf(finderPattern.c()));
|
||||
sb.append(" ]");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private static boolean a(Object obj, Object obj2) {
|
||||
return obj == null ? obj2 == null : obj.equals(obj2);
|
||||
}
|
||||
|
||||
private static int a(Object obj) {
|
||||
if (obj == null) {
|
||||
return 0;
|
||||
}
|
||||
return obj.hashCode();
|
||||
}
|
||||
}
|
45
sources/com/google/zxing/oned/rss/expanded/ExpandedRow.java
Normal file
45
sources/com/google/zxing/oned/rss/expanded/ExpandedRow.java
Normal file
@@ -0,0 +1,45 @@
|
||||
package com.google.zxing.oned.rss.expanded;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class ExpandedRow {
|
||||
private final List<ExpandedPair> a;
|
||||
private final int b;
|
||||
private final boolean c;
|
||||
|
||||
ExpandedRow(List<ExpandedPair> list, int i, boolean z) {
|
||||
this.a = new ArrayList(list);
|
||||
this.b = i;
|
||||
this.c = z;
|
||||
}
|
||||
|
||||
List<ExpandedPair> a() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
int b() {
|
||||
return this.b;
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (!(obj instanceof ExpandedRow)) {
|
||||
return false;
|
||||
}
|
||||
ExpandedRow expandedRow = (ExpandedRow) obj;
|
||||
return this.a.equals(expandedRow.a()) && this.c == expandedRow.c;
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return this.a.hashCode() ^ Boolean.valueOf(this.c).hashCode();
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "{ " + this.a + " }";
|
||||
}
|
||||
|
||||
boolean a(List<ExpandedPair> list) {
|
||||
return this.a.equals(list);
|
||||
}
|
||||
}
|
@@ -0,0 +1,653 @@
|
||||
package com.google.zxing.oned.rss.expanded;
|
||||
|
||||
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.ResultPoint;
|
||||
import com.google.zxing.common.BitArray;
|
||||
import com.google.zxing.common.detector.MathUtils;
|
||||
import com.google.zxing.oned.OneDReader;
|
||||
import com.google.zxing.oned.rss.AbstractRSSReader;
|
||||
import com.google.zxing.oned.rss.DataCharacter;
|
||||
import com.google.zxing.oned.rss.FinderPattern;
|
||||
import com.google.zxing.oned.rss.RSSUtils;
|
||||
import com.google.zxing.oned.rss.expanded.decoders.AbstractExpandedDecoder;
|
||||
import com.twitter.sdk.android.core.TwitterAuthConfig;
|
||||
import com.ubt.jimu.base.entities.Constant;
|
||||
import com.ubtrobot.jimu.robotapi.PeripheralType;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class RSSExpandedReader extends AbstractRSSReader {
|
||||
private static final int[] k = {7, 5, 4, 3, 1};
|
||||
private static final int[] l = {4, 20, 52, 104, 204};
|
||||
private static final int[] m = {0, 348, 1388, 2948, 3988};
|
||||
private static final int[][] n = {new int[]{1, 8, 4, 1}, new int[]{3, 6, 4, 1}, new int[]{3, 4, 6, 1}, new int[]{3, 2, 8, 1}, new int[]{2, 6, 5, 1}, new int[]{2, 2, 9, 1}};
|
||||
private static final int[][] o = {new int[]{1, 3, 9, 27, 81, 32, 96, 77}, new int[]{20, 60, 180, 118, 143, 7, 21, 63}, new int[]{189, 145, 13, 39, 117, TwitterAuthConfig.DEFAULT_AUTH_REQUEST_CODE, 209, 205}, new int[]{193, 157, 49, 147, 19, 57, 171, 91}, new int[]{62, 186, 136, 197, 169, 85, 44, 132}, new int[]{185, 133, 188, 142, 4, 12, 36, 108}, new int[]{113, PeripheralType.SERVO, 173, 97, 80, 29, 87, 50}, new int[]{150, 28, 84, 41, 123, 158, 52, 156}, new int[]{46, 138, 203, 187, 139, 206, 196, 166}, new int[]{76, 17, 51, 153, 37, 111, 122, 155}, new int[]{43, 129, 176, 106, 107, 110, 119, 146}, new int[]{16, 48, 144, 10, 30, 90, 59, 177}, new int[]{109, 116, 137, 200, 178, 112, 125, 164}, new int[]{70, 210, 208, Constant.Publish.REQUEST_CODE_PICK_FILE, 184, 130, 179, 115}, new int[]{134, 191, 151, 31, 93, 68, 204, 190}, new int[]{148, 22, 66, 198, 172, 94, 71, 2}, new int[]{6, 18, 54, 162, 64, 192, 154, 40}, new int[]{120, 149, 25, 75, 14, 42, 126, 167}, new int[]{79, 26, 78, 23, 69, 207, 199, 175}, new int[]{103, 98, 83, 38, 114, 131, 182, 124}, new int[]{161, 61, 183, 127, 170, 88, 53, 159}, new int[]{55, 165, 73, 8, 24, 72, 5, 15}, new int[]{45, 135, 194, 160, 58, 174, 100, 89}};
|
||||
private static final int[][] p = {new int[]{0, 0}, new int[]{0, 1, 1}, new int[]{0, 2, 1, 3}, new int[]{0, 4, 1, 3, 2}, new int[]{0, 4, 1, 3, 3, 5}, new int[]{0, 4, 1, 3, 4, 5, 5}, new int[]{0, 0, 1, 1, 2, 2, 3, 3}, new int[]{0, 0, 1, 1, 2, 2, 3, 4, 4}, new int[]{0, 0, 1, 1, 2, 2, 3, 4, 5, 5}, new int[]{0, 0, 1, 1, 2, 3, 3, 4, 4, 5, 5}};
|
||||
private final List<ExpandedPair> g = new ArrayList(11);
|
||||
private final List<ExpandedRow> h = new ArrayList();
|
||||
private final int[] i = new int[2];
|
||||
private boolean j;
|
||||
|
||||
private static boolean b(List<ExpandedPair> list) {
|
||||
boolean z;
|
||||
for (int[] iArr : p) {
|
||||
if (list.size() <= iArr.length) {
|
||||
int i = 0;
|
||||
while (true) {
|
||||
if (i >= list.size()) {
|
||||
z = true;
|
||||
break;
|
||||
}
|
||||
if (list.get(i).a().c() != iArr[i]) {
|
||||
z = false;
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if (z) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean g() {
|
||||
ExpandedPair expandedPair = this.g.get(0);
|
||||
DataCharacter b = expandedPair.b();
|
||||
DataCharacter c = expandedPair.c();
|
||||
if (c == null) {
|
||||
return false;
|
||||
}
|
||||
int a = c.a();
|
||||
int i = 2;
|
||||
for (int i2 = 1; i2 < this.g.size(); i2++) {
|
||||
ExpandedPair expandedPair2 = this.g.get(i2);
|
||||
a += expandedPair2.b().a();
|
||||
i++;
|
||||
DataCharacter c2 = expandedPair2.c();
|
||||
if (c2 != null) {
|
||||
a += c2.a();
|
||||
i++;
|
||||
}
|
||||
}
|
||||
return ((i + (-4)) * 211) + (a % 211) == b.b();
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.oned.OneDReader
|
||||
public Result a(int i, BitArray bitArray, Map<DecodeHintType, ?> map) throws NotFoundException, FormatException {
|
||||
this.g.clear();
|
||||
this.j = false;
|
||||
try {
|
||||
return a(a(i, bitArray));
|
||||
} catch (NotFoundException unused) {
|
||||
this.g.clear();
|
||||
this.j = true;
|
||||
return a(a(i, bitArray));
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.oned.OneDReader, com.google.zxing.Reader
|
||||
public void reset() {
|
||||
this.g.clear();
|
||||
this.h.clear();
|
||||
}
|
||||
|
||||
private void b(BitArray bitArray, List<ExpandedPair> list, int i) throws NotFoundException {
|
||||
int[] b = b();
|
||||
b[0] = 0;
|
||||
b[1] = 0;
|
||||
b[2] = 0;
|
||||
b[3] = 0;
|
||||
int h = bitArray.h();
|
||||
if (i < 0) {
|
||||
i = list.isEmpty() ? 0 : list.get(list.size() - 1).a().b()[1];
|
||||
}
|
||||
boolean z = list.size() % 2 != 0;
|
||||
if (this.j) {
|
||||
z = !z;
|
||||
}
|
||||
boolean z2 = false;
|
||||
while (i < h) {
|
||||
z2 = !bitArray.a(i);
|
||||
if (!z2) {
|
||||
break;
|
||||
} else {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
int i2 = i;
|
||||
int i3 = 0;
|
||||
while (i < h) {
|
||||
if (bitArray.a(i) != z2) {
|
||||
b[i3] = b[i3] + 1;
|
||||
} else {
|
||||
if (i3 == 3) {
|
||||
if (z) {
|
||||
b(b);
|
||||
}
|
||||
if (AbstractRSSReader.a(b)) {
|
||||
int[] iArr = this.i;
|
||||
iArr[0] = i2;
|
||||
iArr[1] = i;
|
||||
return;
|
||||
}
|
||||
if (z) {
|
||||
b(b);
|
||||
}
|
||||
i2 += b[0] + b[1];
|
||||
b[0] = b[2];
|
||||
b[1] = b[3];
|
||||
b[2] = 0;
|
||||
b[3] = 0;
|
||||
i3--;
|
||||
} else {
|
||||
i3++;
|
||||
}
|
||||
b[i3] = 1;
|
||||
z2 = !z2;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
|
||||
List<ExpandedPair> a(int i, BitArray bitArray) throws NotFoundException {
|
||||
boolean z = false;
|
||||
while (!z) {
|
||||
try {
|
||||
this.g.add(a(bitArray, this.g, i));
|
||||
} catch (NotFoundException e) {
|
||||
if (this.g.isEmpty()) {
|
||||
throw e;
|
||||
}
|
||||
z = true;
|
||||
}
|
||||
}
|
||||
if (g()) {
|
||||
return this.g;
|
||||
}
|
||||
boolean z2 = !this.h.isEmpty();
|
||||
a(i, false);
|
||||
if (z2) {
|
||||
List<ExpandedPair> a = a(false);
|
||||
if (a != null) {
|
||||
return a;
|
||||
}
|
||||
List<ExpandedPair> a2 = a(true);
|
||||
if (a2 != null) {
|
||||
return a2;
|
||||
}
|
||||
}
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
|
||||
private List<ExpandedPair> a(boolean z) {
|
||||
List<ExpandedPair> list = null;
|
||||
if (this.h.size() > 25) {
|
||||
this.h.clear();
|
||||
return null;
|
||||
}
|
||||
this.g.clear();
|
||||
if (z) {
|
||||
Collections.reverse(this.h);
|
||||
}
|
||||
try {
|
||||
list = a(new ArrayList(), 0);
|
||||
} catch (NotFoundException unused) {
|
||||
}
|
||||
if (z) {
|
||||
Collections.reverse(this.h);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private List<ExpandedPair> a(List<ExpandedRow> list, int i) throws NotFoundException {
|
||||
while (i < this.h.size()) {
|
||||
ExpandedRow expandedRow = this.h.get(i);
|
||||
this.g.clear();
|
||||
Iterator<ExpandedRow> it = list.iterator();
|
||||
while (it.hasNext()) {
|
||||
this.g.addAll(it.next().a());
|
||||
}
|
||||
this.g.addAll(expandedRow.a());
|
||||
if (b(this.g)) {
|
||||
if (g()) {
|
||||
return this.g;
|
||||
}
|
||||
ArrayList arrayList = new ArrayList(list);
|
||||
arrayList.add(expandedRow);
|
||||
try {
|
||||
return a(arrayList, i + 1);
|
||||
} catch (NotFoundException unused) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
|
||||
private static void b(int[] iArr) {
|
||||
int length = iArr.length;
|
||||
for (int i = 0; i < length / 2; i++) {
|
||||
int i2 = iArr[i];
|
||||
int i3 = (length - i) - 1;
|
||||
iArr[i] = iArr[i3];
|
||||
iArr[i3] = i2;
|
||||
}
|
||||
}
|
||||
|
||||
private void a(int i, boolean z) {
|
||||
boolean z2 = false;
|
||||
int i2 = 0;
|
||||
boolean z3 = false;
|
||||
while (true) {
|
||||
if (i2 >= this.h.size()) {
|
||||
break;
|
||||
}
|
||||
ExpandedRow expandedRow = this.h.get(i2);
|
||||
if (expandedRow.b() > i) {
|
||||
z2 = expandedRow.a(this.g);
|
||||
break;
|
||||
} else {
|
||||
z3 = expandedRow.a(this.g);
|
||||
i2++;
|
||||
}
|
||||
}
|
||||
if (z2 || z3 || a((Iterable<ExpandedPair>) this.g, (Iterable<ExpandedRow>) this.h)) {
|
||||
return;
|
||||
}
|
||||
this.h.add(i2, new ExpandedRow(this.g, i, z));
|
||||
a(this.g, this.h);
|
||||
}
|
||||
|
||||
private static void a(List<ExpandedPair> list, List<ExpandedRow> list2) {
|
||||
boolean z;
|
||||
Iterator<ExpandedRow> it = list2.iterator();
|
||||
while (it.hasNext()) {
|
||||
ExpandedRow next = it.next();
|
||||
if (next.a().size() != list.size()) {
|
||||
Iterator<ExpandedPair> it2 = next.a().iterator();
|
||||
while (true) {
|
||||
z = false;
|
||||
boolean z2 = true;
|
||||
if (!it2.hasNext()) {
|
||||
z = true;
|
||||
break;
|
||||
}
|
||||
ExpandedPair next2 = it2.next();
|
||||
Iterator<ExpandedPair> it3 = list.iterator();
|
||||
while (true) {
|
||||
if (!it3.hasNext()) {
|
||||
z2 = false;
|
||||
break;
|
||||
} else if (next2.equals(it3.next())) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!z2) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (z) {
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean a(Iterable<ExpandedPair> iterable, Iterable<ExpandedRow> iterable2) {
|
||||
boolean z;
|
||||
boolean z2;
|
||||
Iterator<ExpandedRow> it = iterable2.iterator();
|
||||
do {
|
||||
z = false;
|
||||
if (!it.hasNext()) {
|
||||
return false;
|
||||
}
|
||||
ExpandedRow next = it.next();
|
||||
Iterator<ExpandedPair> it2 = iterable.iterator();
|
||||
while (true) {
|
||||
if (!it2.hasNext()) {
|
||||
z = true;
|
||||
break;
|
||||
}
|
||||
ExpandedPair next2 = it2.next();
|
||||
Iterator<ExpandedPair> it3 = next.a().iterator();
|
||||
while (true) {
|
||||
if (!it3.hasNext()) {
|
||||
z2 = false;
|
||||
break;
|
||||
}
|
||||
if (next2.equals(it3.next())) {
|
||||
z2 = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!z2) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} while (!z);
|
||||
return true;
|
||||
}
|
||||
|
||||
static Result a(List<ExpandedPair> list) throws NotFoundException, FormatException {
|
||||
String c = AbstractExpandedDecoder.a(BitArrayBuilder.a(list)).c();
|
||||
ResultPoint[] a = list.get(0).a().a();
|
||||
ResultPoint[] a2 = list.get(list.size() - 1).a().a();
|
||||
return new Result(c, null, new ResultPoint[]{a[0], a[1], a2[0], a2[1]}, BarcodeFormat.RSS_EXPANDED);
|
||||
}
|
||||
|
||||
private static int a(BitArray bitArray, int i) {
|
||||
if (bitArray.a(i)) {
|
||||
return bitArray.b(bitArray.c(i));
|
||||
}
|
||||
return bitArray.c(bitArray.b(i));
|
||||
}
|
||||
|
||||
ExpandedPair a(BitArray bitArray, List<ExpandedPair> list, int i) throws NotFoundException {
|
||||
FinderPattern a;
|
||||
DataCharacter dataCharacter;
|
||||
boolean z = list.size() % 2 == 0;
|
||||
if (this.j) {
|
||||
z = !z;
|
||||
}
|
||||
int i2 = -1;
|
||||
boolean z2 = true;
|
||||
do {
|
||||
b(bitArray, list, i2);
|
||||
a = a(bitArray, i, z);
|
||||
if (a == null) {
|
||||
i2 = a(bitArray, this.i[0]);
|
||||
} else {
|
||||
z2 = false;
|
||||
}
|
||||
} while (z2);
|
||||
DataCharacter a2 = a(bitArray, a, z, true);
|
||||
if (!list.isEmpty() && list.get(list.size() - 1).d()) {
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
try {
|
||||
dataCharacter = a(bitArray, a, z, false);
|
||||
} catch (NotFoundException unused) {
|
||||
dataCharacter = null;
|
||||
}
|
||||
return new ExpandedPair(a2, dataCharacter, a, true);
|
||||
}
|
||||
|
||||
private FinderPattern a(BitArray bitArray, int i, boolean z) {
|
||||
int i2;
|
||||
int i3;
|
||||
int i4;
|
||||
if (z) {
|
||||
int i5 = this.i[0] - 1;
|
||||
while (i5 >= 0 && !bitArray.a(i5)) {
|
||||
i5--;
|
||||
}
|
||||
int i6 = i5 + 1;
|
||||
int[] iArr = this.i;
|
||||
int i7 = iArr[0] - i6;
|
||||
i3 = iArr[1];
|
||||
i4 = i6;
|
||||
i2 = i7;
|
||||
} else {
|
||||
int[] iArr2 = this.i;
|
||||
int i8 = iArr2[0];
|
||||
int c = bitArray.c(iArr2[1] + 1);
|
||||
i2 = c - this.i[1];
|
||||
i3 = c;
|
||||
i4 = i8;
|
||||
}
|
||||
int[] b = b();
|
||||
System.arraycopy(b, 0, b, 1, b.length - 1);
|
||||
b[0] = i2;
|
||||
try {
|
||||
return new FinderPattern(AbstractRSSReader.a(b, n), new int[]{i4, i3}, i4, i3, i);
|
||||
} catch (NotFoundException unused) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
DataCharacter a(BitArray bitArray, FinderPattern finderPattern, boolean z, boolean z2) throws NotFoundException {
|
||||
int[] a = a();
|
||||
for (int i = 0; i < a.length; i++) {
|
||||
a[i] = 0;
|
||||
}
|
||||
if (z2) {
|
||||
OneDReader.b(bitArray, finderPattern.b()[0], a);
|
||||
} else {
|
||||
OneDReader.a(bitArray, finderPattern.b()[1], a);
|
||||
int i2 = 0;
|
||||
for (int length = a.length - 1; i2 < length; length--) {
|
||||
int i3 = a[i2];
|
||||
a[i2] = a[length];
|
||||
a[length] = i3;
|
||||
i2++;
|
||||
}
|
||||
}
|
||||
float a2 = MathUtils.a(a) / 17.0f;
|
||||
float f = (finderPattern.b()[1] - finderPattern.b()[0]) / 15.0f;
|
||||
if (Math.abs(a2 - f) / f <= 0.3f) {
|
||||
int[] e = e();
|
||||
int[] c = c();
|
||||
float[] f2 = f();
|
||||
float[] d = d();
|
||||
for (int i4 = 0; i4 < a.length; i4++) {
|
||||
float f3 = (a[i4] * 1.0f) / a2;
|
||||
int i5 = (int) (0.5f + f3);
|
||||
int i6 = 8;
|
||||
if (i5 <= 0) {
|
||||
if (f3 < 0.3f) {
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
i6 = 1;
|
||||
} else if (i5 <= 8) {
|
||||
i6 = i5;
|
||||
} else if (f3 > 8.7f) {
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
int i7 = i4 / 2;
|
||||
if ((i4 & 1) == 0) {
|
||||
e[i7] = i6;
|
||||
f2[i7] = f3 - i6;
|
||||
} else {
|
||||
c[i7] = i6;
|
||||
d[i7] = f3 - i6;
|
||||
}
|
||||
}
|
||||
a(17);
|
||||
int c2 = (((finderPattern.c() * 4) + (z ? 0 : 2)) + (!z2 ? 1 : 0)) - 1;
|
||||
int i8 = 0;
|
||||
int i9 = 0;
|
||||
for (int length2 = e.length - 1; length2 >= 0; length2--) {
|
||||
if (a(finderPattern, z, z2)) {
|
||||
i8 += e[length2] * o[c2][length2 * 2];
|
||||
}
|
||||
i9 += e[length2];
|
||||
}
|
||||
int i10 = 0;
|
||||
for (int length3 = c.length - 1; length3 >= 0; length3--) {
|
||||
if (a(finderPattern, z, z2)) {
|
||||
i10 += c[length3] * o[c2][(length3 * 2) + 1];
|
||||
}
|
||||
}
|
||||
int i11 = i8 + i10;
|
||||
if ((i9 & 1) == 0 && i9 <= 13 && i9 >= 4) {
|
||||
int i12 = (13 - i9) / 2;
|
||||
int i13 = k[i12];
|
||||
return new DataCharacter((RSSUtils.a(e, i13, true) * l[i12]) + RSSUtils.a(c, 9 - i13, false) + m[i12], i11);
|
||||
}
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
|
||||
private static boolean a(FinderPattern finderPattern, boolean z, boolean z2) {
|
||||
return (finderPattern.c() == 0 && z && z2) ? false : true;
|
||||
}
|
||||
|
||||
/* JADX WARN: Removed duplicated region for block: B:12:0x0038 */
|
||||
/* JADX WARN: Removed duplicated region for block: B:14:0x003b */
|
||||
/* JADX WARN: Removed duplicated region for block: B:18:0x007b */
|
||||
/* JADX WARN: Removed duplicated region for block: B:24:0x0090 */
|
||||
/* JADX WARN: Removed duplicated region for block: B:26:0x009d */
|
||||
/* JADX WARN: Removed duplicated region for block: B:31:0x00b2 */
|
||||
/* JADX WARN: Removed duplicated region for block: B:33:? A[RETURN, SYNTHETIC] */
|
||||
/* JADX WARN: Removed duplicated region for block: B:40:0x004f */
|
||||
/* JADX WARN: Removed duplicated region for block: B:64:0x0033 */
|
||||
/* JADX WARN: Removed duplicated region for block: B:65:0x0024 */
|
||||
/* JADX WARN: Removed duplicated region for block: B:6:0x0021 */
|
||||
/* JADX WARN: Removed duplicated region for block: B:9:0x0031 */
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
||||
*/
|
||||
private void a(int r11) throws com.google.zxing.NotFoundException {
|
||||
/*
|
||||
r10 = this;
|
||||
int[] r0 = r10.e()
|
||||
int r0 = com.google.zxing.common.detector.MathUtils.a(r0)
|
||||
int[] r1 = r10.c()
|
||||
int r1 = com.google.zxing.common.detector.MathUtils.a(r1)
|
||||
r2 = 4
|
||||
r3 = 13
|
||||
r4 = 0
|
||||
r5 = 1
|
||||
if (r0 <= r3) goto L19
|
||||
r6 = 1
|
||||
goto L1e
|
||||
L19:
|
||||
r6 = 0
|
||||
if (r0 >= r2) goto L1e
|
||||
r7 = 1
|
||||
goto L1f
|
||||
L1e:
|
||||
r7 = 0
|
||||
L1f:
|
||||
if (r1 <= r3) goto L24
|
||||
r2 = 0
|
||||
r3 = 1
|
||||
goto L2a
|
||||
L24:
|
||||
if (r1 >= r2) goto L28
|
||||
r2 = 1
|
||||
goto L29
|
||||
L28:
|
||||
r2 = 0
|
||||
L29:
|
||||
r3 = 0
|
||||
L2a:
|
||||
int r8 = r0 + r1
|
||||
int r8 = r8 - r11
|
||||
r11 = r0 & 1
|
||||
if (r11 != r5) goto L33
|
||||
r11 = 1
|
||||
goto L34
|
||||
L33:
|
||||
r11 = 0
|
||||
L34:
|
||||
r9 = r1 & 1
|
||||
if (r9 != 0) goto L39
|
||||
r4 = 1
|
||||
L39:
|
||||
if (r8 != r5) goto L4f
|
||||
if (r11 == 0) goto L46
|
||||
if (r4 != 0) goto L41
|
||||
L3f:
|
||||
r6 = 1
|
||||
goto L79
|
||||
L41:
|
||||
com.google.zxing.NotFoundException r11 = com.google.zxing.NotFoundException.getNotFoundInstance()
|
||||
throw r11
|
||||
L46:
|
||||
if (r4 == 0) goto L4a
|
||||
r3 = 1
|
||||
goto L79
|
||||
L4a:
|
||||
com.google.zxing.NotFoundException r11 = com.google.zxing.NotFoundException.getNotFoundInstance()
|
||||
throw r11
|
||||
L4f:
|
||||
r9 = -1
|
||||
if (r8 != r9) goto L66
|
||||
if (r11 == 0) goto L5d
|
||||
if (r4 != 0) goto L58
|
||||
L56:
|
||||
r7 = 1
|
||||
goto L79
|
||||
L58:
|
||||
com.google.zxing.NotFoundException r11 = com.google.zxing.NotFoundException.getNotFoundInstance()
|
||||
throw r11
|
||||
L5d:
|
||||
if (r4 == 0) goto L61
|
||||
r2 = 1
|
||||
goto L79
|
||||
L61:
|
||||
com.google.zxing.NotFoundException r11 = com.google.zxing.NotFoundException.getNotFoundInstance()
|
||||
throw r11
|
||||
L66:
|
||||
if (r8 != 0) goto Lc3
|
||||
if (r11 == 0) goto L77
|
||||
if (r4 == 0) goto L72
|
||||
if (r0 >= r1) goto L70
|
||||
r3 = 1
|
||||
goto L56
|
||||
L70:
|
||||
r2 = 1
|
||||
goto L3f
|
||||
L72:
|
||||
com.google.zxing.NotFoundException r11 = com.google.zxing.NotFoundException.getNotFoundInstance()
|
||||
throw r11
|
||||
L77:
|
||||
if (r4 != 0) goto Lbe
|
||||
L79:
|
||||
if (r7 == 0) goto L8e
|
||||
if (r6 != 0) goto L89
|
||||
int[] r11 = r10.e()
|
||||
float[] r0 = r10.f()
|
||||
com.google.zxing.oned.rss.AbstractRSSReader.b(r11, r0)
|
||||
goto L8e
|
||||
L89:
|
||||
com.google.zxing.NotFoundException r11 = com.google.zxing.NotFoundException.getNotFoundInstance()
|
||||
throw r11
|
||||
L8e:
|
||||
if (r6 == 0) goto L9b
|
||||
int[] r11 = r10.e()
|
||||
float[] r0 = r10.f()
|
||||
com.google.zxing.oned.rss.AbstractRSSReader.a(r11, r0)
|
||||
L9b:
|
||||
if (r2 == 0) goto Lb0
|
||||
if (r3 != 0) goto Lab
|
||||
int[] r11 = r10.c()
|
||||
float[] r0 = r10.f()
|
||||
com.google.zxing.oned.rss.AbstractRSSReader.b(r11, r0)
|
||||
goto Lb0
|
||||
Lab:
|
||||
com.google.zxing.NotFoundException r11 = com.google.zxing.NotFoundException.getNotFoundInstance()
|
||||
throw r11
|
||||
Lb0:
|
||||
if (r3 == 0) goto Lbd
|
||||
int[] r11 = r10.c()
|
||||
float[] r0 = r10.d()
|
||||
com.google.zxing.oned.rss.AbstractRSSReader.a(r11, r0)
|
||||
Lbd:
|
||||
return
|
||||
Lbe:
|
||||
com.google.zxing.NotFoundException r11 = com.google.zxing.NotFoundException.getNotFoundInstance()
|
||||
throw r11
|
||||
Lc3:
|
||||
com.google.zxing.NotFoundException r11 = com.google.zxing.NotFoundException.getNotFoundInstance()
|
||||
throw r11
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: com.google.zxing.oned.rss.expanded.RSSExpandedReader.a(int):void");
|
||||
}
|
||||
}
|
@@ -0,0 +1,20 @@
|
||||
package com.google.zxing.oned.rss.expanded.decoders;
|
||||
|
||||
import com.google.zxing.common.BitArray;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class AI013103decoder extends AI013x0xDecoder {
|
||||
AI013103decoder(BitArray bitArray) {
|
||||
super(bitArray);
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.oned.rss.expanded.decoders.AI01weightDecoder
|
||||
protected int a(int i) {
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.oned.rss.expanded.decoders.AI01weightDecoder
|
||||
protected void b(StringBuilder sb, int i) {
|
||||
sb.append("(3103)");
|
||||
}
|
||||
}
|
@@ -0,0 +1,25 @@
|
||||
package com.google.zxing.oned.rss.expanded.decoders;
|
||||
|
||||
import com.google.zxing.common.BitArray;
|
||||
import com.thoughtworks.xstream.XStream;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class AI01320xDecoder extends AI013x0xDecoder {
|
||||
AI01320xDecoder(BitArray bitArray) {
|
||||
super(bitArray);
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.oned.rss.expanded.decoders.AI01weightDecoder
|
||||
protected int a(int i) {
|
||||
return i < 10000 ? i : i - XStream.PRIORITY_VERY_HIGH;
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.oned.rss.expanded.decoders.AI01weightDecoder
|
||||
protected void b(StringBuilder sb, int i) {
|
||||
if (i < 10000) {
|
||||
sb.append("(3202)");
|
||||
} else {
|
||||
sb.append("(3203)");
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,27 @@
|
||||
package com.google.zxing.oned.rss.expanded.decoders;
|
||||
|
||||
import com.google.zxing.FormatException;
|
||||
import com.google.zxing.NotFoundException;
|
||||
import com.google.zxing.common.BitArray;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class AI01392xDecoder extends AI01decoder {
|
||||
AI01392xDecoder(BitArray bitArray) {
|
||||
super(bitArray);
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.oned.rss.expanded.decoders.AbstractExpandedDecoder
|
||||
public String c() throws NotFoundException, FormatException {
|
||||
if (b().h() < 48) {
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
a(sb, 8);
|
||||
int a = a().a(48, 2);
|
||||
sb.append("(392");
|
||||
sb.append(a);
|
||||
sb.append(')');
|
||||
sb.append(a().a(50, (String) null).b());
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
@@ -0,0 +1,35 @@
|
||||
package com.google.zxing.oned.rss.expanded.decoders;
|
||||
|
||||
import com.google.zxing.FormatException;
|
||||
import com.google.zxing.NotFoundException;
|
||||
import com.google.zxing.common.BitArray;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class AI01393xDecoder extends AI01decoder {
|
||||
AI01393xDecoder(BitArray bitArray) {
|
||||
super(bitArray);
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.oned.rss.expanded.decoders.AbstractExpandedDecoder
|
||||
public String c() throws NotFoundException, FormatException {
|
||||
if (b().h() < 48) {
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
a(sb, 8);
|
||||
int a = a().a(48, 2);
|
||||
sb.append("(393");
|
||||
sb.append(a);
|
||||
sb.append(')');
|
||||
int a2 = a().a(50, 10);
|
||||
if (a2 / 100 == 0) {
|
||||
sb.append('0');
|
||||
}
|
||||
if (a2 / 10 == 0) {
|
||||
sb.append('0');
|
||||
}
|
||||
sb.append(a2);
|
||||
sb.append(a().a(60, (String) null).b());
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
@@ -0,0 +1,67 @@
|
||||
package com.google.zxing.oned.rss.expanded.decoders;
|
||||
|
||||
import com.google.zxing.NotFoundException;
|
||||
import com.google.zxing.common.BitArray;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class AI013x0x1xDecoder extends AI01weightDecoder {
|
||||
private final String c;
|
||||
private final String d;
|
||||
|
||||
AI013x0x1xDecoder(BitArray bitArray, String str, String str2) {
|
||||
super(bitArray);
|
||||
this.c = str2;
|
||||
this.d = str;
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.oned.rss.expanded.decoders.AI01weightDecoder
|
||||
protected int a(int i) {
|
||||
return i % 100000;
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.oned.rss.expanded.decoders.AI01weightDecoder
|
||||
protected void b(StringBuilder sb, int i) {
|
||||
sb.append('(');
|
||||
sb.append(this.d);
|
||||
sb.append(i / 100000);
|
||||
sb.append(')');
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.oned.rss.expanded.decoders.AbstractExpandedDecoder
|
||||
public String c() throws NotFoundException {
|
||||
if (b().h() != 84) {
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
a(sb, 8);
|
||||
b(sb, 48, 20);
|
||||
c(sb, 68);
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private void c(StringBuilder sb, int i) {
|
||||
int a = a().a(i, 16);
|
||||
if (a == 38400) {
|
||||
return;
|
||||
}
|
||||
sb.append('(');
|
||||
sb.append(this.c);
|
||||
sb.append(')');
|
||||
int i2 = a % 32;
|
||||
int i3 = a / 32;
|
||||
int i4 = (i3 % 12) + 1;
|
||||
int i5 = i3 / 12;
|
||||
if (i5 / 10 == 0) {
|
||||
sb.append('0');
|
||||
}
|
||||
sb.append(i5);
|
||||
if (i4 / 10 == 0) {
|
||||
sb.append('0');
|
||||
}
|
||||
sb.append(i4);
|
||||
if (i2 / 10 == 0) {
|
||||
sb.append('0');
|
||||
}
|
||||
sb.append(i2);
|
||||
}
|
||||
}
|
@@ -0,0 +1,22 @@
|
||||
package com.google.zxing.oned.rss.expanded.decoders;
|
||||
|
||||
import com.google.zxing.NotFoundException;
|
||||
import com.google.zxing.common.BitArray;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
abstract class AI013x0xDecoder extends AI01weightDecoder {
|
||||
AI013x0xDecoder(BitArray bitArray) {
|
||||
super(bitArray);
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.oned.rss.expanded.decoders.AbstractExpandedDecoder
|
||||
public String c() throws NotFoundException {
|
||||
if (b().h() != 60) {
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
a(sb, 5);
|
||||
b(sb, 45, 15);
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
@@ -0,0 +1,22 @@
|
||||
package com.google.zxing.oned.rss.expanded.decoders;
|
||||
|
||||
import com.google.zxing.FormatException;
|
||||
import com.google.zxing.NotFoundException;
|
||||
import com.google.zxing.common.BitArray;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class AI01AndOtherAIs extends AI01decoder {
|
||||
AI01AndOtherAIs(BitArray bitArray) {
|
||||
super(bitArray);
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.oned.rss.expanded.decoders.AbstractExpandedDecoder
|
||||
public String c() throws NotFoundException, FormatException {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("(01)");
|
||||
int length = sb.length();
|
||||
sb.append(a().a(4, 4));
|
||||
a(sb, 8, length);
|
||||
return a().a(sb, 48);
|
||||
}
|
||||
}
|
@@ -0,0 +1,44 @@
|
||||
package com.google.zxing.oned.rss.expanded.decoders;
|
||||
|
||||
import com.google.zxing.common.BitArray;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
abstract class AI01decoder extends AbstractExpandedDecoder {
|
||||
AI01decoder(BitArray bitArray) {
|
||||
super(bitArray);
|
||||
}
|
||||
|
||||
private static void b(StringBuilder sb, int i) {
|
||||
int i2 = 0;
|
||||
for (int i3 = 0; i3 < 13; i3++) {
|
||||
int charAt = sb.charAt(i3 + i) - '0';
|
||||
if ((i3 & 1) == 0) {
|
||||
charAt *= 3;
|
||||
}
|
||||
i2 += charAt;
|
||||
}
|
||||
int i4 = 10 - (i2 % 10);
|
||||
sb.append(i4 != 10 ? i4 : 0);
|
||||
}
|
||||
|
||||
final void a(StringBuilder sb, int i) {
|
||||
sb.append("(01)");
|
||||
int length = sb.length();
|
||||
sb.append('9');
|
||||
a(sb, i, length);
|
||||
}
|
||||
|
||||
final void a(StringBuilder sb, int i, int i2) {
|
||||
for (int i3 = 0; i3 < 4; i3++) {
|
||||
int a = a().a((i3 * 10) + i, 10);
|
||||
if (a / 100 == 0) {
|
||||
sb.append('0');
|
||||
}
|
||||
if (a / 10 == 0) {
|
||||
sb.append('0');
|
||||
}
|
||||
sb.append(a);
|
||||
}
|
||||
b(sb, i2);
|
||||
}
|
||||
}
|
@@ -0,0 +1,28 @@
|
||||
package com.google.zxing.oned.rss.expanded.decoders;
|
||||
|
||||
import com.google.zxing.common.BitArray;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
abstract class AI01weightDecoder extends AI01decoder {
|
||||
AI01weightDecoder(BitArray bitArray) {
|
||||
super(bitArray);
|
||||
}
|
||||
|
||||
protected abstract int a(int i);
|
||||
|
||||
protected abstract void b(StringBuilder sb, int i);
|
||||
|
||||
final void b(StringBuilder sb, int i, int i2) {
|
||||
int a = a().a(i, i2);
|
||||
b(sb, a);
|
||||
int a2 = a(a);
|
||||
int i3 = 100000;
|
||||
for (int i4 = 0; i4 < 5; i4++) {
|
||||
if (a2 / i3 == 0) {
|
||||
sb.append('0');
|
||||
}
|
||||
i3 /= 10;
|
||||
}
|
||||
sb.append(a2);
|
||||
}
|
||||
}
|
@@ -0,0 +1,69 @@
|
||||
package com.google.zxing.oned.rss.expanded.decoders;
|
||||
|
||||
import com.google.zxing.FormatException;
|
||||
import com.google.zxing.NotFoundException;
|
||||
import com.google.zxing.common.BitArray;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public abstract class AbstractExpandedDecoder {
|
||||
private final BitArray a;
|
||||
private final GeneralAppIdDecoder b;
|
||||
|
||||
AbstractExpandedDecoder(BitArray bitArray) {
|
||||
this.a = bitArray;
|
||||
this.b = new GeneralAppIdDecoder(bitArray);
|
||||
}
|
||||
|
||||
protected final GeneralAppIdDecoder a() {
|
||||
return this.b;
|
||||
}
|
||||
|
||||
protected final BitArray b() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
public abstract String c() throws NotFoundException, FormatException;
|
||||
|
||||
public static AbstractExpandedDecoder a(BitArray bitArray) {
|
||||
if (bitArray.a(1)) {
|
||||
return new AI01AndOtherAIs(bitArray);
|
||||
}
|
||||
if (!bitArray.a(2)) {
|
||||
return new AnyAIDecoder(bitArray);
|
||||
}
|
||||
int a = GeneralAppIdDecoder.a(bitArray, 1, 4);
|
||||
if (a == 4) {
|
||||
return new AI013103decoder(bitArray);
|
||||
}
|
||||
if (a == 5) {
|
||||
return new AI01320xDecoder(bitArray);
|
||||
}
|
||||
int a2 = GeneralAppIdDecoder.a(bitArray, 1, 5);
|
||||
if (a2 == 12) {
|
||||
return new AI01392xDecoder(bitArray);
|
||||
}
|
||||
if (a2 == 13) {
|
||||
return new AI01393xDecoder(bitArray);
|
||||
}
|
||||
switch (GeneralAppIdDecoder.a(bitArray, 1, 7)) {
|
||||
case 56:
|
||||
return new AI013x0x1xDecoder(bitArray, "310", "11");
|
||||
case 57:
|
||||
return new AI013x0x1xDecoder(bitArray, "320", "11");
|
||||
case 58:
|
||||
return new AI013x0x1xDecoder(bitArray, "310", "13");
|
||||
case 59:
|
||||
return new AI013x0x1xDecoder(bitArray, "320", "13");
|
||||
case 60:
|
||||
return new AI013x0x1xDecoder(bitArray, "310", "15");
|
||||
case 61:
|
||||
return new AI013x0x1xDecoder(bitArray, "320", "15");
|
||||
case 62:
|
||||
return new AI013x0x1xDecoder(bitArray, "310", "17");
|
||||
case 63:
|
||||
return new AI013x0x1xDecoder(bitArray, "320", "17");
|
||||
default:
|
||||
throw new IllegalStateException("unknown decoder: ".concat(String.valueOf(bitArray)));
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,17 @@
|
||||
package com.google.zxing.oned.rss.expanded.decoders;
|
||||
|
||||
import com.google.zxing.FormatException;
|
||||
import com.google.zxing.NotFoundException;
|
||||
import com.google.zxing.common.BitArray;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class AnyAIDecoder extends AbstractExpandedDecoder {
|
||||
AnyAIDecoder(BitArray bitArray) {
|
||||
super(bitArray);
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.oned.rss.expanded.decoders.AbstractExpandedDecoder
|
||||
public String c() throws NotFoundException, FormatException {
|
||||
return a().a(new StringBuilder(), 5);
|
||||
}
|
||||
}
|
@@ -0,0 +1,24 @@
|
||||
package com.google.zxing.oned.rss.expanded.decoders;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class BlockParsedResult {
|
||||
private final DecodedInformation a;
|
||||
private final boolean b;
|
||||
|
||||
BlockParsedResult(boolean z) {
|
||||
this(null, z);
|
||||
}
|
||||
|
||||
DecodedInformation a() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
boolean b() {
|
||||
return this.b;
|
||||
}
|
||||
|
||||
BlockParsedResult(DecodedInformation decodedInformation, boolean z) {
|
||||
this.b = z;
|
||||
this.a = decodedInformation;
|
||||
}
|
||||
}
|
@@ -0,0 +1,48 @@
|
||||
package com.google.zxing.oned.rss.expanded.decoders;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class CurrentParsingState {
|
||||
private int a = 0;
|
||||
private State b = State.NUMERIC;
|
||||
|
||||
private enum State {
|
||||
NUMERIC,
|
||||
ALPHA,
|
||||
ISO_IEC_646
|
||||
}
|
||||
|
||||
CurrentParsingState() {
|
||||
}
|
||||
|
||||
int a() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
void b(int i) {
|
||||
this.a = i;
|
||||
}
|
||||
|
||||
boolean c() {
|
||||
return this.b == State.ISO_IEC_646;
|
||||
}
|
||||
|
||||
void d() {
|
||||
this.b = State.ALPHA;
|
||||
}
|
||||
|
||||
void e() {
|
||||
this.b = State.ISO_IEC_646;
|
||||
}
|
||||
|
||||
void f() {
|
||||
this.b = State.NUMERIC;
|
||||
}
|
||||
|
||||
void a(int i) {
|
||||
this.a += i;
|
||||
}
|
||||
|
||||
boolean b() {
|
||||
return this.b == State.ALPHA;
|
||||
}
|
||||
}
|
@@ -0,0 +1,19 @@
|
||||
package com.google.zxing.oned.rss.expanded.decoders;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class DecodedChar extends DecodedObject {
|
||||
private final char b;
|
||||
|
||||
DecodedChar(int i, char c) {
|
||||
super(i);
|
||||
this.b = c;
|
||||
}
|
||||
|
||||
char b() {
|
||||
return this.b;
|
||||
}
|
||||
|
||||
boolean c() {
|
||||
return this.b == '$';
|
||||
}
|
||||
}
|
@@ -0,0 +1,34 @@
|
||||
package com.google.zxing.oned.rss.expanded.decoders;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class DecodedInformation extends DecodedObject {
|
||||
private final String b;
|
||||
private final int c;
|
||||
private final boolean d;
|
||||
|
||||
DecodedInformation(int i, String str) {
|
||||
super(i);
|
||||
this.b = str;
|
||||
this.d = false;
|
||||
this.c = 0;
|
||||
}
|
||||
|
||||
String b() {
|
||||
return this.b;
|
||||
}
|
||||
|
||||
int c() {
|
||||
return this.c;
|
||||
}
|
||||
|
||||
boolean d() {
|
||||
return this.d;
|
||||
}
|
||||
|
||||
DecodedInformation(int i, String str, int i2) {
|
||||
super(i);
|
||||
this.d = true;
|
||||
this.c = i2;
|
||||
this.b = str;
|
||||
}
|
||||
}
|
@@ -0,0 +1,34 @@
|
||||
package com.google.zxing.oned.rss.expanded.decoders;
|
||||
|
||||
import com.google.zxing.FormatException;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class DecodedNumeric extends DecodedObject {
|
||||
private final int b;
|
||||
private final int c;
|
||||
|
||||
DecodedNumeric(int i, int i2, int i3) throws FormatException {
|
||||
super(i);
|
||||
if (i2 < 0 || i2 > 10 || i3 < 0 || i3 > 10) {
|
||||
throw FormatException.getFormatInstance();
|
||||
}
|
||||
this.b = i2;
|
||||
this.c = i3;
|
||||
}
|
||||
|
||||
int b() {
|
||||
return this.b;
|
||||
}
|
||||
|
||||
int c() {
|
||||
return this.c;
|
||||
}
|
||||
|
||||
boolean d() {
|
||||
return this.b == 10;
|
||||
}
|
||||
|
||||
boolean e() {
|
||||
return this.c == 10;
|
||||
}
|
||||
}
|
@@ -0,0 +1,14 @@
|
||||
package com.google.zxing.oned.rss.expanded.decoders;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
abstract class DecodedObject {
|
||||
private final int a;
|
||||
|
||||
DecodedObject(int i) {
|
||||
this.a = i;
|
||||
}
|
||||
|
||||
final int a() {
|
||||
return this.a;
|
||||
}
|
||||
}
|
@@ -0,0 +1,84 @@
|
||||
package com.google.zxing.oned.rss.expanded.decoders;
|
||||
|
||||
import com.google.zxing.NotFoundException;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class FieldParser {
|
||||
private static final Object a = new Object();
|
||||
private static final Object[][] b = {new Object[]{"00", 18}, new Object[]{"01", 14}, new Object[]{"02", 14}, new Object[]{"10", a, 20}, new Object[]{"11", 6}, new Object[]{"12", 6}, new Object[]{"13", 6}, new Object[]{"15", 6}, new Object[]{"17", 6}, new Object[]{"20", 2}, new Object[]{"21", a, 20}, new Object[]{"22", a, 29}, new Object[]{"30", a, 8}, new Object[]{"37", a, 8}, new Object[]{"90", a, 30}, new Object[]{"91", a, 30}, new Object[]{"92", a, 30}, new Object[]{"93", a, 30}, new Object[]{"94", a, 30}, new Object[]{"95", a, 30}, new Object[]{"96", a, 30}, new Object[]{"97", a, 30}, new Object[]{"98", a, 30}, new Object[]{"99", a, 30}};
|
||||
private static final Object[][] c = {new Object[]{"240", a, 30}, new Object[]{"241", a, 30}, new Object[]{"242", a, 6}, new Object[]{"250", a, 30}, new Object[]{"251", a, 30}, new Object[]{"253", a, 17}, new Object[]{"254", a, 20}, new Object[]{"400", a, 30}, new Object[]{"401", a, 30}, new Object[]{"402", 17}, new Object[]{"403", a, 30}, new Object[]{"410", 13}, new Object[]{"411", 13}, new Object[]{"412", 13}, new Object[]{"413", 13}, new Object[]{"414", 13}, new Object[]{"420", a, 20}, new Object[]{"421", a, 15}, new Object[]{"422", 3}, new Object[]{"423", a, 15}, new Object[]{"424", 3}, new Object[]{"425", 3}, new Object[]{"426", 3}};
|
||||
private static final Object[][] d = {new Object[]{"310", 6}, new Object[]{"311", 6}, new Object[]{"312", 6}, new Object[]{"313", 6}, new Object[]{"314", 6}, new Object[]{"315", 6}, new Object[]{"316", 6}, new Object[]{"320", 6}, new Object[]{"321", 6}, new Object[]{"322", 6}, new Object[]{"323", 6}, new Object[]{"324", 6}, new Object[]{"325", 6}, new Object[]{"326", 6}, new Object[]{"327", 6}, new Object[]{"328", 6}, new Object[]{"329", 6}, new Object[]{"330", 6}, new Object[]{"331", 6}, new Object[]{"332", 6}, new Object[]{"333", 6}, new Object[]{"334", 6}, new Object[]{"335", 6}, new Object[]{"336", 6}, new Object[]{"340", 6}, new Object[]{"341", 6}, new Object[]{"342", 6}, new Object[]{"343", 6}, new Object[]{"344", 6}, new Object[]{"345", 6}, new Object[]{"346", 6}, new Object[]{"347", 6}, new Object[]{"348", 6}, new Object[]{"349", 6}, new Object[]{"350", 6}, new Object[]{"351", 6}, new Object[]{"352", 6}, new Object[]{"353", 6}, new Object[]{"354", 6}, new Object[]{"355", 6}, new Object[]{"356", 6}, new Object[]{"357", 6}, new Object[]{"360", 6}, new Object[]{"361", 6}, new Object[]{"362", 6}, new Object[]{"363", 6}, new Object[]{"364", 6}, new Object[]{"365", 6}, new Object[]{"366", 6}, new Object[]{"367", 6}, new Object[]{"368", 6}, new Object[]{"369", 6}, new Object[]{"390", a, 15}, new Object[]{"391", a, 18}, new Object[]{"392", a, 15}, new Object[]{"393", a, 18}, new Object[]{"703", a, 30}};
|
||||
private static final Object[][] e = {new Object[]{"7001", 13}, new Object[]{"7002", a, 30}, new Object[]{"7003", 10}, new Object[]{"8001", 14}, new Object[]{"8002", a, 20}, new Object[]{"8003", a, 30}, new Object[]{"8004", a, 30}, new Object[]{"8005", 6}, new Object[]{"8006", 18}, new Object[]{"8007", a, 30}, new Object[]{"8008", a, 12}, new Object[]{"8018", 18}, new Object[]{"8020", a, 25}, new Object[]{"8100", 6}, new Object[]{"8101", 10}, new Object[]{"8102", 2}, new Object[]{"8110", a, 70}, new Object[]{"8200", a, 70}};
|
||||
|
||||
static String a(String str) throws NotFoundException {
|
||||
if (str.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
if (str.length() < 2) {
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
String substring = str.substring(0, 2);
|
||||
for (Object[] objArr : b) {
|
||||
if (objArr[0].equals(substring)) {
|
||||
return objArr[1] == a ? b(2, ((Integer) objArr[2]).intValue(), str) : a(2, ((Integer) objArr[1]).intValue(), str);
|
||||
}
|
||||
}
|
||||
if (str.length() < 3) {
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
String substring2 = str.substring(0, 3);
|
||||
for (Object[] objArr2 : c) {
|
||||
if (objArr2[0].equals(substring2)) {
|
||||
return objArr2[1] == a ? b(3, ((Integer) objArr2[2]).intValue(), str) : a(3, ((Integer) objArr2[1]).intValue(), str);
|
||||
}
|
||||
}
|
||||
for (Object[] objArr3 : d) {
|
||||
if (objArr3[0].equals(substring2)) {
|
||||
return objArr3[1] == a ? b(4, ((Integer) objArr3[2]).intValue(), str) : a(4, ((Integer) objArr3[1]).intValue(), str);
|
||||
}
|
||||
}
|
||||
if (str.length() < 4) {
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
String substring3 = str.substring(0, 4);
|
||||
for (Object[] objArr4 : e) {
|
||||
if (objArr4[0].equals(substring3)) {
|
||||
return objArr4[1] == a ? b(4, ((Integer) objArr4[2]).intValue(), str) : a(4, ((Integer) objArr4[1]).intValue(), str);
|
||||
}
|
||||
}
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
|
||||
private static String b(int i, int i2, String str) throws NotFoundException {
|
||||
String substring = str.substring(0, i);
|
||||
int i3 = i2 + i;
|
||||
if (str.length() < i3) {
|
||||
i3 = str.length();
|
||||
}
|
||||
String substring2 = str.substring(i, i3);
|
||||
String str2 = "(" + substring + ')' + substring2;
|
||||
String a2 = a(str.substring(i3));
|
||||
if (a2 == null) {
|
||||
return str2;
|
||||
}
|
||||
return str2 + a2;
|
||||
}
|
||||
|
||||
private static String a(int i, int i2, String str) throws NotFoundException {
|
||||
if (str.length() >= i) {
|
||||
String substring = str.substring(0, i);
|
||||
int i3 = i2 + i;
|
||||
if (str.length() >= i3) {
|
||||
String substring2 = str.substring(i, i3);
|
||||
String str2 = "(" + substring + ')' + substring2;
|
||||
String a2 = a(str.substring(i3));
|
||||
if (a2 == null) {
|
||||
return str2;
|
||||
}
|
||||
return str2 + a2;
|
||||
}
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
}
|
@@ -0,0 +1,372 @@
|
||||
package com.google.zxing.oned.rss.expanded.decoders;
|
||||
|
||||
import androidx.recyclerview.widget.ItemTouchHelper;
|
||||
import com.google.zxing.FormatException;
|
||||
import com.google.zxing.NotFoundException;
|
||||
import com.google.zxing.common.BitArray;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class GeneralAppIdDecoder {
|
||||
private final BitArray a;
|
||||
private final CurrentParsingState b = new CurrentParsingState();
|
||||
private final StringBuilder c = new StringBuilder();
|
||||
|
||||
GeneralAppIdDecoder(BitArray bitArray) {
|
||||
this.a = bitArray;
|
||||
}
|
||||
|
||||
private DecodedInformation b() throws FormatException {
|
||||
BlockParsedResult d;
|
||||
boolean b;
|
||||
do {
|
||||
int a = this.b.a();
|
||||
if (this.b.b()) {
|
||||
d = a();
|
||||
b = d.b();
|
||||
} else if (this.b.c()) {
|
||||
d = c();
|
||||
b = d.b();
|
||||
} else {
|
||||
d = d();
|
||||
b = d.b();
|
||||
}
|
||||
if (!(a != this.b.a()) && !b) {
|
||||
break;
|
||||
}
|
||||
} while (!b);
|
||||
return d.a();
|
||||
}
|
||||
|
||||
private DecodedNumeric c(int i) throws FormatException {
|
||||
int i2 = i + 7;
|
||||
if (i2 > this.a.h()) {
|
||||
int a = a(i, 4);
|
||||
return a == 0 ? new DecodedNumeric(this.a.h(), 10, 10) : new DecodedNumeric(this.a.h(), a - 1, 10);
|
||||
}
|
||||
int a2 = a(i, 7) - 8;
|
||||
return new DecodedNumeric(i2, a2 / 11, a2 % 11);
|
||||
}
|
||||
|
||||
private BlockParsedResult d() throws FormatException {
|
||||
while (i(this.b.a())) {
|
||||
DecodedNumeric c = c(this.b.a());
|
||||
this.b.b(c.a());
|
||||
if (c.d()) {
|
||||
return new BlockParsedResult(c.e() ? new DecodedInformation(this.b.a(), this.c.toString()) : new DecodedInformation(this.b.a(), this.c.toString(), c.c()), true);
|
||||
}
|
||||
this.c.append(c.b());
|
||||
if (c.e()) {
|
||||
return new BlockParsedResult(new DecodedInformation(this.b.a(), this.c.toString()), true);
|
||||
}
|
||||
this.c.append(c.c());
|
||||
}
|
||||
if (f(this.b.a())) {
|
||||
this.b.d();
|
||||
this.b.a(4);
|
||||
}
|
||||
return new BlockParsedResult(false);
|
||||
}
|
||||
|
||||
private boolean e(int i) {
|
||||
int i2;
|
||||
if (i + 1 > this.a.h()) {
|
||||
return false;
|
||||
}
|
||||
for (int i3 = 0; i3 < 5 && (i2 = i3 + i) < this.a.h(); i3++) {
|
||||
if (i3 == 2) {
|
||||
if (!this.a.a(i + 2)) {
|
||||
return false;
|
||||
}
|
||||
} else if (this.a.a(i2)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean f(int i) {
|
||||
int i2;
|
||||
if (i + 1 > this.a.h()) {
|
||||
return false;
|
||||
}
|
||||
for (int i3 = 0; i3 < 4 && (i2 = i3 + i) < this.a.h(); i3++) {
|
||||
if (this.a.a(i2)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean g(int i) {
|
||||
int a;
|
||||
if (i + 5 > this.a.h()) {
|
||||
return false;
|
||||
}
|
||||
int a2 = a(i, 5);
|
||||
if (a2 < 5 || a2 >= 16) {
|
||||
return i + 6 <= this.a.h() && (a = a(i, 6)) >= 16 && a < 63;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean h(int i) {
|
||||
int a;
|
||||
if (i + 5 > this.a.h()) {
|
||||
return false;
|
||||
}
|
||||
int a2 = a(i, 5);
|
||||
if (a2 >= 5 && a2 < 16) {
|
||||
return true;
|
||||
}
|
||||
if (i + 7 > this.a.h()) {
|
||||
return false;
|
||||
}
|
||||
int a3 = a(i, 7);
|
||||
if (a3 < 64 || a3 >= 116) {
|
||||
return i + 8 <= this.a.h() && (a = a(i, 8)) >= 232 && a < 253;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean i(int i) {
|
||||
if (i + 7 > this.a.h()) {
|
||||
return i + 4 <= this.a.h();
|
||||
}
|
||||
int i2 = i;
|
||||
while (true) {
|
||||
int i3 = i + 3;
|
||||
if (i2 >= i3) {
|
||||
return this.a.a(i3);
|
||||
}
|
||||
if (this.a.a(i2)) {
|
||||
return true;
|
||||
}
|
||||
i2++;
|
||||
}
|
||||
}
|
||||
|
||||
String a(StringBuilder sb, int i) throws NotFoundException, FormatException {
|
||||
String str = null;
|
||||
while (true) {
|
||||
DecodedInformation a = a(i, str);
|
||||
String a2 = FieldParser.a(a.b());
|
||||
if (a2 != null) {
|
||||
sb.append(a2);
|
||||
}
|
||||
String valueOf = a.d() ? String.valueOf(a.c()) : null;
|
||||
if (i == a.a()) {
|
||||
return sb.toString();
|
||||
}
|
||||
i = a.a();
|
||||
str = valueOf;
|
||||
}
|
||||
}
|
||||
|
||||
private BlockParsedResult c() throws FormatException {
|
||||
while (h(this.b.a())) {
|
||||
DecodedChar b = b(this.b.a());
|
||||
this.b.b(b.a());
|
||||
if (b.c()) {
|
||||
return new BlockParsedResult(new DecodedInformation(this.b.a(), this.c.toString()), true);
|
||||
}
|
||||
this.c.append(b.b());
|
||||
}
|
||||
if (d(this.b.a())) {
|
||||
this.b.a(3);
|
||||
this.b.f();
|
||||
} else if (e(this.b.a())) {
|
||||
if (this.b.a() + 5 < this.a.h()) {
|
||||
this.b.a(5);
|
||||
} else {
|
||||
this.b.b(this.a.h());
|
||||
}
|
||||
this.b.d();
|
||||
}
|
||||
return new BlockParsedResult(false);
|
||||
}
|
||||
|
||||
int a(int i, int i2) {
|
||||
return a(this.a, i, i2);
|
||||
}
|
||||
|
||||
static int a(BitArray bitArray, int i, int i2) {
|
||||
int i3 = 0;
|
||||
for (int i4 = 0; i4 < i2; i4++) {
|
||||
if (bitArray.a(i + i4)) {
|
||||
i3 |= 1 << ((i2 - i4) - 1);
|
||||
}
|
||||
}
|
||||
return i3;
|
||||
}
|
||||
|
||||
DecodedInformation a(int i, String str) throws FormatException {
|
||||
this.c.setLength(0);
|
||||
if (str != null) {
|
||||
this.c.append(str);
|
||||
}
|
||||
this.b.b(i);
|
||||
DecodedInformation b = b();
|
||||
if (b != null && b.d()) {
|
||||
return new DecodedInformation(this.b.a(), this.c.toString(), b.c());
|
||||
}
|
||||
return new DecodedInformation(this.b.a(), this.c.toString());
|
||||
}
|
||||
|
||||
private DecodedChar b(int i) throws FormatException {
|
||||
char c;
|
||||
int a = a(i, 5);
|
||||
if (a == 15) {
|
||||
return new DecodedChar(i + 5, '$');
|
||||
}
|
||||
if (a >= 5 && a < 15) {
|
||||
return new DecodedChar(i + 5, (char) ((a + 48) - 5));
|
||||
}
|
||||
int a2 = a(i, 7);
|
||||
if (a2 >= 64 && a2 < 90) {
|
||||
return new DecodedChar(i + 7, (char) (a2 + 1));
|
||||
}
|
||||
if (a2 >= 90 && a2 < 116) {
|
||||
return new DecodedChar(i + 7, (char) (a2 + 7));
|
||||
}
|
||||
switch (a(i, 8)) {
|
||||
case 232:
|
||||
c = '!';
|
||||
break;
|
||||
case 233:
|
||||
c = '\"';
|
||||
break;
|
||||
case 234:
|
||||
c = '%';
|
||||
break;
|
||||
case 235:
|
||||
c = '&';
|
||||
break;
|
||||
case 236:
|
||||
c = '\'';
|
||||
break;
|
||||
case 237:
|
||||
c = '(';
|
||||
break;
|
||||
case 238:
|
||||
c = ')';
|
||||
break;
|
||||
case 239:
|
||||
c = '*';
|
||||
break;
|
||||
case 240:
|
||||
c = '+';
|
||||
break;
|
||||
case 241:
|
||||
c = ',';
|
||||
break;
|
||||
case 242:
|
||||
c = '-';
|
||||
break;
|
||||
case 243:
|
||||
c = '.';
|
||||
break;
|
||||
case 244:
|
||||
c = '/';
|
||||
break;
|
||||
case 245:
|
||||
c = ':';
|
||||
break;
|
||||
case 246:
|
||||
c = ';';
|
||||
break;
|
||||
case 247:
|
||||
c = '<';
|
||||
break;
|
||||
case 248:
|
||||
c = '=';
|
||||
break;
|
||||
case 249:
|
||||
c = '>';
|
||||
break;
|
||||
case ItemTouchHelper.Callback.DEFAULT_SWIPE_ANIMATION_DURATION /* 250 */:
|
||||
c = '?';
|
||||
break;
|
||||
case 251:
|
||||
c = '_';
|
||||
break;
|
||||
case 252:
|
||||
c = ' ';
|
||||
break;
|
||||
default:
|
||||
throw FormatException.getFormatInstance();
|
||||
}
|
||||
return new DecodedChar(i + 8, c);
|
||||
}
|
||||
|
||||
private BlockParsedResult a() {
|
||||
while (g(this.b.a())) {
|
||||
DecodedChar a = a(this.b.a());
|
||||
this.b.b(a.a());
|
||||
if (a.c()) {
|
||||
return new BlockParsedResult(new DecodedInformation(this.b.a(), this.c.toString()), true);
|
||||
}
|
||||
this.c.append(a.b());
|
||||
}
|
||||
if (d(this.b.a())) {
|
||||
this.b.a(3);
|
||||
this.b.f();
|
||||
} else if (e(this.b.a())) {
|
||||
if (this.b.a() + 5 < this.a.h()) {
|
||||
this.b.a(5);
|
||||
} else {
|
||||
this.b.b(this.a.h());
|
||||
}
|
||||
this.b.e();
|
||||
}
|
||||
return new BlockParsedResult(false);
|
||||
}
|
||||
|
||||
private boolean d(int i) {
|
||||
int i2 = i + 3;
|
||||
if (i2 > this.a.h()) {
|
||||
return false;
|
||||
}
|
||||
while (i < i2) {
|
||||
if (this.a.a(i)) {
|
||||
return false;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private DecodedChar a(int i) {
|
||||
char c;
|
||||
int a = a(i, 5);
|
||||
if (a == 15) {
|
||||
return new DecodedChar(i + 5, '$');
|
||||
}
|
||||
if (a >= 5 && a < 15) {
|
||||
return new DecodedChar(i + 5, (char) ((a + 48) - 5));
|
||||
}
|
||||
int a2 = a(i, 6);
|
||||
if (a2 >= 32 && a2 < 58) {
|
||||
return new DecodedChar(i + 6, (char) (a2 + 33));
|
||||
}
|
||||
switch (a2) {
|
||||
case 58:
|
||||
c = '*';
|
||||
break;
|
||||
case 59:
|
||||
c = ',';
|
||||
break;
|
||||
case 60:
|
||||
c = '-';
|
||||
break;
|
||||
case 61:
|
||||
c = '.';
|
||||
break;
|
||||
case 62:
|
||||
c = '/';
|
||||
break;
|
||||
default:
|
||||
throw new IllegalStateException("Decoding invalid alphanumeric value: ".concat(String.valueOf(a2)));
|
||||
}
|
||||
return new DecodedChar(i + 6, c);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user