Files
rr3-apk/decompiled-community/sources/kotlin/coroutines/CombinedContext.java
Daniel Elliott c080f0d97f Add Discord community version (64-bit only)
- Added realracing3-community.apk (71.57 MB)
- Removed 32-bit support (armeabi-v7a)
- Only includes arm64-v8a libraries
- Decompiled source code included
- Added README-community.md with analysis
2026-02-18 15:48:36 -08:00

183 lines
7.0 KiB
Java

package kotlin.coroutines;
import java.io.Serializable;
import kotlin.Unit;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.functions.Function2;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.Ref;
/* loaded from: classes5.dex */
public final class CombinedContext implements CoroutineContext, Serializable {
public final CoroutineContext.Element element;
public final CoroutineContext left;
public CombinedContext(CoroutineContext left, CoroutineContext.Element element) {
Intrinsics.checkNotNullParameter(left, "left");
Intrinsics.checkNotNullParameter(element, "element");
this.left = left;
this.element = element;
}
@Override // kotlin.coroutines.CoroutineContext
public CoroutineContext plus(CoroutineContext coroutineContext) {
return CoroutineContext.DefaultImpls.plus(this, coroutineContext);
}
@Override // kotlin.coroutines.CoroutineContext
public CoroutineContext.Element get(CoroutineContext.Key key) {
Intrinsics.checkNotNullParameter(key, "key");
CombinedContext combinedContext = this;
while (true) {
CoroutineContext.Element element = combinedContext.element.get(key);
if (element != null) {
return element;
}
CoroutineContext coroutineContext = combinedContext.left;
if (coroutineContext instanceof CombinedContext) {
combinedContext = (CombinedContext) coroutineContext;
} else {
return coroutineContext.get(key);
}
}
}
@Override // kotlin.coroutines.CoroutineContext
public Object fold(Object obj, Function2 operation) {
Intrinsics.checkNotNullParameter(operation, "operation");
return operation.invoke(this.left.fold(obj, operation), this.element);
}
@Override // kotlin.coroutines.CoroutineContext
public CoroutineContext minusKey(CoroutineContext.Key key) {
Intrinsics.checkNotNullParameter(key, "key");
if (this.element.get(key) != null) {
return this.left;
}
CoroutineContext minusKey = this.left.minusKey(key);
return minusKey == this.left ? this : minusKey == EmptyCoroutineContext.INSTANCE ? this.element : new CombinedContext(minusKey, this.element);
}
private final int size() {
int i = 2;
CombinedContext combinedContext = this;
while (true) {
CoroutineContext coroutineContext = combinedContext.left;
combinedContext = coroutineContext instanceof CombinedContext ? (CombinedContext) coroutineContext : null;
if (combinedContext == null) {
return i;
}
i++;
}
}
public final boolean contains(CoroutineContext.Element element) {
return Intrinsics.areEqual(get(element.getKey()), element);
}
public final boolean containsAll(CombinedContext combinedContext) {
while (contains(combinedContext.element)) {
CoroutineContext coroutineContext = combinedContext.left;
if (coroutineContext instanceof CombinedContext) {
combinedContext = (CombinedContext) coroutineContext;
} else {
Intrinsics.checkNotNull(coroutineContext, "null cannot be cast to non-null type kotlin.coroutines.CoroutineContext.Element");
return contains((CoroutineContext.Element) coroutineContext);
}
}
return false;
}
public boolean equals(Object obj) {
if (this != obj) {
if (obj instanceof CombinedContext) {
CombinedContext combinedContext = (CombinedContext) obj;
if (combinedContext.size() != size() || !combinedContext.containsAll(this)) {
}
}
return false;
}
return true;
}
public int hashCode() {
return this.left.hashCode() + this.element.hashCode();
}
public String toString() {
return '[' + ((String) fold("", new Function2() { // from class: kotlin.coroutines.CombinedContext$toString$1
@Override // kotlin.jvm.functions.Function2
public final String invoke(String acc, CoroutineContext.Element element) {
Intrinsics.checkNotNullParameter(acc, "acc");
Intrinsics.checkNotNullParameter(element, "element");
if (acc.length() == 0) {
return element.toString();
}
return acc + ", " + element;
}
})) + ']';
}
private final Object writeReplace() {
int size = size();
final CoroutineContext[] coroutineContextArr = new CoroutineContext[size];
final Ref.IntRef intRef = new Ref.IntRef();
fold(Unit.INSTANCE, new Function2() { // from class: kotlin.coroutines.CombinedContext$writeReplace$1
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
{
super(2);
}
@Override // kotlin.jvm.functions.Function2
public /* bridge */ /* synthetic */ Object invoke(Object obj, Object obj2) {
invoke((Unit) obj, (CoroutineContext.Element) obj2);
return Unit.INSTANCE;
}
public final void invoke(Unit unit, CoroutineContext.Element element) {
Intrinsics.checkNotNullParameter(unit, "<anonymous parameter 0>");
Intrinsics.checkNotNullParameter(element, "element");
CoroutineContext[] coroutineContextArr2 = coroutineContextArr;
Ref.IntRef intRef2 = intRef;
int i = intRef2.element;
intRef2.element = i + 1;
coroutineContextArr2[i] = element;
}
});
if (intRef.element != size) {
throw new IllegalStateException("Check failed.".toString());
}
return new Serialized(coroutineContextArr);
}
public static final class Serialized implements Serializable {
public static final Companion Companion = new Companion(null);
private static final long serialVersionUID = 0;
public final CoroutineContext[] elements;
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
public Companion() {
}
}
public Serialized(CoroutineContext[] elements) {
Intrinsics.checkNotNullParameter(elements, "elements");
this.elements = elements;
}
private final Object readResolve() {
CoroutineContext[] coroutineContextArr = this.elements;
CoroutineContext coroutineContext = EmptyCoroutineContext.INSTANCE;
for (CoroutineContext coroutineContext2 : coroutineContextArr) {
coroutineContext = coroutineContext.plus(coroutineContext2);
}
return coroutineContext;
}
}
}