64 lines
1.6 KiB
Java
64 lines
1.6 KiB
Java
|
package o;
|
||
|
|
||
|
import java.util.HashMap;
|
||
|
import java.util.Map;
|
||
|
|
||
|
/* loaded from: classes.dex */
|
||
|
public final class OBC<T> {
|
||
|
public final IeS<T> b = new IeS<>();
|
||
|
public int e;
|
||
|
|
||
|
/* loaded from: classes.dex */
|
||
|
public static class IeS<T> {
|
||
|
final Map<Byte, IeS<T>> c = new HashMap();
|
||
|
public T b = null;
|
||
|
|
||
|
IeS() {
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public final T b(byte[] bArr, int i, int i2) {
|
||
|
if (i2 > bArr.length) {
|
||
|
throw new IndexOutOfBoundsException();
|
||
|
}
|
||
|
IeS<T> ieS = this.b;
|
||
|
T t = ieS.b;
|
||
|
while (i < i2) {
|
||
|
ieS = ieS.c.get(Byte.valueOf(bArr[i]));
|
||
|
if (ieS == null) {
|
||
|
break;
|
||
|
}
|
||
|
if (ieS.b != null) {
|
||
|
t = ieS.b;
|
||
|
}
|
||
|
i++;
|
||
|
}
|
||
|
return t;
|
||
|
}
|
||
|
|
||
|
public final void d(T t, byte[]... bArr) {
|
||
|
IeS<T> ieS = this.b;
|
||
|
int i = 0;
|
||
|
for (byte[] bArr2 : bArr) {
|
||
|
for (byte b : bArr2) {
|
||
|
IeS<T> ieS2 = ieS.c.get(Byte.valueOf(b));
|
||
|
if (ieS2 == null) {
|
||
|
ieS2 = new IeS<>();
|
||
|
ieS.c.put(Byte.valueOf(b), ieS2);
|
||
|
}
|
||
|
ieS = ieS2;
|
||
|
i++;
|
||
|
}
|
||
|
}
|
||
|
if (i == 0) {
|
||
|
throw new IllegalArgumentException("Parts must contain at least one byte.");
|
||
|
}
|
||
|
if (ieS.b == null) {
|
||
|
ieS.b = t;
|
||
|
this.e = Math.max(this.e, i);
|
||
|
return;
|
||
|
}
|
||
|
throw new RuntimeException("Value already set for this trie node");
|
||
|
}
|
||
|
}
|