202 lines
5.8 KiB
Java
202 lines
5.8 KiB
Java
package o;
|
|
|
|
import java.util.Arrays;
|
|
|
|
/* renamed from: o.dZc, reason: case insensitive filesystem */
|
|
/* loaded from: classes.dex */
|
|
public final class C8902dZc implements Cloneable {
|
|
public int[] a;
|
|
public int b;
|
|
public int c;
|
|
public int e;
|
|
|
|
public C8902dZc(int i) {
|
|
this(i, i);
|
|
}
|
|
|
|
public C8902dZc(int i, int i2) {
|
|
if (i <= 0 || i2 <= 0) {
|
|
throw new IllegalArgumentException("Both dimensions must be greater than 0");
|
|
}
|
|
this.e = i;
|
|
this.c = i2;
|
|
int i3 = (i + 31) / 32;
|
|
this.b = i3;
|
|
this.a = new int[i3 * i2];
|
|
}
|
|
|
|
private C8902dZc(int i, int i2, int i3, int[] iArr) {
|
|
this.e = i;
|
|
this.c = i2;
|
|
this.b = i3;
|
|
this.a = iArr;
|
|
}
|
|
|
|
public final boolean b(int i, int i2) {
|
|
return ((this.a[(i2 * this.b) + (i / 32)] >>> (i & 31)) & 1) != 0;
|
|
}
|
|
|
|
public final void a(int i, int i2) {
|
|
int i3 = (i2 * this.b) + (i / 32);
|
|
int[] iArr = this.a;
|
|
iArr[i3] = (1 << (i & 31)) | iArr[i3];
|
|
}
|
|
|
|
public final void d(int i, int i2) {
|
|
int i3 = (i2 * this.b) + (i / 32);
|
|
int[] iArr = this.a;
|
|
iArr[i3] = (1 << (i & 31)) ^ iArr[i3];
|
|
}
|
|
|
|
public final void b(int i, int i2, int i3, int i4) {
|
|
if (i2 < 0 || i < 0) {
|
|
throw new IllegalArgumentException("Left and top must be nonnegative");
|
|
}
|
|
if (i4 <= 0 || i3 <= 0) {
|
|
throw new IllegalArgumentException("Height and width must be at least 1");
|
|
}
|
|
int i5 = i3 + i;
|
|
int i6 = i4 + i2;
|
|
if (i6 > this.c || i5 > this.e) {
|
|
throw new IllegalArgumentException("The region must fit inside the matrix");
|
|
}
|
|
while (i2 < i6) {
|
|
int i7 = this.b;
|
|
for (int i8 = i; i8 < i5; i8++) {
|
|
int[] iArr = this.a;
|
|
int i9 = (i8 / 32) + (i7 * i2);
|
|
iArr[i9] = iArr[i9] | (1 << (i8 & 31));
|
|
}
|
|
i2++;
|
|
}
|
|
}
|
|
|
|
public final void d() {
|
|
C17416wdP c17416wdP = new C17416wdP(this.e);
|
|
C17416wdP c17416wdP2 = new C17416wdP(this.e);
|
|
int i = (this.c + 1) / 2;
|
|
for (int i2 = 0; i2 < i; i2++) {
|
|
c17416wdP = b(i2, c17416wdP);
|
|
int i3 = (this.c - 1) - i2;
|
|
c17416wdP2 = b(i3, c17416wdP2);
|
|
c17416wdP.c();
|
|
c17416wdP2.c();
|
|
int[] iArr = c17416wdP2.a;
|
|
int[] iArr2 = this.a;
|
|
int i4 = this.b;
|
|
System.arraycopy(iArr, 0, iArr2, i2 * i4, i4);
|
|
int[] iArr3 = c17416wdP.a;
|
|
int[] iArr4 = this.a;
|
|
int i5 = this.b;
|
|
System.arraycopy(iArr3, 0, iArr4, i3 * i5, i5);
|
|
}
|
|
}
|
|
|
|
public final void b() {
|
|
int i = this.c;
|
|
int i2 = this.e;
|
|
int i3 = (i + 31) / 32;
|
|
int[] iArr = new int[i3 * i2];
|
|
for (int i4 = 0; i4 < this.c; i4++) {
|
|
for (int i5 = 0; i5 < this.e; i5++) {
|
|
if (((this.a[(this.b * i4) + (i5 / 32)] >>> (i5 & 31)) & 1) != 0) {
|
|
int i6 = (((i2 - 1) - i5) * i3) + (i4 / 32);
|
|
iArr[i6] = (1 << (i4 & 31)) | iArr[i6];
|
|
}
|
|
}
|
|
}
|
|
this.e = i;
|
|
this.c = i2;
|
|
this.b = i3;
|
|
this.a = iArr;
|
|
}
|
|
|
|
public final int[] e() {
|
|
int[] iArr;
|
|
int i = 0;
|
|
int i2 = 0;
|
|
while (true) {
|
|
iArr = this.a;
|
|
if (i2 >= iArr.length || iArr[i2] != 0) {
|
|
break;
|
|
}
|
|
i2++;
|
|
}
|
|
if (i2 == iArr.length) {
|
|
return null;
|
|
}
|
|
int i3 = this.b;
|
|
int i4 = i2 / i3;
|
|
while ((iArr[i2] << (31 - i)) == 0) {
|
|
i++;
|
|
}
|
|
return new int[]{((i2 % i3) << 5) + i, i4};
|
|
}
|
|
|
|
public final int[] a() {
|
|
int length = this.a.length - 1;
|
|
while (length >= 0 && this.a[length] == 0) {
|
|
length--;
|
|
}
|
|
if (length < 0) {
|
|
return null;
|
|
}
|
|
int i = this.b;
|
|
int i2 = length / i;
|
|
int i3 = 31;
|
|
while ((this.a[length] >>> i3) == 0) {
|
|
i3--;
|
|
}
|
|
return new int[]{((length % i) << 5) + i3, i2};
|
|
}
|
|
|
|
public final boolean equals(Object obj) {
|
|
if (!(obj instanceof C8902dZc)) {
|
|
return false;
|
|
}
|
|
C8902dZc c8902dZc = (C8902dZc) obj;
|
|
return this.e == c8902dZc.e && this.c == c8902dZc.c && this.b == c8902dZc.b && Arrays.equals(this.a, c8902dZc.a);
|
|
}
|
|
|
|
public final int hashCode() {
|
|
int i = this.e;
|
|
int i2 = this.c;
|
|
return (((((((i * 31) + i) * 31) + i2) * 31) + this.b) * 31) + Arrays.hashCode(this.a);
|
|
}
|
|
|
|
public final C8902dZc c() {
|
|
return new C8902dZc(this.e, this.c, this.b, (int[]) this.a.clone());
|
|
}
|
|
|
|
public final /* synthetic */ Object clone() throws CloneNotSupportedException {
|
|
return new C8902dZc(this.e, this.c, this.b, (int[]) this.a.clone());
|
|
}
|
|
|
|
private C17416wdP b(int i, C17416wdP c17416wdP) {
|
|
if (c17416wdP == null || c17416wdP.d < this.e) {
|
|
c17416wdP = new C17416wdP(this.e);
|
|
} else {
|
|
int length = c17416wdP.a.length;
|
|
for (int i2 = 0; i2 < length; i2++) {
|
|
c17416wdP.a[i2] = 0;
|
|
}
|
|
}
|
|
int i3 = this.b;
|
|
for (int i4 = 0; i4 < this.b; i4++) {
|
|
c17416wdP.a[(i4 << 5) / 32] = this.a[(i * i3) + i4];
|
|
}
|
|
return c17416wdP;
|
|
}
|
|
|
|
public final String toString() {
|
|
StringBuilder sb = new StringBuilder(this.c * (this.e + 1));
|
|
for (int i = 0; i < this.c; i++) {
|
|
for (int i2 = 0; i2 < this.e; i2++) {
|
|
sb.append(b(i2, i) ? "X " : " ");
|
|
}
|
|
sb.append("\n");
|
|
}
|
|
return sb.toString();
|
|
}
|
|
}
|