309 lines
8.4 KiB
Java
309 lines
8.4 KiB
Java
|
package com.google.android.gms.internal.firebase_ml;
|
||
|
|
||
|
import java.util.AbstractMap;
|
||
|
import java.util.AbstractSet;
|
||
|
import java.util.Iterator;
|
||
|
import java.util.Map;
|
||
|
import java.util.NoSuchElementException;
|
||
|
import java.util.Set;
|
||
|
|
||
|
/* loaded from: classes2.dex */
|
||
|
public class zzgx<K, V> extends AbstractMap<K, V> implements Cloneable {
|
||
|
int size;
|
||
|
private Object[] zzya;
|
||
|
|
||
|
/* loaded from: classes2.dex */
|
||
|
final class zzb implements Iterator<Map.Entry<K, V>> {
|
||
|
private final zzgx zzyb;
|
||
|
private boolean zzyc;
|
||
|
private int zzyd;
|
||
|
|
||
|
zzb(zzgx zzgxVar) {
|
||
|
this.zzyb = zzgxVar;
|
||
|
}
|
||
|
|
||
|
@Override // java.util.Iterator
|
||
|
public final boolean hasNext() {
|
||
|
return this.zzyd < this.zzyb.size;
|
||
|
}
|
||
|
|
||
|
@Override // java.util.Iterator
|
||
|
public final void remove() {
|
||
|
int i = this.zzyd - 1;
|
||
|
if (this.zzyc || i < 0) {
|
||
|
throw new IllegalArgumentException();
|
||
|
}
|
||
|
this.zzyb.remove(i);
|
||
|
this.zzyd--;
|
||
|
this.zzyc = true;
|
||
|
}
|
||
|
|
||
|
@Override // java.util.Iterator
|
||
|
public final /* synthetic */ Object next() {
|
||
|
int i = this.zzyd;
|
||
|
if (i == this.zzyb.size) {
|
||
|
throw new NoSuchElementException();
|
||
|
}
|
||
|
this.zzyd++;
|
||
|
this.zzyc = false;
|
||
|
return new zza(this.zzyb, i);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* loaded from: classes2.dex */
|
||
|
final class zzc extends AbstractSet<Map.Entry<K, V>> {
|
||
|
private final zzgx zzyb;
|
||
|
|
||
|
zzc(zzgx zzgxVar) {
|
||
|
this.zzyb = zzgxVar;
|
||
|
}
|
||
|
|
||
|
@Override // java.util.AbstractCollection, java.util.Collection, java.lang.Iterable, java.util.Set
|
||
|
public final Iterator<Map.Entry<K, V>> iterator() {
|
||
|
return new zzb(this.zzyb);
|
||
|
}
|
||
|
|
||
|
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
|
||
|
public final int size() {
|
||
|
return this.zzyb.size;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* loaded from: classes2.dex */
|
||
|
final class zza implements Map.Entry<K, V> {
|
||
|
private int index;
|
||
|
private final zzgx zzyb;
|
||
|
|
||
|
zza(zzgx zzgxVar, int i) {
|
||
|
this.zzyb = zzgxVar;
|
||
|
this.index = i;
|
||
|
}
|
||
|
|
||
|
@Override // java.util.Map.Entry
|
||
|
public final K getKey() {
|
||
|
return (K) this.zzyb.zzae(this.index);
|
||
|
}
|
||
|
|
||
|
@Override // java.util.Map.Entry
|
||
|
public final V getValue() {
|
||
|
return (V) this.zzyb.zzaf(this.index);
|
||
|
}
|
||
|
|
||
|
@Override // java.util.Map.Entry
|
||
|
public final V setValue(V v) {
|
||
|
return (V) this.zzyb.set(this.index, v);
|
||
|
}
|
||
|
|
||
|
@Override // java.util.Map.Entry
|
||
|
public final int hashCode() {
|
||
|
Object key = getKey();
|
||
|
Object value = getValue();
|
||
|
return (key != null ? key.hashCode() : 0) ^ (value != null ? value.hashCode() : 0);
|
||
|
}
|
||
|
|
||
|
@Override // java.util.Map.Entry
|
||
|
public final boolean equals(Object obj) {
|
||
|
if (this == obj) {
|
||
|
return true;
|
||
|
}
|
||
|
if (!(obj instanceof Map.Entry)) {
|
||
|
return false;
|
||
|
}
|
||
|
Map.Entry entry = (Map.Entry) obj;
|
||
|
return zzkn.equal(getKey(), entry.getKey()) && zzkn.equal(getValue(), entry.getValue());
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public final K zzae(int i) {
|
||
|
if (i < 0 || i >= this.size) {
|
||
|
return null;
|
||
|
}
|
||
|
return (K) this.zzya[i << 1];
|
||
|
}
|
||
|
|
||
|
public final V zzaf(int i) {
|
||
|
if (i < 0 || i >= this.size) {
|
||
|
return null;
|
||
|
}
|
||
|
return zzag((i << 1) + 1);
|
||
|
}
|
||
|
|
||
|
public final V set(int i, V v) {
|
||
|
int i2 = this.size;
|
||
|
if (i < 0 || i >= i2) {
|
||
|
throw new IndexOutOfBoundsException();
|
||
|
}
|
||
|
int i3 = (i << 1) + 1;
|
||
|
V zzag = zzag(i3);
|
||
|
this.zzya[i3] = v;
|
||
|
return zzag;
|
||
|
}
|
||
|
|
||
|
public final V remove(int i) {
|
||
|
return zzah(i << 1);
|
||
|
}
|
||
|
|
||
|
@Override // java.util.AbstractMap, java.util.Map
|
||
|
public final boolean containsKey(Object obj) {
|
||
|
return -2 != zze(obj);
|
||
|
}
|
||
|
|
||
|
@Override // java.util.AbstractMap, java.util.Map
|
||
|
public final V get(Object obj) {
|
||
|
return zzag(zze(obj) + 1);
|
||
|
}
|
||
|
|
||
|
@Override // java.util.AbstractMap, java.util.Map
|
||
|
public final V put(K k, V v) {
|
||
|
int zze = zze(k) >> 1;
|
||
|
if (zze == -1) {
|
||
|
zze = this.size;
|
||
|
}
|
||
|
if (zze < 0) {
|
||
|
throw new IndexOutOfBoundsException();
|
||
|
}
|
||
|
int i = zze + 1;
|
||
|
if (i < 0) {
|
||
|
throw new IndexOutOfBoundsException();
|
||
|
}
|
||
|
Object[] objArr = this.zzya;
|
||
|
int i2 = i << 1;
|
||
|
int length = objArr == null ? 0 : objArr.length;
|
||
|
if (i2 > length) {
|
||
|
int i3 = (length / 2) * 3;
|
||
|
int i4 = i3 + 1;
|
||
|
if (i4 % 2 != 0) {
|
||
|
i4 = i3 + 2;
|
||
|
}
|
||
|
if (i4 >= i2) {
|
||
|
i2 = i4;
|
||
|
}
|
||
|
if (i2 == 0) {
|
||
|
this.zzya = null;
|
||
|
} else {
|
||
|
int i5 = this.size;
|
||
|
if (i5 == 0 || i2 != objArr.length) {
|
||
|
Object[] objArr2 = new Object[i2];
|
||
|
this.zzya = objArr2;
|
||
|
if (i5 != 0) {
|
||
|
System.arraycopy(objArr, 0, objArr2, 0, i5 << 1);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
int i6 = zze << 1;
|
||
|
V zzag = zzag(i6 + 1);
|
||
|
zzb(i6, k, v);
|
||
|
if (i > this.size) {
|
||
|
this.size = i;
|
||
|
}
|
||
|
return zzag;
|
||
|
}
|
||
|
|
||
|
@Override // java.util.AbstractMap, java.util.Map
|
||
|
public final V remove(Object obj) {
|
||
|
return zzah(zze(obj));
|
||
|
}
|
||
|
|
||
|
private final void zzb(int i, K k, V v) {
|
||
|
Object[] objArr = this.zzya;
|
||
|
objArr[i] = k;
|
||
|
objArr[i + 1] = v;
|
||
|
}
|
||
|
|
||
|
private final V zzag(int i) {
|
||
|
if (i < 0) {
|
||
|
return null;
|
||
|
}
|
||
|
return (V) this.zzya[i];
|
||
|
}
|
||
|
|
||
|
private final int zze(Object obj) {
|
||
|
int i = this.size;
|
||
|
Object[] objArr = this.zzya;
|
||
|
for (int i2 = 0; i2 < (i << 1); i2 += 2) {
|
||
|
Object obj2 = objArr[i2];
|
||
|
if (obj == null) {
|
||
|
if (obj2 == null) {
|
||
|
return i2;
|
||
|
}
|
||
|
} else {
|
||
|
if (obj.equals(obj2)) {
|
||
|
return i2;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
return -2;
|
||
|
}
|
||
|
|
||
|
private final V zzah(int i) {
|
||
|
int i2 = this.size << 1;
|
||
|
if (i < 0 || i >= i2) {
|
||
|
return null;
|
||
|
}
|
||
|
V zzag = zzag(i + 1);
|
||
|
Object[] objArr = this.zzya;
|
||
|
int i3 = (i2 - i) - 2;
|
||
|
if (i3 != 0) {
|
||
|
System.arraycopy(objArr, i + 2, objArr, i, i3);
|
||
|
}
|
||
|
this.size--;
|
||
|
zzb(i2 - 2, null, null);
|
||
|
return zzag;
|
||
|
}
|
||
|
|
||
|
@Override // java.util.AbstractMap, java.util.Map
|
||
|
public final boolean containsValue(Object obj) {
|
||
|
int i = this.size;
|
||
|
Object[] objArr = this.zzya;
|
||
|
for (int i2 = 1; i2 < (i << 1); i2 += 2) {
|
||
|
Object obj2 = objArr[i2];
|
||
|
if (obj == null) {
|
||
|
if (obj2 == null) {
|
||
|
return true;
|
||
|
}
|
||
|
} else {
|
||
|
if (obj.equals(obj2)) {
|
||
|
return true;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
@Override // java.util.AbstractMap, java.util.Map
|
||
|
public final Set<Map.Entry<K, V>> entrySet() {
|
||
|
return new zzc(this);
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: private */
|
||
|
@Override // java.util.AbstractMap
|
||
|
/* renamed from: zzgz, reason: merged with bridge method [inline-methods] */
|
||
|
public final zzgx<K, V> clone() {
|
||
|
try {
|
||
|
zzgx<K, V> zzgxVar = (zzgx) super.clone();
|
||
|
Object[] objArr = this.zzya;
|
||
|
if (objArr != null) {
|
||
|
int length = objArr.length;
|
||
|
Object[] objArr2 = new Object[length];
|
||
|
zzgxVar.zzya = objArr2;
|
||
|
System.arraycopy(objArr, 0, objArr2, 0, length);
|
||
|
}
|
||
|
return zzgxVar;
|
||
|
} catch (CloneNotSupportedException unused) {
|
||
|
return null;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // java.util.AbstractMap, java.util.Map
|
||
|
public final int size() {
|
||
|
return this.size;
|
||
|
}
|
||
|
|
||
|
@Override // java.util.AbstractMap, java.util.Map
|
||
|
public void clear() {
|
||
|
this.size = 0;
|
||
|
this.zzya = null;
|
||
|
}
|
||
|
}
|