151 lines
4.1 KiB
Java
151 lines
4.1 KiB
Java
package gnu.trove;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public abstract class TByteHash extends TPrimitiveHash implements TByteHashingStrategy {
|
|
protected final TByteHashingStrategy _hashingStrategy;
|
|
protected transient byte[] _set;
|
|
|
|
public TByteHash() {
|
|
this._hashingStrategy = this;
|
|
}
|
|
|
|
@Override // gnu.trove.TPrimitiveHash, gnu.trove.THash
|
|
public Object clone() {
|
|
TByteHash tByteHash = (TByteHash) super.clone();
|
|
byte[] bArr = this._set;
|
|
tByteHash._set = bArr == null ? null : (byte[]) bArr.clone();
|
|
return tByteHash;
|
|
}
|
|
|
|
@Override // gnu.trove.TByteHashingStrategy
|
|
public final int computeHashCode(byte b) {
|
|
HashFunctions.a((int) b);
|
|
return b;
|
|
}
|
|
|
|
public boolean contains(byte b) {
|
|
return index(b) >= 0;
|
|
}
|
|
|
|
public boolean forEach(TByteProcedure tByteProcedure) {
|
|
byte[] bArr = this._states;
|
|
byte[] bArr2 = this._set;
|
|
if (bArr != null) {
|
|
int length = bArr.length;
|
|
while (true) {
|
|
int i = length - 1;
|
|
if (length <= 0) {
|
|
break;
|
|
}
|
|
if (bArr[i] == 1 && !tByteProcedure.a(bArr2[i])) {
|
|
return false;
|
|
}
|
|
length = i;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
protected int index(byte b) {
|
|
byte[] bArr = this._states;
|
|
if (bArr == null) {
|
|
return -1;
|
|
}
|
|
byte[] bArr2 = this._set;
|
|
int length = bArr.length;
|
|
int computeHashCode = this._hashingStrategy.computeHashCode(b) & Integer.MAX_VALUE;
|
|
int i = computeHashCode % length;
|
|
if (bArr[i] != 0 && (bArr[i] == 2 || bArr2[i] != b)) {
|
|
int i2 = (computeHashCode % (length - 2)) + 1;
|
|
while (true) {
|
|
i -= i2;
|
|
if (i < 0) {
|
|
i += length;
|
|
}
|
|
if (bArr[i] == 0 || (bArr[i] != 2 && bArr2[i] == b)) {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
if (bArr[i] == 0) {
|
|
return -1;
|
|
}
|
|
return i;
|
|
}
|
|
|
|
protected int insertionIndex(byte b) {
|
|
if (this._set == null) {
|
|
setUp(6);
|
|
}
|
|
byte[] bArr = this._states;
|
|
byte[] bArr2 = this._set;
|
|
int length = bArr.length;
|
|
int computeHashCode = this._hashingStrategy.computeHashCode(b) & Integer.MAX_VALUE;
|
|
int i = computeHashCode % length;
|
|
if (bArr[i] == 0) {
|
|
return i;
|
|
}
|
|
if (bArr[i] == 1 && bArr2[i] == b) {
|
|
return (-i) - 1;
|
|
}
|
|
int i2 = (computeHashCode % (length - 2)) + 1;
|
|
do {
|
|
i -= i2;
|
|
if (i < 0) {
|
|
i += length;
|
|
}
|
|
if (bArr[i] != 1) {
|
|
break;
|
|
}
|
|
} while (bArr2[i] != b);
|
|
if (bArr[i] != 2) {
|
|
return bArr[i] == 1 ? (-i) - 1 : i;
|
|
}
|
|
int i3 = i;
|
|
while (bArr[i3] != 0 && (bArr[i3] == 2 || bArr2[i3] != b)) {
|
|
i3 -= i2;
|
|
if (i3 < 0) {
|
|
i3 += length;
|
|
}
|
|
}
|
|
return bArr[i3] == 1 ? (-i3) - 1 : i;
|
|
}
|
|
|
|
@Override // gnu.trove.TPrimitiveHash, gnu.trove.THash
|
|
protected void removeAt(int i) {
|
|
this._set[i] = 0;
|
|
super.removeAt(i);
|
|
}
|
|
|
|
@Override // gnu.trove.TPrimitiveHash, gnu.trove.THash
|
|
protected int setUp(int i) {
|
|
int up = super.setUp(i);
|
|
this._set = i == -1 ? null : new byte[up];
|
|
return up;
|
|
}
|
|
|
|
public TByteHash(int i) {
|
|
super(i);
|
|
this._hashingStrategy = this;
|
|
}
|
|
|
|
public TByteHash(int i, float f) {
|
|
super(i, f);
|
|
this._hashingStrategy = this;
|
|
}
|
|
|
|
public TByteHash(TByteHashingStrategy tByteHashingStrategy) {
|
|
this._hashingStrategy = tByteHashingStrategy;
|
|
}
|
|
|
|
public TByteHash(int i, TByteHashingStrategy tByteHashingStrategy) {
|
|
super(i);
|
|
this._hashingStrategy = tByteHashingStrategy;
|
|
}
|
|
|
|
public TByteHash(int i, float f, TByteHashingStrategy tByteHashingStrategy) {
|
|
super(i, f);
|
|
this._hashingStrategy = tByteHashingStrategy;
|
|
}
|
|
}
|