what-the-bank/sources/o/CPd.java

275 lines
9.8 KiB
Java

package o;
import android.os.Handler;
import android.os.Looper;
import java.util.ArrayDeque;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.Executor;
import o.HOS;
/* loaded from: classes.dex */
public class CPd<T> {
private static final Executor j = new LWm();
Executor a;
List<T> c;
int d;
final XRa<T> e;
final BNe g;
final List<HBt<T>> b = new CopyOnWriteArrayList();
List<T> f = Collections.emptyList();
/* loaded from: classes.dex */
public interface HBt<T> {
void b(List<T> list, List<T> list2);
}
/* loaded from: classes.dex */
static class LWm implements Executor {
final Handler b = new Handler(Looper.getMainLooper());
LWm() {
}
@Override // java.util.concurrent.Executor
public final void execute(Runnable runnable) {
this.b.post(runnable);
}
}
public CPd(BNe bNe, XRa<T> xRa) {
this.g = bNe;
this.e = xRa;
this.a = xRa.b != null ? xRa.b : j;
}
public final void d(List<T> list, Runnable runnable) {
int i = this.d + 1;
this.d = i;
List<T> list2 = this.c;
if (list == list2) {
if (runnable != null) {
runnable.run();
return;
}
return;
}
List<T> list3 = this.f;
if (list == null) {
int size = list2.size();
this.c = null;
this.f = Collections.emptyList();
this.g.b(0, size);
a(list3, runnable);
return;
}
if (list2 == null) {
this.c = list;
this.f = Collections.unmodifiableList(list);
this.g.e(0, list.size());
a(list3, runnable);
return;
}
this.e.c.execute(new AnonymousClass3(this, list2, list, i, runnable));
}
/* renamed from: o.CPd$3, reason: invalid class name */
/* loaded from: classes.dex */
final class AnonymousClass3 implements Runnable {
final CPd a;
final List b;
final int c;
final Runnable d;
final List e;
AnonymousClass3(CPd cPd, List list, List list2, int i, Runnable runnable) {
this.a = cPd;
this.b = list;
this.e = list2;
this.c = i;
this.d = runnable;
}
@Override // java.lang.Runnable
public final void run() {
this.a.a.execute(new Runnable(this, HOS.c(new HOS.HBt(this) { // from class: o.CPd.3.3
final AnonymousClass3 b;
{
this.b = this;
}
@Override // o.HOS.HBt
public final int c() {
return this.b.b.size();
}
@Override // o.HOS.HBt
public final int a() {
return this.b.e.size();
}
/* JADX WARN: Multi-variable type inference failed */
@Override // o.HOS.HBt
public final boolean d(int i, int i2) {
Object obj = this.b.b.get(i);
Object obj2 = this.b.e.get(i2);
if (obj == null || obj2 == null) {
return obj == null && obj2 == null;
}
return this.b.a.e.a.areItemsTheSame(obj, obj2);
}
/* JADX WARN: Multi-variable type inference failed */
@Override // o.HOS.HBt
public final boolean a(int i, int i2) {
Object obj = this.b.b.get(i);
Object obj2 = this.b.e.get(i2);
if (obj != null && obj2 != null) {
return this.b.a.e.a.areContentsTheSame(obj, obj2);
}
if (obj == null && obj2 == null) {
return true;
}
throw new AssertionError();
}
/* JADX WARN: Multi-variable type inference failed */
@Override // o.HOS.HBt
public final Object b(int i, int i2) {
Object obj = this.b.b.get(i);
Object obj2 = this.b.e.get(i2);
if (obj != null && obj2 != null) {
return this.b.a.e.a.getChangePayload(obj, obj2);
}
throw new AssertionError();
}
})) { // from class: o.CPd.3.1
final HOS.RVV a;
final AnonymousClass3 d;
{
this.d = this;
this.a = r2;
}
@Override // java.lang.Runnable
public final void run() {
HNv hNv;
int i;
int i2;
int i3;
boolean z;
if (this.d.a.d == this.d.c) {
CPd cPd = this.d.a;
List<T> list = this.d.e;
HOS.RVV rvv = this.a;
Runnable runnable = this.d.d;
List<T> list2 = cPd.f;
cPd.c = list;
cPd.f = Collections.unmodifiableList(list);
BNe bNe = cPd.g;
if (bNe instanceof HNv) {
hNv = (HNv) bNe;
} else {
hNv = new HNv(bNe);
}
int i4 = rvv.h;
ArrayDeque arrayDeque = new ArrayDeque();
int i5 = rvv.h;
int i6 = rvv.c;
for (int size = rvv.a.size() - 1; size >= 0; size--) {
HOS.LWm lWm = rvv.a.get(size);
int i7 = lWm.a + lWm.c;
int i8 = lWm.b + lWm.c;
while (true) {
i = 0;
if (i5 <= i7) {
break;
}
i5--;
int i9 = rvv.e[i5];
if ((i9 & 12) != 0) {
int i10 = i9 >> 4;
HOS.jbe b = HOS.RVV.b(arrayDeque, i10, false);
if (b != null) {
i3 = i6;
int i11 = (i4 - b.a) - 1;
hNv.e();
hNv.c.c(i5, i11);
if ((i9 & 4) != 0) {
z = true;
hNv.b(i11, 1, rvv.b.b(i5, i10));
} else {
z = true;
}
} else {
i3 = i6;
z = true;
arrayDeque.add(new HOS.jbe(i5, (i4 - i5) - 1, true));
}
i6 = i3;
} else {
hNv.b(i5, 1);
i4--;
i6 = i6;
}
}
while (i6 > i8) {
i6--;
int i12 = rvv.d[i6];
if ((i12 & 12) != 0) {
int i13 = i12 >> 4;
HOS.jbe b2 = HOS.RVV.b(arrayDeque, i13, true);
if (b2 == null) {
arrayDeque.add(new HOS.jbe(i6, i4 - i5, false));
i2 = 0;
} else {
i2 = 0;
int i14 = (i4 - b2.a) - 1;
hNv.e();
hNv.c.c(i14, i5);
if ((i12 & 4) != 0) {
hNv.b(i5, 1, rvv.b.b(i13, i6));
}
}
i = i2;
} else {
hNv.e(i5, 1);
i4++;
}
}
int i15 = lWm.a;
int i16 = lWm.b;
while (i < lWm.c) {
if ((rvv.e[i15] & 15) == 2) {
hNv.b(i15, 1, rvv.b.b(i15, i16));
}
i15++;
i16++;
i++;
}
i5 = lWm.a;
i6 = lWm.b;
}
hNv.e();
cPd.a(list2, runnable);
}
}
});
}
}
final void a(List<T> list, Runnable runnable) {
Iterator<HBt<T>> it = this.b.iterator();
while (it.hasNext()) {
it.next().b(list, this.f);
}
if (runnable != null) {
runnable.run();
}
}
}