mirror of
https://github.com/Pinball3D/Rabbit-R1.git
synced 2024-12-27 17:42:33 -06:00
150 lines
4.5 KiB
Java
150 lines
4.5 KiB
Java
package com.google.common.collect;
|
|
|
|
import io.flutter.embedding.android.KeyboardMap;
|
|
import java.util.Arrays;
|
|
|
|
@ElementTypesAreNonnullByDefault
|
|
/* loaded from: classes3.dex */
|
|
class ObjectCountLinkedHashMap<K> extends ObjectCountHashMap<K> {
|
|
private static final int ENDPOINT = -2;
|
|
private transient int firstEntry;
|
|
private transient int lastEntry;
|
|
transient long[] links;
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
@Override // com.google.common.collect.ObjectCountHashMap
|
|
public int firstIndex() {
|
|
int i = this.firstEntry;
|
|
if (i == -2) {
|
|
return -1;
|
|
}
|
|
return i;
|
|
}
|
|
|
|
static <K> ObjectCountLinkedHashMap<K> create() {
|
|
return new ObjectCountLinkedHashMap<>();
|
|
}
|
|
|
|
static <K> ObjectCountLinkedHashMap<K> createWithExpectedSize(int i) {
|
|
return new ObjectCountLinkedHashMap<>(i);
|
|
}
|
|
|
|
ObjectCountLinkedHashMap() {
|
|
this(3);
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
public ObjectCountLinkedHashMap(int i) {
|
|
this(i, 1.0f);
|
|
}
|
|
|
|
ObjectCountLinkedHashMap(int i, float f) {
|
|
super(i, f);
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
public ObjectCountLinkedHashMap(ObjectCountHashMap<K> objectCountHashMap) {
|
|
init(objectCountHashMap.size(), 1.0f);
|
|
int firstIndex = objectCountHashMap.firstIndex();
|
|
while (firstIndex != -1) {
|
|
put(objectCountHashMap.getKey(firstIndex), objectCountHashMap.getValue(firstIndex));
|
|
firstIndex = objectCountHashMap.nextIndex(firstIndex);
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
@Override // com.google.common.collect.ObjectCountHashMap
|
|
public void init(int i, float f) {
|
|
super.init(i, f);
|
|
this.firstEntry = -2;
|
|
this.lastEntry = -2;
|
|
long[] jArr = new long[i];
|
|
this.links = jArr;
|
|
Arrays.fill(jArr, -1L);
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
@Override // com.google.common.collect.ObjectCountHashMap
|
|
public int nextIndex(int i) {
|
|
int successor = getSuccessor(i);
|
|
if (successor == -2) {
|
|
return -1;
|
|
}
|
|
return successor;
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
@Override // com.google.common.collect.ObjectCountHashMap
|
|
public int nextIndexAfterRemove(int i, int i2) {
|
|
return i == size() ? i2 : i;
|
|
}
|
|
|
|
private int getPredecessor(int i) {
|
|
return (int) (this.links[i] >>> 32);
|
|
}
|
|
|
|
private int getSuccessor(int i) {
|
|
return (int) this.links[i];
|
|
}
|
|
|
|
private void setSuccessor(int i, int i2) {
|
|
long[] jArr = this.links;
|
|
jArr[i] = (jArr[i] & (-4294967296L)) | (i2 & KeyboardMap.kValueMask);
|
|
}
|
|
|
|
private void setPredecessor(int i, int i2) {
|
|
long[] jArr = this.links;
|
|
jArr[i] = (jArr[i] & KeyboardMap.kValueMask) | (i2 << 32);
|
|
}
|
|
|
|
private void setSucceeds(int i, int i2) {
|
|
if (i == -2) {
|
|
this.firstEntry = i2;
|
|
} else {
|
|
setSuccessor(i, i2);
|
|
}
|
|
if (i2 == -2) {
|
|
this.lastEntry = i;
|
|
} else {
|
|
setPredecessor(i2, i);
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
@Override // com.google.common.collect.ObjectCountHashMap
|
|
public void insertEntry(int i, @ParametricNullness K k, int i2, int i3) {
|
|
super.insertEntry(i, k, i2, i3);
|
|
setSucceeds(this.lastEntry, i);
|
|
setSucceeds(i, -2);
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
@Override // com.google.common.collect.ObjectCountHashMap
|
|
public void moveLastEntry(int i) {
|
|
int size = size() - 1;
|
|
setSucceeds(getPredecessor(i), getSuccessor(i));
|
|
if (i < size) {
|
|
setSucceeds(getPredecessor(size), i);
|
|
setSucceeds(i, getSuccessor(size));
|
|
}
|
|
super.moveLastEntry(i);
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
@Override // com.google.common.collect.ObjectCountHashMap
|
|
public void resizeEntries(int i) {
|
|
super.resizeEntries(i);
|
|
long[] jArr = this.links;
|
|
int length = jArr.length;
|
|
long[] copyOf = Arrays.copyOf(jArr, i);
|
|
this.links = copyOf;
|
|
Arrays.fill(copyOf, length, i, -1L);
|
|
}
|
|
|
|
@Override // com.google.common.collect.ObjectCountHashMap
|
|
public void clear() {
|
|
super.clear();
|
|
this.firstEntry = -2;
|
|
this.lastEntry = -2;
|
|
}
|
|
}
|