Initial commit
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
package com.google.zxing.datamatrix.encoder;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class ASCIIEncoder implements Encoder {
|
||||
ASCIIEncoder() {
|
||||
}
|
||||
|
||||
public int a() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.datamatrix.encoder.Encoder
|
||||
public void a(EncoderContext encoderContext) {
|
||||
if (HighLevelEncoder.a(encoderContext.d(), encoderContext.f) >= 2) {
|
||||
encoderContext.a(a(encoderContext.d().charAt(encoderContext.f), encoderContext.d().charAt(encoderContext.f + 1)));
|
||||
encoderContext.f += 2;
|
||||
return;
|
||||
}
|
||||
char c = encoderContext.c();
|
||||
int a = HighLevelEncoder.a(encoderContext.d(), encoderContext.f, a());
|
||||
if (a == a()) {
|
||||
if (!HighLevelEncoder.c(c)) {
|
||||
encoderContext.a((char) (c + 1));
|
||||
encoderContext.f++;
|
||||
return;
|
||||
} else {
|
||||
encoderContext.a((char) 235);
|
||||
encoderContext.a((char) ((c - 128) + 1));
|
||||
encoderContext.f++;
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (a == 1) {
|
||||
encoderContext.a((char) 230);
|
||||
encoderContext.b(1);
|
||||
return;
|
||||
}
|
||||
if (a == 2) {
|
||||
encoderContext.a((char) 239);
|
||||
encoderContext.b(2);
|
||||
return;
|
||||
}
|
||||
if (a == 3) {
|
||||
encoderContext.a((char) 238);
|
||||
encoderContext.b(3);
|
||||
} else if (a == 4) {
|
||||
encoderContext.a((char) 240);
|
||||
encoderContext.b(4);
|
||||
} else {
|
||||
if (a != 5) {
|
||||
throw new IllegalStateException("Illegal mode: ".concat(String.valueOf(a)));
|
||||
}
|
||||
encoderContext.a((char) 231);
|
||||
encoderContext.b(5);
|
||||
}
|
||||
}
|
||||
|
||||
private static char a(char c, char c2) {
|
||||
if (HighLevelEncoder.b(c) && HighLevelEncoder.b(c2)) {
|
||||
return (char) (((c - '0') * 10) + (c2 - '0') + 130);
|
||||
}
|
||||
throw new IllegalArgumentException("not digits: " + c + c2);
|
||||
}
|
||||
}
|
@@ -0,0 +1,54 @@
|
||||
package com.google.zxing.datamatrix.encoder;
|
||||
|
||||
import androidx.recyclerview.widget.ItemTouchHelper;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class Base256Encoder implements Encoder {
|
||||
Base256Encoder() {
|
||||
}
|
||||
|
||||
public int a() {
|
||||
return 5;
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.datamatrix.encoder.Encoder
|
||||
public void a(EncoderContext encoderContext) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append((char) 0);
|
||||
while (true) {
|
||||
if (!encoderContext.h()) {
|
||||
break;
|
||||
}
|
||||
sb.append(encoderContext.c());
|
||||
encoderContext.f++;
|
||||
if (HighLevelEncoder.a(encoderContext.d(), encoderContext.f, a()) != a()) {
|
||||
encoderContext.b(0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
int length = sb.length() - 1;
|
||||
int a = encoderContext.a() + length + 1;
|
||||
encoderContext.c(a);
|
||||
boolean z = encoderContext.g().a() - a > 0;
|
||||
if (encoderContext.h() || z) {
|
||||
if (length <= 249) {
|
||||
sb.setCharAt(0, (char) length);
|
||||
} else {
|
||||
if (length > 1555) {
|
||||
throw new IllegalStateException("Message length not in valid ranges: ".concat(String.valueOf(length)));
|
||||
}
|
||||
sb.setCharAt(0, (char) ((length / ItemTouchHelper.Callback.DEFAULT_SWIPE_ANIMATION_DURATION) + 249));
|
||||
sb.insert(1, (char) (length % ItemTouchHelper.Callback.DEFAULT_SWIPE_ANIMATION_DURATION));
|
||||
}
|
||||
}
|
||||
int length2 = sb.length();
|
||||
for (int i = 0; i < length2; i++) {
|
||||
encoderContext.a(a(sb.charAt(i), encoderContext.a() + 1));
|
||||
}
|
||||
}
|
||||
|
||||
private static char a(char c, int i) {
|
||||
int i2 = c + ((i * 149) % 255) + 1;
|
||||
return i2 <= 255 ? (char) i2 : (char) (i2 - 256);
|
||||
}
|
||||
}
|
138
sources/com/google/zxing/datamatrix/encoder/C40Encoder.java
Normal file
138
sources/com/google/zxing/datamatrix/encoder/C40Encoder.java
Normal file
@@ -0,0 +1,138 @@
|
||||
package com.google.zxing.datamatrix.encoder;
|
||||
|
||||
import com.ijm.dataencryption.de.DataDecryptTool;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class C40Encoder implements Encoder {
|
||||
C40Encoder() {
|
||||
}
|
||||
|
||||
static void b(EncoderContext encoderContext, StringBuilder sb) {
|
||||
encoderContext.a(a(sb, 0));
|
||||
sb.delete(0, 3);
|
||||
}
|
||||
|
||||
public int a() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.datamatrix.encoder.Encoder
|
||||
public void a(EncoderContext encoderContext) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
while (true) {
|
||||
if (!encoderContext.h()) {
|
||||
break;
|
||||
}
|
||||
char c = encoderContext.c();
|
||||
encoderContext.f++;
|
||||
int a = a(c, sb);
|
||||
int a2 = encoderContext.a() + ((sb.length() / 3) << 1);
|
||||
encoderContext.c(a2);
|
||||
int a3 = encoderContext.g().a() - a2;
|
||||
if (!encoderContext.h()) {
|
||||
StringBuilder sb2 = new StringBuilder();
|
||||
if (sb.length() % 3 == 2 && (a3 < 2 || a3 > 2)) {
|
||||
a = a(encoderContext, sb, sb2, a);
|
||||
}
|
||||
while (sb.length() % 3 == 1 && ((a <= 3 && a3 != 1) || a > 3)) {
|
||||
a = a(encoderContext, sb, sb2, a);
|
||||
}
|
||||
} else if (sb.length() % 3 == 0 && HighLevelEncoder.a(encoderContext.d(), encoderContext.f, a()) != a()) {
|
||||
encoderContext.b(0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
a(encoderContext, sb);
|
||||
}
|
||||
|
||||
private int a(EncoderContext encoderContext, StringBuilder sb, StringBuilder sb2, int i) {
|
||||
int length = sb.length();
|
||||
sb.delete(length - i, length);
|
||||
encoderContext.f--;
|
||||
int a = a(encoderContext.c(), sb2);
|
||||
encoderContext.j();
|
||||
return a;
|
||||
}
|
||||
|
||||
void a(EncoderContext encoderContext, StringBuilder sb) {
|
||||
int length = (sb.length() / 3) << 1;
|
||||
int length2 = sb.length() % 3;
|
||||
int a = encoderContext.a() + length;
|
||||
encoderContext.c(a);
|
||||
int a2 = encoderContext.g().a() - a;
|
||||
if (length2 == 2) {
|
||||
sb.append((char) 0);
|
||||
while (sb.length() >= 3) {
|
||||
b(encoderContext, sb);
|
||||
}
|
||||
if (encoderContext.h()) {
|
||||
encoderContext.a((char) 254);
|
||||
}
|
||||
} else if (a2 == 1 && length2 == 1) {
|
||||
while (sb.length() >= 3) {
|
||||
b(encoderContext, sb);
|
||||
}
|
||||
if (encoderContext.h()) {
|
||||
encoderContext.a((char) 254);
|
||||
}
|
||||
encoderContext.f--;
|
||||
} else if (length2 == 0) {
|
||||
while (sb.length() >= 3) {
|
||||
b(encoderContext, sb);
|
||||
}
|
||||
if (a2 > 0 || encoderContext.h()) {
|
||||
encoderContext.a((char) 254);
|
||||
}
|
||||
} else {
|
||||
throw new IllegalStateException("Unexpected case. Please report!");
|
||||
}
|
||||
encoderContext.b(0);
|
||||
}
|
||||
|
||||
int a(char c, StringBuilder sb) {
|
||||
if (c == ' ') {
|
||||
sb.append((char) 3);
|
||||
return 1;
|
||||
}
|
||||
if (c >= '0' && c <= '9') {
|
||||
sb.append((char) ((c - '0') + 4));
|
||||
return 1;
|
||||
}
|
||||
if (c >= 'A' && c <= 'Z') {
|
||||
sb.append((char) ((c - 'A') + 14));
|
||||
return 1;
|
||||
}
|
||||
if (c < ' ') {
|
||||
sb.append((char) 0);
|
||||
sb.append(c);
|
||||
return 2;
|
||||
}
|
||||
if (c >= '!' && c <= '/') {
|
||||
sb.append((char) 1);
|
||||
sb.append((char) (c - '!'));
|
||||
return 2;
|
||||
}
|
||||
if (c >= ':' && c <= '@') {
|
||||
sb.append((char) 1);
|
||||
sb.append((char) ((c - ':') + 15));
|
||||
return 2;
|
||||
}
|
||||
if (c >= '[' && c <= '_') {
|
||||
sb.append((char) 1);
|
||||
sb.append((char) ((c - '[') + 22));
|
||||
return 2;
|
||||
}
|
||||
if (c >= '`' && c <= 127) {
|
||||
sb.append((char) 2);
|
||||
sb.append((char) (c - '`'));
|
||||
return 2;
|
||||
}
|
||||
sb.append("\u0001\u001e");
|
||||
return a((char) (c - 128), sb) + 2;
|
||||
}
|
||||
|
||||
private static String a(CharSequence charSequence, int i) {
|
||||
int charAt = (charSequence.charAt(i) * 1600) + (charSequence.charAt(i + 1) * '(') + charSequence.charAt(i + 2) + 1;
|
||||
return new String(new char[]{(char) (charAt / DataDecryptTool.DECRYPT_ALL_FILE), (char) (charAt % DataDecryptTool.DECRYPT_ALL_FILE)});
|
||||
}
|
||||
}
|
@@ -0,0 +1,18 @@
|
||||
package com.google.zxing.datamatrix.encoder;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class DataMatrixSymbolInfo144 extends SymbolInfo {
|
||||
DataMatrixSymbolInfo144() {
|
||||
super(false, 1558, 620, 22, 22, 36, -1, 62);
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.datamatrix.encoder.SymbolInfo
|
||||
public int a(int i) {
|
||||
return i <= 8 ? 156 : 155;
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.datamatrix.encoder.SymbolInfo
|
||||
public int c() {
|
||||
return 10;
|
||||
}
|
||||
}
|
@@ -0,0 +1,165 @@
|
||||
package com.google.zxing.datamatrix.encoder;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class DefaultPlacement {
|
||||
private final CharSequence a;
|
||||
private final int b;
|
||||
private final int c;
|
||||
private final byte[] d;
|
||||
|
||||
public DefaultPlacement(CharSequence charSequence, int i, int i2) {
|
||||
this.a = charSequence;
|
||||
this.c = i;
|
||||
this.b = i2;
|
||||
this.d = new byte[i * i2];
|
||||
Arrays.fill(this.d, (byte) -1);
|
||||
}
|
||||
|
||||
private boolean b(int i, int i2) {
|
||||
return this.d[(i2 * this.c) + i] >= 0;
|
||||
}
|
||||
|
||||
private void c(int i) {
|
||||
a(this.b - 3, 0, i, 1);
|
||||
a(this.b - 2, 0, i, 2);
|
||||
a(this.b - 1, 0, i, 3);
|
||||
a(0, this.c - 2, i, 4);
|
||||
a(0, this.c - 1, i, 5);
|
||||
a(1, this.c - 1, i, 6);
|
||||
a(2, this.c - 1, i, 7);
|
||||
a(3, this.c - 1, i, 8);
|
||||
}
|
||||
|
||||
private void d(int i) {
|
||||
a(this.b - 1, 0, i, 1);
|
||||
a(this.b - 1, this.c - 1, i, 2);
|
||||
a(0, this.c - 3, i, 3);
|
||||
a(0, this.c - 2, i, 4);
|
||||
a(0, this.c - 1, i, 5);
|
||||
a(1, this.c - 3, i, 6);
|
||||
a(1, this.c - 2, i, 7);
|
||||
a(1, this.c - 1, i, 8);
|
||||
}
|
||||
|
||||
public final boolean a(int i, int i2) {
|
||||
return this.d[(i2 * this.c) + i] == 1;
|
||||
}
|
||||
|
||||
private void a(int i, int i2, boolean z) {
|
||||
this.d[(i2 * this.c) + i] = z ? (byte) 1 : (byte) 0;
|
||||
}
|
||||
|
||||
private void b(int i) {
|
||||
a(this.b - 3, 0, i, 1);
|
||||
a(this.b - 2, 0, i, 2);
|
||||
a(this.b - 1, 0, i, 3);
|
||||
a(0, this.c - 4, i, 4);
|
||||
a(0, this.c - 3, i, 5);
|
||||
a(0, this.c - 2, i, 6);
|
||||
a(0, this.c - 1, i, 7);
|
||||
a(1, this.c - 1, i, 8);
|
||||
}
|
||||
|
||||
public final void a() {
|
||||
int i;
|
||||
int i2;
|
||||
int i3 = 4;
|
||||
int i4 = 0;
|
||||
int i5 = 0;
|
||||
while (true) {
|
||||
if (i3 == this.b && i4 == 0) {
|
||||
a(i5);
|
||||
i5++;
|
||||
}
|
||||
if (i3 == this.b - 2 && i4 == 0 && this.c % 4 != 0) {
|
||||
b(i5);
|
||||
i5++;
|
||||
}
|
||||
if (i3 == this.b - 2 && i4 == 0 && this.c % 8 == 4) {
|
||||
c(i5);
|
||||
i5++;
|
||||
}
|
||||
if (i3 == this.b + 4 && i4 == 2 && this.c % 8 == 0) {
|
||||
d(i5);
|
||||
i5++;
|
||||
}
|
||||
do {
|
||||
if (i3 < this.b && i4 >= 0 && !b(i4, i3)) {
|
||||
a(i3, i4, i5);
|
||||
i5++;
|
||||
}
|
||||
i3 -= 2;
|
||||
i4 += 2;
|
||||
if (i3 < 0) {
|
||||
break;
|
||||
}
|
||||
} while (i4 < this.c);
|
||||
int i6 = i3 + 1;
|
||||
int i7 = i4 + 3;
|
||||
do {
|
||||
if (i6 >= 0 && i7 < this.c && !b(i7, i6)) {
|
||||
a(i6, i7, i5);
|
||||
i5++;
|
||||
}
|
||||
i6 += 2;
|
||||
i7 -= 2;
|
||||
if (i6 >= this.b) {
|
||||
break;
|
||||
}
|
||||
} while (i7 >= 0);
|
||||
i3 = i6 + 3;
|
||||
i4 = i7 + 1;
|
||||
i = this.b;
|
||||
if (i3 >= i && i4 >= (i2 = this.c)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (b(i2 - 1, i - 1)) {
|
||||
return;
|
||||
}
|
||||
a(this.c - 1, this.b - 1, true);
|
||||
a(this.c - 2, this.b - 2, true);
|
||||
}
|
||||
|
||||
private void a(int i, int i2, int i3, int i4) {
|
||||
if (i < 0) {
|
||||
int i5 = this.b;
|
||||
i += i5;
|
||||
i2 += 4 - ((i5 + 4) % 8);
|
||||
}
|
||||
if (i2 < 0) {
|
||||
int i6 = this.c;
|
||||
i2 += i6;
|
||||
i += 4 - ((i6 + 4) % 8);
|
||||
}
|
||||
a(i2, i, (this.a.charAt(i3) & (1 << (8 - i4))) != 0);
|
||||
}
|
||||
|
||||
private void a(int i, int i2, int i3) {
|
||||
int i4 = i - 2;
|
||||
int i5 = i2 - 2;
|
||||
a(i4, i5, i3, 1);
|
||||
int i6 = i2 - 1;
|
||||
a(i4, i6, i3, 2);
|
||||
int i7 = i - 1;
|
||||
a(i7, i5, i3, 3);
|
||||
a(i7, i6, i3, 4);
|
||||
a(i7, i2, i3, 5);
|
||||
a(i, i5, i3, 6);
|
||||
a(i, i6, i3, 7);
|
||||
a(i, i2, i3, 8);
|
||||
}
|
||||
|
||||
private void a(int i) {
|
||||
a(this.b - 1, 0, i, 1);
|
||||
a(this.b - 1, 1, i, 2);
|
||||
a(this.b - 1, 2, i, 3);
|
||||
a(0, this.c - 2, i, 4);
|
||||
a(0, this.c - 1, i, 5);
|
||||
a(1, this.c - 1, i, 6);
|
||||
a(2, this.c - 1, i, 7);
|
||||
a(3, this.c - 1, i, 8);
|
||||
}
|
||||
}
|
110
sources/com/google/zxing/datamatrix/encoder/EdifactEncoder.java
Normal file
110
sources/com/google/zxing/datamatrix/encoder/EdifactEncoder.java
Normal file
@@ -0,0 +1,110 @@
|
||||
package com.google.zxing.datamatrix.encoder;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class EdifactEncoder implements Encoder {
|
||||
EdifactEncoder() {
|
||||
}
|
||||
|
||||
public int a() {
|
||||
return 4;
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.datamatrix.encoder.Encoder
|
||||
public void a(EncoderContext encoderContext) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
while (true) {
|
||||
if (!encoderContext.h()) {
|
||||
break;
|
||||
}
|
||||
a(encoderContext.c(), sb);
|
||||
encoderContext.f++;
|
||||
if (sb.length() >= 4) {
|
||||
encoderContext.a(a(sb, 0));
|
||||
sb.delete(0, 4);
|
||||
if (HighLevelEncoder.a(encoderContext.d(), encoderContext.f, a()) != a()) {
|
||||
encoderContext.b(0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
sb.append((char) 31);
|
||||
a(encoderContext, sb);
|
||||
}
|
||||
|
||||
private static void a(EncoderContext encoderContext, CharSequence charSequence) {
|
||||
try {
|
||||
int length = charSequence.length();
|
||||
if (length == 0) {
|
||||
return;
|
||||
}
|
||||
boolean z = true;
|
||||
if (length == 1) {
|
||||
encoderContext.k();
|
||||
int a = encoderContext.g().a() - encoderContext.a();
|
||||
int f = encoderContext.f();
|
||||
if (f > a) {
|
||||
encoderContext.c(encoderContext.a() + 1);
|
||||
a = encoderContext.g().a() - encoderContext.a();
|
||||
}
|
||||
if (f <= a && a <= 2) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (length <= 4) {
|
||||
int i = length - 1;
|
||||
String a2 = a(charSequence, 0);
|
||||
if (!(!encoderContext.h()) || i > 2) {
|
||||
z = false;
|
||||
}
|
||||
if (i <= 2) {
|
||||
encoderContext.c(encoderContext.a() + i);
|
||||
if (encoderContext.g().a() - encoderContext.a() >= 3) {
|
||||
encoderContext.c(encoderContext.a() + a2.length());
|
||||
z = false;
|
||||
}
|
||||
}
|
||||
if (z) {
|
||||
encoderContext.j();
|
||||
encoderContext.f -= i;
|
||||
} else {
|
||||
encoderContext.a(a2);
|
||||
}
|
||||
return;
|
||||
}
|
||||
throw new IllegalStateException("Count must not exceed 4");
|
||||
} finally {
|
||||
encoderContext.b(0);
|
||||
}
|
||||
}
|
||||
|
||||
private static void a(char c, StringBuilder sb) {
|
||||
if (c >= ' ' && c <= '?') {
|
||||
sb.append(c);
|
||||
} else if (c >= '@' && c <= '^') {
|
||||
sb.append((char) (c - '@'));
|
||||
} else {
|
||||
HighLevelEncoder.a(c);
|
||||
throw null;
|
||||
}
|
||||
}
|
||||
|
||||
private static String a(CharSequence charSequence, int i) {
|
||||
int length = charSequence.length() - i;
|
||||
if (length != 0) {
|
||||
int charAt = (charSequence.charAt(i) << 18) + ((length >= 2 ? charSequence.charAt(i + 1) : (char) 0) << '\f') + ((length >= 3 ? charSequence.charAt(i + 2) : (char) 0) << 6) + (length >= 4 ? charSequence.charAt(i + 3) : (char) 0);
|
||||
char c = (char) ((charAt >> 16) & 255);
|
||||
char c2 = (char) ((charAt >> 8) & 255);
|
||||
char c3 = (char) (charAt & 255);
|
||||
StringBuilder sb = new StringBuilder(3);
|
||||
sb.append(c);
|
||||
if (length >= 2) {
|
||||
sb.append(c2);
|
||||
}
|
||||
if (length >= 3) {
|
||||
sb.append(c3);
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
throw new IllegalStateException("StringBuilder must not be empty");
|
||||
}
|
||||
}
|
6
sources/com/google/zxing/datamatrix/encoder/Encoder.java
Normal file
6
sources/com/google/zxing/datamatrix/encoder/Encoder.java
Normal file
@@ -0,0 +1,6 @@
|
||||
package com.google.zxing.datamatrix.encoder;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
interface Encoder {
|
||||
void a(EncoderContext encoderContext);
|
||||
}
|
114
sources/com/google/zxing/datamatrix/encoder/EncoderContext.java
Normal file
114
sources/com/google/zxing/datamatrix/encoder/EncoderContext.java
Normal file
@@ -0,0 +1,114 @@
|
||||
package com.google.zxing.datamatrix.encoder;
|
||||
|
||||
import com.google.zxing.Dimension;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class EncoderContext {
|
||||
private final String a;
|
||||
private SymbolShapeHint b;
|
||||
private Dimension c;
|
||||
private Dimension d;
|
||||
private final StringBuilder e;
|
||||
int f;
|
||||
private int g;
|
||||
private SymbolInfo h;
|
||||
private int i;
|
||||
|
||||
EncoderContext(String str) {
|
||||
byte[] bytes = str.getBytes(StandardCharsets.ISO_8859_1);
|
||||
StringBuilder sb = new StringBuilder(bytes.length);
|
||||
int length = bytes.length;
|
||||
for (int i = 0; i < length; i++) {
|
||||
char c = (char) (bytes[i] & 255);
|
||||
if (c == '?' && str.charAt(i) != '?') {
|
||||
throw new IllegalArgumentException("Message contains characters outside ISO-8859-1 encoding.");
|
||||
}
|
||||
sb.append(c);
|
||||
}
|
||||
this.a = sb.toString();
|
||||
this.b = SymbolShapeHint.FORCE_NONE;
|
||||
this.e = new StringBuilder(str.length());
|
||||
this.g = -1;
|
||||
}
|
||||
|
||||
private int l() {
|
||||
return this.a.length() - this.i;
|
||||
}
|
||||
|
||||
public void a(SymbolShapeHint symbolShapeHint) {
|
||||
this.b = symbolShapeHint;
|
||||
}
|
||||
|
||||
public StringBuilder b() {
|
||||
return this.e;
|
||||
}
|
||||
|
||||
public char c() {
|
||||
return this.a.charAt(this.f);
|
||||
}
|
||||
|
||||
public String d() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
public int e() {
|
||||
return this.g;
|
||||
}
|
||||
|
||||
public int f() {
|
||||
return l() - this.f;
|
||||
}
|
||||
|
||||
public SymbolInfo g() {
|
||||
return this.h;
|
||||
}
|
||||
|
||||
public boolean h() {
|
||||
return this.f < l();
|
||||
}
|
||||
|
||||
public void i() {
|
||||
this.g = -1;
|
||||
}
|
||||
|
||||
public void j() {
|
||||
this.h = null;
|
||||
}
|
||||
|
||||
public void k() {
|
||||
c(a());
|
||||
}
|
||||
|
||||
public void a(Dimension dimension, Dimension dimension2) {
|
||||
this.c = dimension;
|
||||
this.d = dimension2;
|
||||
}
|
||||
|
||||
public void b(int i) {
|
||||
this.g = i;
|
||||
}
|
||||
|
||||
public void c(int i) {
|
||||
SymbolInfo symbolInfo = this.h;
|
||||
if (symbolInfo == null || i > symbolInfo.a()) {
|
||||
this.h = SymbolInfo.a(i, this.b, this.c, this.d, true);
|
||||
}
|
||||
}
|
||||
|
||||
public void a(int i) {
|
||||
this.i = i;
|
||||
}
|
||||
|
||||
public void a(String str) {
|
||||
this.e.append(str);
|
||||
}
|
||||
|
||||
public void a(char c) {
|
||||
this.e.append(c);
|
||||
}
|
||||
|
||||
public int a() {
|
||||
return this.e.length();
|
||||
}
|
||||
}
|
123
sources/com/google/zxing/datamatrix/encoder/ErrorCorrection.java
Normal file
123
sources/com/google/zxing/datamatrix/encoder/ErrorCorrection.java
Normal file
@@ -0,0 +1,123 @@
|
||||
package com.google.zxing.datamatrix.encoder;
|
||||
|
||||
import androidx.recyclerview.widget.ItemTouchHelper;
|
||||
import com.ijm.dataencryption.de.DataDecryptTool;
|
||||
import com.ubt.jimu.base.entities.Constant;
|
||||
import com.ubt.jimu.diy.model.DiyPreviewStep;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class ErrorCorrection {
|
||||
private static final int[] a = {5, 7, 10, 11, 12, 14, 18, 20, 24, 28, 36, 42, 48, 56, 62, 68};
|
||||
private static final int[][] b = {new int[]{228, 48, 15, 111, 62}, new int[]{23, 68, 144, 134, 240, 92, 254}, new int[]{28, 24, 185, 166, 223, 248, 116, 255, 110, 61}, new int[]{175, 138, 205, 12, 194, 168, 39, 245, 60, 97, 120}, new int[]{41, 153, 158, 91, 61, 42, 142, 213, 97, 178, 100, 242}, new int[]{156, 97, 192, 252, 95, 9, 157, 119, 138, 45, 18, 186, 83, 185}, new int[]{83, 195, 100, 39, 188, 75, 66, 61, 241, 213, 109, 129, 94, 254, 225, 48, 90, 188}, new int[]{15, 195, 244, 9, 233, 71, 168, 2, 188, 160, 153, 145, 253, 79, 108, 82, 27, 174, 186, 172}, new int[]{52, 190, 88, 205, 109, 39, 176, 21, 155, 197, 251, 223, 155, 21, 5, 172, 254, 124, 12, 181, 184, 96, 50, 193}, new int[]{211, 231, 43, 97, 71, 96, 103, 174, 37, 151, 170, 53, 75, 34, 249, 121, 17, 138, 110, 213, 141, 136, 120, 151, 233, 168, 93, 255}, new int[]{245, 127, 242, 218, 130, ItemTouchHelper.Callback.DEFAULT_SWIPE_ANIMATION_DURATION, 162, 181, 102, 120, 84, 179, 220, 251, 80, 182, 229, 18, 2, 4, 68, 33, 101, 137, 95, 119, 115, 44, 175, 184, 59, 25, 225, 98, 81, 112}, new int[]{77, 193, 137, 31, 19, 38, 22, 153, 247, 105, 122, 2, 245, 133, 242, 8, 175, 95, 100, 9, 167, 105, 214, 111, 57, 121, 21, 1, 253, 57, 54, 101, 248, Constant.Publish.REQUEST_CODE_PICK_FILE, 69, 50, 150, 177, 226, 5, 9, 5}, new int[]{245, 132, 172, 223, 96, 32, 117, 22, 238, 133, 238, 231, 205, 188, 237, 87, 191, 106, 16, 147, 118, 23, 37, 90, 170, 205, 131, 88, 120, 100, 66, 138, 186, 240, 82, 44, 176, 87, 187, 147, 160, 175, 69, 213, 92, 253, 225, 19}, new int[]{175, 9, 223, 238, 12, 17, 220, 208, 100, 29, 175, 170, 230, 192, 215, 235, 150, 159, 36, 223, 38, 200, 132, 54, 228, 146, 218, 234, 117, 203, 29, 232, 144, 238, 22, 150, 201, 117, 62, 207, 164, 13, 137, 245, 127, 67, 247, 28, 155, 43, 203, 107, 233, 53, 143, 46}, new int[]{242, 93, 169, 50, 144, 210, 39, 118, Constant.Publish.REQUEST_CODE_PICK_FILE, 188, 201, 189, 143, 108, 196, 37, 185, 112, 134, 230, 245, 63, 197, 190, ItemTouchHelper.Callback.DEFAULT_SWIPE_ANIMATION_DURATION, 106, 185, 221, 175, 64, 114, 71, 161, 44, 147, 6, 27, 218, 51, 63, 87, 10, 40, 130, 188, 17, 163, 31, 176, 170, 4, 107, 232, 7, 94, 166, 224, 124, 86, 47, 11, 204}, new int[]{220, 228, 173, 89, 251, 149, 159, 56, 89, 33, 147, 244, 154, 36, 73, 127, 213, 136, 248, 180, 234, 197, 158, 177, 68, 122, 93, 213, 15, 160, 227, 236, 66, 139, 153, 185, Constant.Publish.REQUEST_CODE_PICK_FILE, 167, 179, 25, 220, 232, 96, 210, 231, 136, 223, 239, 181, 241, 59, 52, 172, 25, 49, 232, 211, 189, 64, 54, 108, 153, 132, 63, 96, 103, 82, 186}};
|
||||
private static final int[] c = new int[DataDecryptTool.DECRYPT_ALL_FILE];
|
||||
private static final int[] d = new int[255];
|
||||
|
||||
static {
|
||||
int i = 1;
|
||||
for (int i2 = 0; i2 < 255; i2++) {
|
||||
d[i2] = i;
|
||||
c[i] = i2;
|
||||
i <<= 1;
|
||||
if (i >= 256) {
|
||||
i ^= DiyPreviewStep.TYPE_PROGRAM;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static String a(String str, SymbolInfo symbolInfo) {
|
||||
if (str.length() != symbolInfo.a()) {
|
||||
throw new IllegalArgumentException("The number of codewords does not match the selected symbol");
|
||||
}
|
||||
StringBuilder sb = new StringBuilder(symbolInfo.a() + symbolInfo.b());
|
||||
sb.append(str);
|
||||
int c2 = symbolInfo.c();
|
||||
if (c2 == 1) {
|
||||
sb.append(a(str, symbolInfo.b()));
|
||||
} else {
|
||||
sb.setLength(sb.capacity());
|
||||
int[] iArr = new int[c2];
|
||||
int[] iArr2 = new int[c2];
|
||||
int[] iArr3 = new int[c2];
|
||||
int i = 0;
|
||||
while (i < c2) {
|
||||
int i2 = i + 1;
|
||||
iArr[i] = symbolInfo.a(i2);
|
||||
iArr2[i] = symbolInfo.b(i2);
|
||||
iArr3[i] = 0;
|
||||
if (i > 0) {
|
||||
iArr3[i] = iArr3[i - 1] + iArr[i];
|
||||
}
|
||||
i = i2;
|
||||
}
|
||||
for (int i3 = 0; i3 < c2; i3++) {
|
||||
StringBuilder sb2 = new StringBuilder(iArr[i3]);
|
||||
for (int i4 = i3; i4 < symbolInfo.a(); i4 += c2) {
|
||||
sb2.append(str.charAt(i4));
|
||||
}
|
||||
String a2 = a(sb2.toString(), iArr2[i3]);
|
||||
int i5 = i3;
|
||||
int i6 = 0;
|
||||
while (i5 < iArr2[i3] * c2) {
|
||||
sb.setCharAt(symbolInfo.a() + i5, a2.charAt(i6));
|
||||
i5 += c2;
|
||||
i6++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private static String a(CharSequence charSequence, int i) {
|
||||
return a(charSequence, 0, charSequence.length(), i);
|
||||
}
|
||||
|
||||
private static String a(CharSequence charSequence, int i, int i2, int i3) {
|
||||
int i4 = 0;
|
||||
while (true) {
|
||||
int[] iArr = a;
|
||||
if (i4 >= iArr.length) {
|
||||
i4 = -1;
|
||||
break;
|
||||
}
|
||||
if (iArr[i4] == i3) {
|
||||
break;
|
||||
}
|
||||
i4++;
|
||||
}
|
||||
if (i4 >= 0) {
|
||||
int[] iArr2 = b[i4];
|
||||
char[] cArr = new char[i3];
|
||||
for (int i5 = 0; i5 < i3; i5++) {
|
||||
cArr[i5] = 0;
|
||||
}
|
||||
for (int i6 = i; i6 < i + i2; i6++) {
|
||||
int i7 = i3 - 1;
|
||||
int charAt = cArr[i7] ^ charSequence.charAt(i6);
|
||||
while (i7 > 0) {
|
||||
if (charAt != 0 && iArr2[i7] != 0) {
|
||||
char c2 = cArr[i7 - 1];
|
||||
int[] iArr3 = d;
|
||||
int[] iArr4 = c;
|
||||
cArr[i7] = (char) (c2 ^ iArr3[(iArr4[charAt] + iArr4[iArr2[i7]]) % 255]);
|
||||
} else {
|
||||
cArr[i7] = cArr[i7 - 1];
|
||||
}
|
||||
i7--;
|
||||
}
|
||||
if (charAt != 0 && iArr2[0] != 0) {
|
||||
int[] iArr5 = d;
|
||||
int[] iArr6 = c;
|
||||
cArr[0] = (char) iArr5[(iArr6[charAt] + iArr6[iArr2[0]]) % 255];
|
||||
} else {
|
||||
cArr[0] = 0;
|
||||
}
|
||||
}
|
||||
char[] cArr2 = new char[i3];
|
||||
for (int i8 = 0; i8 < i3; i8++) {
|
||||
cArr2[i8] = cArr[(i3 - i8) - 1];
|
||||
}
|
||||
return String.valueOf(cArr2);
|
||||
}
|
||||
throw new IllegalArgumentException("Illegal number of error correction codewords specified: ".concat(String.valueOf(i3)));
|
||||
}
|
||||
}
|
@@ -0,0 +1,270 @@
|
||||
package com.google.zxing.datamatrix.encoder;
|
||||
|
||||
import com.google.zxing.Dimension;
|
||||
import java.util.Arrays;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class HighLevelEncoder {
|
||||
private static char a(char c, int i) {
|
||||
int i2 = c + ((i * 149) % 253) + 1;
|
||||
if (i2 > 254) {
|
||||
i2 -= 254;
|
||||
}
|
||||
return (char) i2;
|
||||
}
|
||||
|
||||
static boolean b(char c) {
|
||||
return c >= '0' && c <= '9';
|
||||
}
|
||||
|
||||
static boolean c(char c) {
|
||||
return c >= 128 && c <= 255;
|
||||
}
|
||||
|
||||
private static boolean d(char c) {
|
||||
if (c == ' ') {
|
||||
return true;
|
||||
}
|
||||
if (c < '0' || c > '9') {
|
||||
return c >= 'A' && c <= 'Z';
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private static boolean e(char c) {
|
||||
return c >= ' ' && c <= '^';
|
||||
}
|
||||
|
||||
private static boolean f(char c) {
|
||||
if (c == ' ') {
|
||||
return true;
|
||||
}
|
||||
if (c < '0' || c > '9') {
|
||||
return c >= 'a' && c <= 'z';
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private static boolean g(char c) {
|
||||
if (i(c) || c == ' ') {
|
||||
return true;
|
||||
}
|
||||
if (c < '0' || c > '9') {
|
||||
return c >= 'A' && c <= 'Z';
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private static boolean h(char c) {
|
||||
return false;
|
||||
}
|
||||
|
||||
private static boolean i(char c) {
|
||||
return c == '\r' || c == '*' || c == '>';
|
||||
}
|
||||
|
||||
public static String a(String str, SymbolShapeHint symbolShapeHint, Dimension dimension, Dimension dimension2) {
|
||||
int i = 0;
|
||||
Encoder[] encoderArr = {new ASCIIEncoder(), new C40Encoder(), new TextEncoder(), new X12Encoder(), new EdifactEncoder(), new Base256Encoder()};
|
||||
EncoderContext encoderContext = new EncoderContext(str);
|
||||
encoderContext.a(symbolShapeHint);
|
||||
encoderContext.a(dimension, dimension2);
|
||||
if (str.startsWith("[)>\u001e05\u001d") && str.endsWith("\u001e\u0004")) {
|
||||
encoderContext.a((char) 236);
|
||||
encoderContext.a(2);
|
||||
encoderContext.f += 7;
|
||||
} else if (str.startsWith("[)>\u001e06\u001d") && str.endsWith("\u001e\u0004")) {
|
||||
encoderContext.a((char) 237);
|
||||
encoderContext.a(2);
|
||||
encoderContext.f += 7;
|
||||
}
|
||||
while (encoderContext.h()) {
|
||||
encoderArr[i].a(encoderContext);
|
||||
if (encoderContext.e() >= 0) {
|
||||
i = encoderContext.e();
|
||||
encoderContext.i();
|
||||
}
|
||||
}
|
||||
int a = encoderContext.a();
|
||||
encoderContext.k();
|
||||
int a2 = encoderContext.g().a();
|
||||
if (a < a2 && i != 0 && i != 5 && i != 4) {
|
||||
encoderContext.a((char) 254);
|
||||
}
|
||||
StringBuilder b = encoderContext.b();
|
||||
if (b.length() < a2) {
|
||||
b.append((char) 129);
|
||||
}
|
||||
while (b.length() < a2) {
|
||||
b.append(a((char) 129, b.length() + 1));
|
||||
}
|
||||
return encoderContext.b().toString();
|
||||
}
|
||||
|
||||
static int a(CharSequence charSequence, int i, int i2) {
|
||||
float[] fArr;
|
||||
char c;
|
||||
if (i >= charSequence.length()) {
|
||||
return i2;
|
||||
}
|
||||
if (i2 == 0) {
|
||||
fArr = new float[]{0.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.25f};
|
||||
} else {
|
||||
fArr = new float[]{1.0f, 2.0f, 2.0f, 2.0f, 2.0f, 2.25f};
|
||||
fArr[i2] = 0.0f;
|
||||
}
|
||||
int i3 = 0;
|
||||
while (true) {
|
||||
int i4 = i + i3;
|
||||
if (i4 == charSequence.length()) {
|
||||
byte[] bArr = new byte[6];
|
||||
int[] iArr = new int[6];
|
||||
int a = a(fArr, iArr, Integer.MAX_VALUE, bArr);
|
||||
int a2 = a(bArr);
|
||||
if (iArr[0] == a) {
|
||||
return 0;
|
||||
}
|
||||
if (a2 == 1 && bArr[5] > 0) {
|
||||
return 5;
|
||||
}
|
||||
if (a2 == 1 && bArr[4] > 0) {
|
||||
return 4;
|
||||
}
|
||||
if (a2 != 1 || bArr[2] <= 0) {
|
||||
return (a2 != 1 || bArr[3] <= 0) ? 1 : 3;
|
||||
}
|
||||
return 2;
|
||||
}
|
||||
char charAt = charSequence.charAt(i4);
|
||||
i3++;
|
||||
if (b(charAt)) {
|
||||
fArr[0] = fArr[0] + 0.5f;
|
||||
} else if (c(charAt)) {
|
||||
fArr[0] = (float) Math.ceil(fArr[0]);
|
||||
fArr[0] = fArr[0] + 2.0f;
|
||||
} else {
|
||||
fArr[0] = (float) Math.ceil(fArr[0]);
|
||||
fArr[0] = fArr[0] + 1.0f;
|
||||
}
|
||||
if (d(charAt)) {
|
||||
fArr[1] = fArr[1] + 0.6666667f;
|
||||
} else if (c(charAt)) {
|
||||
fArr[1] = fArr[1] + 2.6666667f;
|
||||
} else {
|
||||
fArr[1] = fArr[1] + 1.3333334f;
|
||||
}
|
||||
if (f(charAt)) {
|
||||
fArr[2] = fArr[2] + 0.6666667f;
|
||||
} else if (c(charAt)) {
|
||||
fArr[2] = fArr[2] + 2.6666667f;
|
||||
} else {
|
||||
fArr[2] = fArr[2] + 1.3333334f;
|
||||
}
|
||||
if (g(charAt)) {
|
||||
fArr[3] = fArr[3] + 0.6666667f;
|
||||
} else if (c(charAt)) {
|
||||
fArr[3] = fArr[3] + 4.3333335f;
|
||||
} else {
|
||||
fArr[3] = fArr[3] + 3.3333333f;
|
||||
}
|
||||
if (e(charAt)) {
|
||||
fArr[4] = fArr[4] + 0.75f;
|
||||
} else if (c(charAt)) {
|
||||
fArr[4] = fArr[4] + 4.25f;
|
||||
} else {
|
||||
fArr[4] = fArr[4] + 3.25f;
|
||||
}
|
||||
if (h(charAt)) {
|
||||
c = 5;
|
||||
fArr[5] = fArr[5] + 4.0f;
|
||||
} else {
|
||||
c = 5;
|
||||
fArr[5] = fArr[5] + 1.0f;
|
||||
}
|
||||
if (i3 >= 4) {
|
||||
int[] iArr2 = new int[6];
|
||||
byte[] bArr2 = new byte[6];
|
||||
a(fArr, iArr2, Integer.MAX_VALUE, bArr2);
|
||||
int a3 = a(bArr2);
|
||||
if (iArr2[0] < iArr2[c] && iArr2[0] < iArr2[1] && iArr2[0] < iArr2[2] && iArr2[0] < iArr2[3] && iArr2[0] < iArr2[4]) {
|
||||
return 0;
|
||||
}
|
||||
if (iArr2[5] < iArr2[0] || bArr2[1] + bArr2[2] + bArr2[3] + bArr2[4] == 0) {
|
||||
return 5;
|
||||
}
|
||||
if (a3 == 1 && bArr2[4] > 0) {
|
||||
return 4;
|
||||
}
|
||||
if (a3 == 1 && bArr2[2] > 0) {
|
||||
return 2;
|
||||
}
|
||||
if (a3 == 1 && bArr2[3] > 0) {
|
||||
return 3;
|
||||
}
|
||||
if (iArr2[1] + 1 < iArr2[0] && iArr2[1] + 1 < iArr2[5] && iArr2[1] + 1 < iArr2[4] && iArr2[1] + 1 < iArr2[2]) {
|
||||
if (iArr2[1] < iArr2[3]) {
|
||||
return 1;
|
||||
}
|
||||
if (iArr2[1] == iArr2[3]) {
|
||||
for (int i5 = i + i3 + 1; i5 < charSequence.length(); i5++) {
|
||||
char charAt2 = charSequence.charAt(i5);
|
||||
if (i(charAt2)) {
|
||||
return 3;
|
||||
}
|
||||
if (!g(charAt2)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static int a(float[] fArr, int[] iArr, int i, byte[] bArr) {
|
||||
Arrays.fill(bArr, (byte) 0);
|
||||
int i2 = i;
|
||||
for (int i3 = 0; i3 < 6; i3++) {
|
||||
iArr[i3] = (int) Math.ceil(fArr[i3]);
|
||||
int i4 = iArr[i3];
|
||||
if (i2 > i4) {
|
||||
Arrays.fill(bArr, (byte) 0);
|
||||
i2 = i4;
|
||||
}
|
||||
if (i2 == i4) {
|
||||
bArr[i3] = (byte) (bArr[i3] + 1);
|
||||
}
|
||||
}
|
||||
return i2;
|
||||
}
|
||||
|
||||
private static int a(byte[] bArr) {
|
||||
int i = 0;
|
||||
for (int i2 = 0; i2 < 6; i2++) {
|
||||
i += bArr[i2];
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
public static int a(CharSequence charSequence, int i) {
|
||||
int length = charSequence.length();
|
||||
int i2 = 0;
|
||||
if (i < length) {
|
||||
char charAt = charSequence.charAt(i);
|
||||
while (b(charAt) && i < length) {
|
||||
i2++;
|
||||
i++;
|
||||
if (i < length) {
|
||||
charAt = charSequence.charAt(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
return i2;
|
||||
}
|
||||
|
||||
static void a(char c) {
|
||||
String hexString = Integer.toHexString(c);
|
||||
throw new IllegalArgumentException("Illegal character: " + c + " (0x" + ("0000".substring(0, 4 - hexString.length()) + hexString) + ')');
|
||||
}
|
||||
}
|
137
sources/com/google/zxing/datamatrix/encoder/SymbolInfo.java
Normal file
137
sources/com/google/zxing/datamatrix/encoder/SymbolInfo.java
Normal file
@@ -0,0 +1,137 @@
|
||||
package com.google.zxing.datamatrix.encoder;
|
||||
|
||||
import com.google.zxing.Dimension;
|
||||
import com.twitter.sdk.android.core.TwitterAuthConfig;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class SymbolInfo {
|
||||
private static SymbolInfo[] i = {new SymbolInfo(false, 3, 5, 8, 8, 1), new SymbolInfo(false, 5, 7, 10, 10, 1), new SymbolInfo(true, 5, 7, 16, 6, 1), new SymbolInfo(false, 8, 10, 12, 12, 1), new SymbolInfo(true, 10, 11, 14, 6, 2), new SymbolInfo(false, 12, 12, 14, 14, 1), new SymbolInfo(true, 16, 14, 24, 10, 1), new SymbolInfo(false, 18, 14, 16, 16, 1), new SymbolInfo(false, 22, 18, 18, 18, 1), new SymbolInfo(true, 22, 18, 16, 10, 2), new SymbolInfo(false, 30, 20, 20, 20, 1), new SymbolInfo(true, 32, 24, 16, 14, 2), new SymbolInfo(false, 36, 24, 22, 22, 1), new SymbolInfo(false, 44, 28, 24, 24, 1), new SymbolInfo(true, 49, 28, 22, 14, 2), new SymbolInfo(false, 62, 36, 14, 14, 4), new SymbolInfo(false, 86, 42, 16, 16, 4), new SymbolInfo(false, 114, 48, 18, 18, 4), new SymbolInfo(false, 144, 56, 20, 20, 4), new SymbolInfo(false, 174, 68, 22, 22, 4), new SymbolInfo(false, 204, 84, 24, 24, 4, 102, 42), new SymbolInfo(false, 280, 112, 14, 14, 16, TwitterAuthConfig.DEFAULT_AUTH_REQUEST_CODE, 56), new SymbolInfo(false, 368, 144, 16, 16, 16, 92, 36), new SymbolInfo(false, 456, 192, 18, 18, 16, 114, 48), new SymbolInfo(false, 576, 224, 20, 20, 16, 144, 56), new SymbolInfo(false, 696, 272, 22, 22, 16, 174, 68), new SymbolInfo(false, 816, 336, 24, 24, 16, 136, 56), new SymbolInfo(false, 1050, 408, 18, 18, 36, 175, 68), new SymbolInfo(false, 1304, 496, 20, 20, 36, 163, 62), new DataMatrixSymbolInfo144()};
|
||||
private final boolean a;
|
||||
private final int b;
|
||||
private final int c;
|
||||
public final int d;
|
||||
public final int e;
|
||||
private final int f;
|
||||
private final int g;
|
||||
private final int h;
|
||||
|
||||
public SymbolInfo(boolean z, int i2, int i3, int i4, int i5, int i6) {
|
||||
this(z, i2, i3, i4, i5, i6, i2, i3);
|
||||
}
|
||||
|
||||
public static SymbolInfo a(int i2, SymbolShapeHint symbolShapeHint, Dimension dimension, Dimension dimension2, boolean z) {
|
||||
for (SymbolInfo symbolInfo : i) {
|
||||
if (!(symbolShapeHint == SymbolShapeHint.FORCE_SQUARE && symbolInfo.a) && ((symbolShapeHint != SymbolShapeHint.FORCE_RECTANGLE || symbolInfo.a) && ((dimension == null || (symbolInfo.g() >= dimension.b() && symbolInfo.f() >= dimension.a())) && ((dimension2 == null || (symbolInfo.g() <= dimension2.b() && symbolInfo.f() <= dimension2.a())) && i2 <= symbolInfo.b)))) {
|
||||
return symbolInfo;
|
||||
}
|
||||
}
|
||||
if (z) {
|
||||
throw new IllegalArgumentException("Can't find a symbol arrangement that matches the message. Data codewords: ".concat(String.valueOf(i2)));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private int h() {
|
||||
int i2 = this.f;
|
||||
int i3 = 1;
|
||||
if (i2 != 1) {
|
||||
i3 = 2;
|
||||
if (i2 != 2 && i2 != 4) {
|
||||
if (i2 == 16) {
|
||||
return 4;
|
||||
}
|
||||
if (i2 == 36) {
|
||||
return 6;
|
||||
}
|
||||
throw new IllegalStateException("Cannot handle this number of data regions");
|
||||
}
|
||||
}
|
||||
return i3;
|
||||
}
|
||||
|
||||
private int i() {
|
||||
int i2 = this.f;
|
||||
if (i2 == 1 || i2 == 2) {
|
||||
return 1;
|
||||
}
|
||||
if (i2 == 4) {
|
||||
return 2;
|
||||
}
|
||||
if (i2 == 16) {
|
||||
return 4;
|
||||
}
|
||||
if (i2 == 36) {
|
||||
return 6;
|
||||
}
|
||||
throw new IllegalStateException("Cannot handle this number of data regions");
|
||||
}
|
||||
|
||||
public final int b() {
|
||||
return this.c;
|
||||
}
|
||||
|
||||
public int c() {
|
||||
return this.b / this.g;
|
||||
}
|
||||
|
||||
public final int d() {
|
||||
return i() * this.e;
|
||||
}
|
||||
|
||||
public final int e() {
|
||||
return h() * this.d;
|
||||
}
|
||||
|
||||
public final int f() {
|
||||
return d() + (i() << 1);
|
||||
}
|
||||
|
||||
public final int g() {
|
||||
return e() + (h() << 1);
|
||||
}
|
||||
|
||||
public final String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(this.a ? "Rectangular Symbol:" : "Square Symbol:");
|
||||
sb.append(" data region ");
|
||||
sb.append(this.d);
|
||||
sb.append('x');
|
||||
sb.append(this.e);
|
||||
sb.append(", symbol size ");
|
||||
sb.append(g());
|
||||
sb.append('x');
|
||||
sb.append(f());
|
||||
sb.append(", symbol data size ");
|
||||
sb.append(e());
|
||||
sb.append('x');
|
||||
sb.append(d());
|
||||
sb.append(", codewords ");
|
||||
sb.append(this.b);
|
||||
sb.append('+');
|
||||
sb.append(this.c);
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
SymbolInfo(boolean z, int i2, int i3, int i4, int i5, int i6, int i7, int i8) {
|
||||
this.a = z;
|
||||
this.b = i2;
|
||||
this.c = i3;
|
||||
this.d = i4;
|
||||
this.e = i5;
|
||||
this.f = i6;
|
||||
this.g = i7;
|
||||
this.h = i8;
|
||||
}
|
||||
|
||||
public final int b(int i2) {
|
||||
return this.h;
|
||||
}
|
||||
|
||||
public final int a() {
|
||||
return this.b;
|
||||
}
|
||||
|
||||
public int a(int i2) {
|
||||
return this.g;
|
||||
}
|
||||
}
|
@@ -0,0 +1,8 @@
|
||||
package com.google.zxing.datamatrix.encoder;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public enum SymbolShapeHint {
|
||||
FORCE_NONE,
|
||||
FORCE_SQUARE,
|
||||
FORCE_RECTANGLE
|
||||
}
|
65
sources/com/google/zxing/datamatrix/encoder/TextEncoder.java
Normal file
65
sources/com/google/zxing/datamatrix/encoder/TextEncoder.java
Normal file
@@ -0,0 +1,65 @@
|
||||
package com.google.zxing.datamatrix.encoder;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class TextEncoder extends C40Encoder {
|
||||
TextEncoder() {
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.datamatrix.encoder.C40Encoder
|
||||
public int a() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.datamatrix.encoder.C40Encoder
|
||||
int a(char c, StringBuilder sb) {
|
||||
if (c == ' ') {
|
||||
sb.append((char) 3);
|
||||
return 1;
|
||||
}
|
||||
if (c >= '0' && c <= '9') {
|
||||
sb.append((char) ((c - '0') + 4));
|
||||
return 1;
|
||||
}
|
||||
if (c >= 'a' && c <= 'z') {
|
||||
sb.append((char) ((c - 'a') + 14));
|
||||
return 1;
|
||||
}
|
||||
if (c < ' ') {
|
||||
sb.append((char) 0);
|
||||
sb.append(c);
|
||||
return 2;
|
||||
}
|
||||
if (c >= '!' && c <= '/') {
|
||||
sb.append((char) 1);
|
||||
sb.append((char) (c - '!'));
|
||||
return 2;
|
||||
}
|
||||
if (c >= ':' && c <= '@') {
|
||||
sb.append((char) 1);
|
||||
sb.append((char) ((c - ':') + 15));
|
||||
return 2;
|
||||
}
|
||||
if (c >= '[' && c <= '_') {
|
||||
sb.append((char) 1);
|
||||
sb.append((char) ((c - '[') + 22));
|
||||
return 2;
|
||||
}
|
||||
if (c == '`') {
|
||||
sb.append((char) 2);
|
||||
sb.append((char) (c - '`'));
|
||||
return 2;
|
||||
}
|
||||
if (c >= 'A' && c <= 'Z') {
|
||||
sb.append((char) 2);
|
||||
sb.append((char) ((c - 'A') + 1));
|
||||
return 2;
|
||||
}
|
||||
if (c < '{' || c > 127) {
|
||||
sb.append("\u0001\u001e");
|
||||
return a((char) (c - 128), sb) + 2;
|
||||
}
|
||||
sb.append((char) 2);
|
||||
sb.append((char) ((c - '{') + 27));
|
||||
return 2;
|
||||
}
|
||||
}
|
67
sources/com/google/zxing/datamatrix/encoder/X12Encoder.java
Normal file
67
sources/com/google/zxing/datamatrix/encoder/X12Encoder.java
Normal file
@@ -0,0 +1,67 @@
|
||||
package com.google.zxing.datamatrix.encoder;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class X12Encoder extends C40Encoder {
|
||||
X12Encoder() {
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.datamatrix.encoder.C40Encoder
|
||||
public int a() {
|
||||
return 3;
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.datamatrix.encoder.C40Encoder, com.google.zxing.datamatrix.encoder.Encoder
|
||||
public void a(EncoderContext encoderContext) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
while (true) {
|
||||
if (!encoderContext.h()) {
|
||||
break;
|
||||
}
|
||||
char c = encoderContext.c();
|
||||
encoderContext.f++;
|
||||
a(c, sb);
|
||||
if (sb.length() % 3 == 0) {
|
||||
C40Encoder.b(encoderContext, sb);
|
||||
if (HighLevelEncoder.a(encoderContext.d(), encoderContext.f, a()) != a()) {
|
||||
encoderContext.b(0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
a(encoderContext, sb);
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.datamatrix.encoder.C40Encoder
|
||||
int a(char c, StringBuilder sb) {
|
||||
if (c == '\r') {
|
||||
sb.append((char) 0);
|
||||
} else if (c == ' ') {
|
||||
sb.append((char) 3);
|
||||
} else if (c == '*') {
|
||||
sb.append((char) 1);
|
||||
} else if (c == '>') {
|
||||
sb.append((char) 2);
|
||||
} else if (c >= '0' && c <= '9') {
|
||||
sb.append((char) ((c - '0') + 4));
|
||||
} else if (c >= 'A' && c <= 'Z') {
|
||||
sb.append((char) ((c - 'A') + 14));
|
||||
} else {
|
||||
HighLevelEncoder.a(c);
|
||||
throw null;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override // com.google.zxing.datamatrix.encoder.C40Encoder
|
||||
void a(EncoderContext encoderContext, StringBuilder sb) {
|
||||
encoderContext.k();
|
||||
int a = encoderContext.g().a() - encoderContext.a();
|
||||
encoderContext.f -= sb.length();
|
||||
if (encoderContext.f() > 1 || a > 1 || encoderContext.f() != a) {
|
||||
encoderContext.a((char) 254);
|
||||
}
|
||||
if (encoderContext.e() < 0) {
|
||||
encoderContext.b(0);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user