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

552 lines
16 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
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 rqb<K extends Comparable<K>, V> extends AbstractMap<K, V> {
Map<K, V> a;
Map<K, V> b;
boolean c;
volatile rqb<K, V>.LWm d;
List<rqb<K, V>.RVV> e;
private volatile rqb<K, V>.jbe h;
private final int i;
/* synthetic */ rqb(int i, byte b) {
this(i);
}
private rqb(int i) {
this.i = i;
this.e = Collections.emptyList();
this.b = Collections.emptyMap();
this.a = Collections.emptyMap();
}
public void d() {
Map<K, V> unmodifiableMap;
Map<K, V> unmodifiableMap2;
if (this.c) {
return;
}
if (this.b.isEmpty()) {
unmodifiableMap = Collections.emptyMap();
} else {
unmodifiableMap = Collections.unmodifiableMap(this.b);
}
this.b = unmodifiableMap;
if (this.a.isEmpty()) {
unmodifiableMap2 = Collections.emptyMap();
} else {
unmodifiableMap2 = Collections.unmodifiableMap(this.a);
}
this.a = unmodifiableMap2;
this.c = true;
}
@Override // java.util.AbstractMap, java.util.Map
public int size() {
return this.e.size() + this.b.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 b(comparable) >= 0 || this.b.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 b = b(comparable);
if (b >= 0) {
return this.e.get(b).getValue();
}
return this.b.get(comparable);
}
@Override // java.util.AbstractMap, java.util.Map
/* renamed from: e, reason: merged with bridge method [inline-methods] */
public final V put(K k, V v) {
if (!this.c) {
int b = b(k);
if (b >= 0) {
return this.e.get(b).setValue(v);
}
e();
int i = -(b + 1);
if (i >= this.i) {
return b().put(k, v);
}
int size = this.e.size();
int i2 = this.i;
if (size == i2) {
rqb<K, V>.RVV remove = this.e.remove(i2 - 1);
b().put(remove.b, remove.getValue());
}
this.e.add(i, new RVV(this, k, v));
return null;
}
throw new UnsupportedOperationException();
}
@Override // java.util.AbstractMap, java.util.Map
public void clear() {
if (!this.c) {
if (!this.e.isEmpty()) {
this.e.clear();
}
if (this.b.isEmpty()) {
return;
}
this.b.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.c) {
Comparable comparable = (Comparable) obj;
int b = b(comparable);
if (b >= 0) {
return (V) c(b);
}
if (this.b.isEmpty()) {
return null;
}
return this.b.remove(comparable);
}
throw new UnsupportedOperationException();
}
final V c(int i) {
if (!this.c) {
V value = this.e.remove(i).getValue();
if (!this.b.isEmpty()) {
Iterator<Map.Entry<K, V>> it = b().entrySet().iterator();
this.e.add(new RVV(this, it.next()));
it.remove();
}
return value;
}
throw new UnsupportedOperationException();
}
private int b(K k) {
int size = this.e.size();
int i = size - 1;
if (i >= 0) {
int compareTo = k.compareTo(this.e.get(i).b);
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.e.get(i2).b);
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.h == null) {
this.h = new jbe(this, (byte) 0);
}
return this.h;
}
private SortedMap<K, V> b() {
if (!this.c) {
if (this.b.isEmpty() && !(this.b instanceof TreeMap)) {
TreeMap treeMap = new TreeMap();
this.b = treeMap;
this.a = treeMap.descendingMap();
}
return (SortedMap) this.b;
}
throw new UnsupportedOperationException();
}
private void e() {
if (!this.c) {
if (!this.e.isEmpty() || (this.e instanceof ArrayList)) {
return;
}
this.e = new ArrayList(this.i);
return;
}
throw new UnsupportedOperationException();
}
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes2.dex */
public class RVV implements Map.Entry<K, V>, Comparable<rqb<K, V>.RVV> {
final K b;
private V c;
private rqb d;
@Override // java.lang.Comparable
public final /* bridge */ /* synthetic */ int compareTo(Object obj) {
return this.b.compareTo(((RVV) obj).b);
}
RVV(rqb rqbVar, Map.Entry<K, V> entry) {
this(rqbVar, entry.getKey(), entry.getValue());
}
RVV(rqb rqbVar, K k, V v) {
this.d = rqbVar;
this.b = 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.b;
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.b;
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.b);
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.b;
}
@Override // java.util.Map.Entry
public final V setValue(V v) {
if (!this.d.c) {
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 jbe extends AbstractSet<Map.Entry<K, V>> {
private rqb d;
private jbe(rqb rqbVar) {
this.d = rqbVar;
}
/* synthetic */ jbe(rqb rqbVar, byte b) {
this(rqbVar);
}
/* 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.d.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 Sts(this.d, (byte) 0);
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public int size() {
return this.d.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.d.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.d.remove(entry.getKey());
return true;
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public void clear() {
this.d.clear();
}
}
/* loaded from: classes2.dex */
class LWm extends jbe {
private rqb e;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
private LWm(rqb rqbVar) {
super(rqbVar, (byte) 0);
this.e = rqbVar;
}
/* JADX INFO: Access modifiers changed from: package-private */
public /* synthetic */ LWm(rqb rqbVar, byte b) {
this(rqbVar);
}
@Override // o.rqb.jbe, java.util.AbstractCollection, java.util.Collection, java.lang.Iterable, java.util.Set
public final Iterator<Map.Entry<K, V>> iterator() {
return new IeS(this.e, (byte) 0);
}
}
/* loaded from: classes2.dex */
class Sts implements Iterator<Map.Entry<K, V>> {
private int a;
private rqb b;
private boolean c;
private Iterator<Map.Entry<K, V>> d;
private Sts(rqb rqbVar) {
this.b = rqbVar;
this.a = -1;
}
/* synthetic */ Sts(rqb rqbVar, byte b) {
this(rqbVar);
}
@Override // java.util.Iterator
public final /* synthetic */ Object next() {
this.c = true;
int i = this.a + 1;
this.a = i;
if (i < this.b.e.size()) {
return this.b.e.get(this.a);
}
return b().next();
}
private Iterator<Map.Entry<K, V>> b() {
if (this.d == null) {
this.d = this.b.b.entrySet().iterator();
}
return this.d;
}
@Override // java.util.Iterator
public final boolean hasNext() {
if (this.a + 1 >= this.b.e.size()) {
return !this.b.b.isEmpty() && b().hasNext();
}
return true;
}
@Override // java.util.Iterator
public final void remove() {
if (!this.c) {
throw new IllegalStateException("remove() was called before next()");
}
this.c = false;
if (!this.b.c) {
if (this.a >= this.b.e.size()) {
b().remove();
return;
}
rqb rqbVar = this.b;
int i = this.a;
this.a = i - 1;
rqbVar.c(i);
return;
}
throw new UnsupportedOperationException();
}
}
/* loaded from: classes2.dex */
class IeS implements Iterator<Map.Entry<K, V>> {
private Iterator<Map.Entry<K, V>> a;
private int c;
private rqb d;
private IeS(rqb rqbVar) {
this.d = rqbVar;
this.c = rqbVar.e.size();
}
/* synthetic */ IeS(rqb rqbVar, byte b) {
this(rqbVar);
}
@Override // java.util.Iterator
public final void remove() {
throw new UnsupportedOperationException();
}
private Iterator<Map.Entry<K, V>> d() {
if (this.a == null) {
this.a = this.d.a.entrySet().iterator();
}
return this.a;
}
@Override // java.util.Iterator
public final boolean hasNext() {
int i = this.c;
return (i > 0 && i <= this.d.e.size()) || d().hasNext();
}
@Override // java.util.Iterator
public final /* synthetic */ Object next() {
if (d().hasNext()) {
return d().next();
}
List<rqb<K, V>.RVV> list = this.d.e;
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 rqb)) {
return super.equals(obj);
}
rqb rqbVar = (rqb) obj;
int size = size();
if (size != rqbVar.size()) {
return false;
}
int size2 = this.e.size();
if (size2 != rqbVar.e.size()) {
return entrySet().equals(rqbVar.entrySet());
}
for (int i = 0; i < size2; i++) {
if (!this.e.get(i).equals(rqbVar.e.get(i))) {
return false;
}
}
if (size2 != size) {
return this.b.equals(rqbVar.b);
}
return true;
}
@Override // java.util.AbstractMap, java.util.Map
public int hashCode() {
int size = this.e.size();
int i = 0;
for (int i2 = 0; i2 < size; i2++) {
i += this.e.get(i2).hashCode();
}
return this.b.size() > 0 ? i + this.b.hashCode() : i;
}
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes2.dex */
public static class HBt {
private static final Iterator<Object> c = new Iterator<Object>() { // from class: o.rqb.HBt.3
@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> e = new Iterable<Object>() { // from class: o.rqb.HBt.5
@Override // java.lang.Iterable
public final Iterator<Object> iterator() {
return HBt.c;
}
};
/* JADX INFO: Access modifiers changed from: package-private */
public static <T> Iterable<T> c() {
return (Iterable<T>) e;
}
}
}