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

552 lines
16 KiB
Java

package o;
import com.huawei.hms.framework.common.ContainerUtils;
import java.lang.Comparable;
import java.util.AbstractMap;
import java.util.AbstractSet;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Set;
import java.util.SortedMap;
import java.util.TreeMap;
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes2.dex */
public class qAt<K extends Comparable<K>, V> extends AbstractMap<K, V> {
Map<K, V> a;
boolean b;
List<qAt<K, V>.Sts> c;
Map<K, V> d;
volatile qAt<K, V>.RVV e;
private volatile qAt<K, V>.ojQ f;
private final int h;
/* synthetic */ qAt(int i, byte b) {
this(i);
}
private qAt(int i) {
this.h = i;
this.c = Collections.emptyList();
this.a = Collections.emptyMap();
this.d = Collections.emptyMap();
}
public void d() {
Map<K, V> unmodifiableMap;
Map<K, V> unmodifiableMap2;
if (this.b) {
return;
}
if (this.a.isEmpty()) {
unmodifiableMap = Collections.emptyMap();
} else {
unmodifiableMap = Collections.unmodifiableMap(this.a);
}
this.a = unmodifiableMap;
if (this.d.isEmpty()) {
unmodifiableMap2 = Collections.emptyMap();
} else {
unmodifiableMap2 = Collections.unmodifiableMap(this.d);
}
this.d = unmodifiableMap2;
this.b = true;
}
@Override // java.util.AbstractMap, java.util.Map
public int size() {
return this.c.size() + this.a.size();
}
/* JADX WARN: Multi-variable type inference failed */
@Override // java.util.AbstractMap, java.util.Map
public boolean containsKey(Object obj) {
Comparable comparable = (Comparable) obj;
return a((qAt<K, V>) comparable) >= 0 || this.a.containsKey(comparable);
}
/* JADX WARN: Multi-variable type inference failed */
@Override // java.util.AbstractMap, java.util.Map
public V get(Object obj) {
Comparable comparable = (Comparable) obj;
int a = a((qAt<K, V>) comparable);
if (a >= 0) {
return this.c.get(a).getValue();
}
return this.a.get(comparable);
}
@Override // java.util.AbstractMap, java.util.Map
/* renamed from: d, reason: merged with bridge method [inline-methods] */
public final V put(K k, V v) {
if (!this.b) {
int a = a((qAt<K, V>) k);
if (a >= 0) {
return this.c.get(a).setValue(v);
}
e();
int i = -(a + 1);
if (i >= this.h) {
return c().put(k, v);
}
int size = this.c.size();
int i2 = this.h;
if (size == i2) {
qAt<K, V>.Sts remove = this.c.remove(i2 - 1);
c().put(remove.d, remove.getValue());
}
this.c.add(i, new Sts(this, k, v));
return null;
}
throw new UnsupportedOperationException();
}
@Override // java.util.AbstractMap, java.util.Map
public void clear() {
if (!this.b) {
if (!this.c.isEmpty()) {
this.c.clear();
}
if (this.a.isEmpty()) {
return;
}
this.a.clear();
return;
}
throw new UnsupportedOperationException();
}
/* JADX WARN: Multi-variable type inference failed */
@Override // java.util.AbstractMap, java.util.Map
public V remove(Object obj) {
if (!this.b) {
Comparable comparable = (Comparable) obj;
int a = a((qAt<K, V>) comparable);
if (a >= 0) {
return (V) a(a);
}
if (this.a.isEmpty()) {
return null;
}
return this.a.remove(comparable);
}
throw new UnsupportedOperationException();
}
final V a(int i) {
if (!this.b) {
V value = this.c.remove(i).getValue();
if (!this.a.isEmpty()) {
Iterator<Map.Entry<K, V>> it = c().entrySet().iterator();
this.c.add(new Sts(this, it.next()));
it.remove();
}
return value;
}
throw new UnsupportedOperationException();
}
private int a(K k) {
int size = this.c.size();
int i = size - 1;
if (i >= 0) {
int compareTo = k.compareTo(this.c.get(i).d);
if (compareTo <= 0) {
if (compareTo == 0) {
return i;
}
}
return -(size + 1);
}
size = 0;
while (size <= i) {
int i2 = (size + i) / 2;
int compareTo2 = k.compareTo(this.c.get(i2).d);
if (compareTo2 < 0) {
i = i2 - 1;
} else {
if (compareTo2 <= 0) {
return i2;
}
size = i2 + 1;
}
}
return -(size + 1);
}
@Override // java.util.AbstractMap, java.util.Map
public Set<Map.Entry<K, V>> entrySet() {
if (this.f == null) {
this.f = new ojQ(this, (byte) 0);
}
return this.f;
}
private SortedMap<K, V> c() {
if (!this.b) {
if (this.a.isEmpty() && !(this.a instanceof TreeMap)) {
TreeMap treeMap = new TreeMap();
this.a = treeMap;
this.d = treeMap.descendingMap();
}
return (SortedMap) this.a;
}
throw new UnsupportedOperationException();
}
private void e() {
if (!this.b) {
if (!this.c.isEmpty() || (this.c instanceof ArrayList)) {
return;
}
this.c = new ArrayList(this.h);
return;
}
throw new UnsupportedOperationException();
}
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes2.dex */
public class Sts implements Map.Entry<K, V>, Comparable<qAt<K, V>.Sts> {
private qAt a;
private V c;
final K d;
@Override // java.lang.Comparable
public final /* bridge */ /* synthetic */ int compareTo(Object obj) {
return this.d.compareTo(((Sts) obj).d);
}
Sts(qAt qat, Map.Entry<K, V> entry) {
this(qat, entry.getKey(), entry.getValue());
}
Sts(qAt qat, K k, V v) {
this.a = qat;
this.d = k;
this.c = v;
}
@Override // java.util.Map.Entry
public final boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof Map.Entry)) {
return false;
}
Map.Entry entry = (Map.Entry) obj;
K k = this.d;
Object key = entry.getKey();
if (k != null ? k.equals(key) : key == null) {
V v = this.c;
Object value = entry.getValue();
if (v == null) {
if (value == null) {
return true;
}
} else if (v.equals(value)) {
return true;
}
}
return false;
}
@Override // java.util.Map.Entry
public final int hashCode() {
K k = this.d;
int hashCode = k == null ? 0 : k.hashCode();
V v = this.c;
return hashCode ^ (v != null ? v.hashCode() : 0);
}
public final String toString() {
StringBuilder sb = new StringBuilder();
sb.append(this.d);
sb.append(ContainerUtils.KEY_VALUE_DELIMITER);
sb.append(this.c);
return sb.toString();
}
@Override // java.util.Map.Entry
public final /* bridge */ /* synthetic */ Object getKey() {
return this.d;
}
@Override // java.util.Map.Entry
public final V setValue(V v) {
if (!this.a.b) {
V v2 = this.c;
this.c = v;
return v2;
}
throw new UnsupportedOperationException();
}
@Override // java.util.Map.Entry
public final V getValue() {
return this.c;
}
}
/* loaded from: classes2.dex */
class ojQ extends AbstractSet<Map.Entry<K, V>> {
private qAt c;
private ojQ(qAt qat) {
this.c = qat;
}
/* synthetic */ ojQ(qAt qat, byte b) {
this(qat);
}
/* JADX WARN: Multi-variable type inference failed */
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public /* synthetic */ boolean add(Object obj) {
Map.Entry entry = (Map.Entry) obj;
if (contains(entry)) {
return false;
}
this.c.put((Comparable) entry.getKey(), entry.getValue());
return true;
}
@Override // java.util.AbstractCollection, java.util.Collection, java.lang.Iterable, java.util.Set
public Iterator<Map.Entry<K, V>> iterator() {
return new LWm(this.c, (byte) 0);
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public int size() {
return this.c.size();
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean contains(Object obj) {
Map.Entry entry = (Map.Entry) obj;
V v = this.c.get(entry.getKey());
Object value = entry.getValue();
return v == value || (v != null && v.equals(value));
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean remove(Object obj) {
Map.Entry entry = (Map.Entry) obj;
if (!contains(entry)) {
return false;
}
this.c.remove(entry.getKey());
return true;
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public void clear() {
this.c.clear();
}
}
/* loaded from: classes2.dex */
class RVV extends ojQ {
private qAt d;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
private RVV(qAt qat) {
super(qat, (byte) 0);
this.d = qat;
}
/* JADX INFO: Access modifiers changed from: package-private */
public /* synthetic */ RVV(qAt qat, byte b) {
this(qat);
}
@Override // o.qAt.ojQ, java.util.AbstractCollection, java.util.Collection, java.lang.Iterable, java.util.Set
public final Iterator<Map.Entry<K, V>> iterator() {
return new IeS(this.d, (byte) 0);
}
}
/* loaded from: classes2.dex */
class LWm implements Iterator<Map.Entry<K, V>> {
private boolean a;
private qAt b;
private int d;
private Iterator<Map.Entry<K, V>> e;
private LWm(qAt qat) {
this.b = qat;
this.d = -1;
}
/* synthetic */ LWm(qAt qat, byte b) {
this(qat);
}
@Override // java.util.Iterator
public final /* synthetic */ Object next() {
this.a = true;
int i = this.d + 1;
this.d = i;
if (i < this.b.c.size()) {
return this.b.c.get(this.d);
}
return c().next();
}
private Iterator<Map.Entry<K, V>> c() {
if (this.e == null) {
this.e = this.b.a.entrySet().iterator();
}
return this.e;
}
@Override // java.util.Iterator
public final boolean hasNext() {
if (this.d + 1 >= this.b.c.size()) {
return !this.b.a.isEmpty() && c().hasNext();
}
return true;
}
@Override // java.util.Iterator
public final void remove() {
if (!this.a) {
throw new IllegalStateException("remove() was called before next()");
}
this.a = false;
if (!this.b.b) {
if (this.d >= this.b.c.size()) {
c().remove();
return;
}
qAt qat = this.b;
int i = this.d;
this.d = i - 1;
qat.a(i);
return;
}
throw new UnsupportedOperationException();
}
}
/* loaded from: classes2.dex */
class IeS implements Iterator<Map.Entry<K, V>> {
private int c;
private qAt d;
private Iterator<Map.Entry<K, V>> e;
private IeS(qAt qat) {
this.d = qat;
this.c = qat.c.size();
}
/* synthetic */ IeS(qAt qat, byte b) {
this(qat);
}
@Override // java.util.Iterator
public final void remove() {
throw new UnsupportedOperationException();
}
private Iterator<Map.Entry<K, V>> a() {
if (this.e == null) {
this.e = this.d.d.entrySet().iterator();
}
return this.e;
}
@Override // java.util.Iterator
public final boolean hasNext() {
int i = this.c;
return (i > 0 && i <= this.d.c.size()) || a().hasNext();
}
@Override // java.util.Iterator
public final /* synthetic */ Object next() {
if (a().hasNext()) {
return a().next();
}
List<qAt<K, V>.Sts> list = this.d.c;
int i = this.c - 1;
this.c = i;
return list.get(i);
}
}
@Override // java.util.AbstractMap, java.util.Map
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof qAt)) {
return super.equals(obj);
}
qAt qat = (qAt) obj;
int size = size();
if (size != qat.size()) {
return false;
}
int size2 = this.c.size();
if (size2 != qat.c.size()) {
return entrySet().equals(qat.entrySet());
}
for (int i = 0; i < size2; i++) {
if (!this.c.get(i).equals(qat.c.get(i))) {
return false;
}
}
if (size2 != size) {
return this.a.equals(qat.a);
}
return true;
}
@Override // java.util.AbstractMap, java.util.Map
public int hashCode() {
int size = this.c.size();
int i = 0;
for (int i2 = 0; i2 < size; i2++) {
i += this.c.get(i2).hashCode();
}
return this.a.size() > 0 ? i + this.a.hashCode() : i;
}
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes2.dex */
public static class HBt {
private static final Iterator<Object> b = new Iterator<Object>() { // from class: o.qAt.HBt.4
@Override // java.util.Iterator
public final boolean hasNext() {
return false;
}
@Override // java.util.Iterator
public final Object next() {
throw new NoSuchElementException();
}
@Override // java.util.Iterator
public final void remove() {
throw new UnsupportedOperationException();
}
};
private static final Iterable<Object> c = new Iterable<Object>() { // from class: o.qAt.HBt.5
@Override // java.lang.Iterable
public final Iterator<Object> iterator() {
return HBt.b;
}
};
/* JADX INFO: Access modifiers changed from: package-private */
public static <T> Iterable<T> c() {
return (Iterable<T>) c;
}
}
}