package o; import io.reactivex.rxjava3.exceptions.ProtocolViolationException; import java.util.Objects; import java.util.concurrent.atomic.AtomicReference; /* loaded from: classes6.dex */ public enum fYC implements InterfaceC15337gnm { CANCELLED; @Override // o.InterfaceC15337gnm public final void a() { } @Override // o.InterfaceC15337gnm public final void c(long j) { } public static boolean e(InterfaceC15337gnm interfaceC15337gnm, InterfaceC15337gnm interfaceC15337gnm2) { if (interfaceC15337gnm2 == null) { C13418fZu.c(new NullPointerException("next is null")); return false; } if (interfaceC15337gnm == null) { return true; } interfaceC15337gnm2.a(); C13418fZu.c(new ProtocolViolationException("Subscription already set!")); return false; } public static boolean e(long j) { if (j > 0) { return true; } C13418fZu.c(new IllegalArgumentException("n > 0 required but it was ".concat(String.valueOf(j)))); return false; } public static boolean c(AtomicReference atomicReference, InterfaceC15337gnm interfaceC15337gnm) { Objects.requireNonNull(interfaceC15337gnm, "s is null"); while (!atomicReference.compareAndSet(null, interfaceC15337gnm)) { if (atomicReference.get() != null) { interfaceC15337gnm.a(); if (atomicReference.get() == CANCELLED) { return false; } C13418fZu.c(new ProtocolViolationException("Subscription already set!")); return false; } } return true; } public static boolean c(AtomicReference atomicReference) { InterfaceC15337gnm andSet; InterfaceC15337gnm interfaceC15337gnm = atomicReference.get(); fYC fyc = CANCELLED; if (interfaceC15337gnm == fyc || (andSet = atomicReference.getAndSet(fyc)) == fyc) { return false; } if (andSet == null) { return true; } andSet.a(); return true; } }