mirror of
https://github.com/VibedByKaKi/alexandroid.git
synced 2026-11-15 02:17:18 +01:00
186 lines
5.7 KiB
Java
186 lines
5.7 KiB
Java
package io.reactivex.rxjava3.internal.util;
|
|
|
|
import com.amazon.alexa.ra.core.ui.markdown.parser.formatter.MarkdownConstants;
|
|
import io.reactivex.rxjava3.core.Observer;
|
|
import io.reactivex.rxjava3.disposables.Disposable;
|
|
import java.io.Serializable;
|
|
import java.util.Objects;
|
|
import org.reactivestreams.Subscriber;
|
|
import org.reactivestreams.Subscription;
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
/* loaded from: classes10.dex */
|
|
public enum NotificationLite {
|
|
COMPLETE;
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
public static final class DisposableNotification implements Serializable {
|
|
private static final long serialVersionUID = -7482590109178395495L;
|
|
final Disposable upstream;
|
|
|
|
public DisposableNotification(Disposable disposable) {
|
|
this.upstream = disposable;
|
|
}
|
|
|
|
public String toString() {
|
|
return "NotificationLite.Disposable[" + this.upstream + MarkdownConstants.RIGHT_BRACKET;
|
|
}
|
|
}
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
public static final class ErrorNotification implements Serializable {
|
|
private static final long serialVersionUID = -8759979445933046293L;
|
|
final Throwable e;
|
|
|
|
public ErrorNotification(Throwable th) {
|
|
this.e = th;
|
|
}
|
|
|
|
public boolean equals(Object obj) {
|
|
if (obj instanceof ErrorNotification) {
|
|
return Objects.equals(this.e, ((ErrorNotification) obj).e);
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public int hashCode() {
|
|
return this.e.hashCode();
|
|
}
|
|
|
|
public String toString() {
|
|
return "NotificationLite.Error[" + this.e + MarkdownConstants.RIGHT_BRACKET;
|
|
}
|
|
}
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
public static final class SubscriptionNotification implements Serializable {
|
|
private static final long serialVersionUID = -1322257508628817540L;
|
|
final Subscription upstream;
|
|
|
|
public SubscriptionNotification(Subscription subscription) {
|
|
this.upstream = subscription;
|
|
}
|
|
|
|
public String toString() {
|
|
return "NotificationLite.Subscription[" + this.upstream + MarkdownConstants.RIGHT_BRACKET;
|
|
}
|
|
}
|
|
|
|
public static <T> boolean accept(Object obj, Subscriber<? super T> subscriber) {
|
|
if (obj == COMPLETE) {
|
|
subscriber.onComplete();
|
|
return true;
|
|
}
|
|
if (obj instanceof ErrorNotification) {
|
|
subscriber.onError(((ErrorNotification) obj).e);
|
|
return true;
|
|
}
|
|
subscriber.onNext(obj);
|
|
return false;
|
|
}
|
|
|
|
public static <T> boolean acceptFull(Object obj, Subscriber<? super T> subscriber) {
|
|
if (obj == COMPLETE) {
|
|
subscriber.onComplete();
|
|
return true;
|
|
}
|
|
if (obj instanceof ErrorNotification) {
|
|
subscriber.onError(((ErrorNotification) obj).e);
|
|
return true;
|
|
}
|
|
if (obj instanceof SubscriptionNotification) {
|
|
subscriber.onSubscribe(((SubscriptionNotification) obj).upstream);
|
|
return false;
|
|
}
|
|
subscriber.onNext(obj);
|
|
return false;
|
|
}
|
|
|
|
public static Object complete() {
|
|
return COMPLETE;
|
|
}
|
|
|
|
public static Object disposable(Disposable disposable) {
|
|
return new DisposableNotification(disposable);
|
|
}
|
|
|
|
public static Object error(Throwable th) {
|
|
return new ErrorNotification(th);
|
|
}
|
|
|
|
public static Disposable getDisposable(Object obj) {
|
|
return ((DisposableNotification) obj).upstream;
|
|
}
|
|
|
|
public static Throwable getError(Object obj) {
|
|
return ((ErrorNotification) obj).e;
|
|
}
|
|
|
|
public static Subscription getSubscription(Object obj) {
|
|
return ((SubscriptionNotification) obj).upstream;
|
|
}
|
|
|
|
public static boolean isComplete(Object obj) {
|
|
return obj == COMPLETE;
|
|
}
|
|
|
|
public static boolean isDisposable(Object obj) {
|
|
return obj instanceof DisposableNotification;
|
|
}
|
|
|
|
public static boolean isError(Object obj) {
|
|
return obj instanceof ErrorNotification;
|
|
}
|
|
|
|
public static boolean isSubscription(Object obj) {
|
|
return obj instanceof SubscriptionNotification;
|
|
}
|
|
|
|
public static Object subscription(Subscription subscription) {
|
|
return new SubscriptionNotification(subscription);
|
|
}
|
|
|
|
@Override // java.lang.Enum
|
|
public String toString() {
|
|
return "NotificationLite.Complete";
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
public static <T> T getValue(Object obj) {
|
|
return obj;
|
|
}
|
|
|
|
public static <T> Object next(T t) {
|
|
return t;
|
|
}
|
|
|
|
public static <T> boolean accept(Object obj, Observer<? super T> observer) {
|
|
if (obj == COMPLETE) {
|
|
observer.onComplete();
|
|
return true;
|
|
}
|
|
if (obj instanceof ErrorNotification) {
|
|
observer.onError(((ErrorNotification) obj).e);
|
|
return true;
|
|
}
|
|
observer.onNext(obj);
|
|
return false;
|
|
}
|
|
|
|
public static <T> boolean acceptFull(Object obj, Observer<? super T> observer) {
|
|
if (obj == COMPLETE) {
|
|
observer.onComplete();
|
|
return true;
|
|
}
|
|
if (obj instanceof ErrorNotification) {
|
|
observer.onError(((ErrorNotification) obj).e);
|
|
return true;
|
|
}
|
|
if (obj instanceof DisposableNotification) {
|
|
observer.onSubscribe(((DisposableNotification) obj).upstream);
|
|
return false;
|
|
}
|
|
observer.onNext(obj);
|
|
return false;
|
|
}
|
|
}
|