91 lines
2.6 KiB
Java
91 lines
2.6 KiB
Java
|
package o;
|
||
|
|
||
|
import java.util.Collection;
|
||
|
import java.util.Map;
|
||
|
import java.util.regex.Pattern;
|
||
|
|
||
|
/* loaded from: classes2.dex */
|
||
|
public abstract class Ggl implements InterfaceC16283mxN {
|
||
|
private static final Pattern b = Pattern.compile("[0-9]+");
|
||
|
|
||
|
protected Collection<PTS> b() {
|
||
|
return null;
|
||
|
}
|
||
|
|
||
|
public abstract boolean[] d(String str);
|
||
|
|
||
|
public int e() {
|
||
|
return 10;
|
||
|
}
|
||
|
|
||
|
protected boolean[] d(String str, Map<EnumC14826gQH, ?> map) {
|
||
|
return d(str);
|
||
|
}
|
||
|
|
||
|
@Override // o.InterfaceC16283mxN
|
||
|
public final C8902dZc d(String str, PTS pts, int i, int i2, Map<EnumC14826gQH, ?> map) {
|
||
|
if (str.isEmpty()) {
|
||
|
throw new IllegalArgumentException("Found empty contents");
|
||
|
}
|
||
|
if (i < 0 || i2 < 0) {
|
||
|
StringBuilder sb = new StringBuilder("Negative size is not allowed. Input: ");
|
||
|
sb.append(i);
|
||
|
sb.append('x');
|
||
|
sb.append(i2);
|
||
|
throw new IllegalArgumentException(sb.toString());
|
||
|
}
|
||
|
Collection<PTS> b2 = b();
|
||
|
if (b2 != null && !b2.contains(pts)) {
|
||
|
StringBuilder sb2 = new StringBuilder("Can only encode ");
|
||
|
sb2.append(b2);
|
||
|
sb2.append(", but got ");
|
||
|
sb2.append(pts);
|
||
|
throw new IllegalArgumentException(sb2.toString());
|
||
|
}
|
||
|
int e = e();
|
||
|
if (map != null && map.containsKey(EnumC14826gQH.MARGIN)) {
|
||
|
e = Integer.parseInt(map.get(EnumC14826gQH.MARGIN).toString());
|
||
|
}
|
||
|
boolean[] d = d(str, map);
|
||
|
int length = d.length;
|
||
|
int i3 = e + length;
|
||
|
int max = Math.max(i, i3);
|
||
|
int max2 = Math.max(1, i2);
|
||
|
int i4 = max / i3;
|
||
|
int i5 = (max - (length * i4)) / 2;
|
||
|
C8902dZc c8902dZc = new C8902dZc(max, max2);
|
||
|
int i6 = 0;
|
||
|
while (i6 < length) {
|
||
|
if (d[i6]) {
|
||
|
c8902dZc.b(i5, 0, i4, max2);
|
||
|
}
|
||
|
i6++;
|
||
|
i5 += i4;
|
||
|
}
|
||
|
return c8902dZc;
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: protected */
|
||
|
public static void a(String str) {
|
||
|
if (!b.matcher(str).matches()) {
|
||
|
throw new IllegalArgumentException("Input should only contain digits 0-9");
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: protected */
|
||
|
public static int b(boolean[] zArr, int i, int[] iArr, boolean z) {
|
||
|
int i2 = 0;
|
||
|
for (int i3 : iArr) {
|
||
|
int i4 = 0;
|
||
|
while (i4 < i3) {
|
||
|
zArr[i] = z;
|
||
|
i4++;
|
||
|
i++;
|
||
|
}
|
||
|
i2 += i3;
|
||
|
z = !z;
|
||
|
}
|
||
|
return i2;
|
||
|
}
|
||
|
}
|