what-the-bank/sources/com/google/firebase/firestore/remote/WatchChange.java

193 lines
7.0 KiB
Java

package com.google.firebase.firestore.remote;
import com.airbnb.deeplinkdispatch.UrlTreeKt;
import com.google.firebase.firestore.model.DocumentKey;
import com.google.firebase.firestore.model.MutableDocument;
import com.google.firebase.firestore.util.Assert;
import io.grpc.Status;
import java.util.List;
import o.QwV;
/* loaded from: classes2.dex */
public abstract class WatchChange {
/* loaded from: classes2.dex */
public enum WatchTargetChangeType {
NoChange,
Added,
Removed,
Current,
Reset
}
private WatchChange() {
}
/* loaded from: classes2.dex */
public static final class DocumentChange extends WatchChange {
private final DocumentKey documentKey;
private final MutableDocument newDocument;
private final List<Integer> removedTargetIds;
private final List<Integer> updatedTargetIds;
public DocumentChange(List<Integer> list, List<Integer> list2, DocumentKey documentKey, MutableDocument mutableDocument) {
super();
this.updatedTargetIds = list;
this.removedTargetIds = list2;
this.documentKey = documentKey;
this.newDocument = mutableDocument;
}
public final String toString() {
StringBuilder sb = new StringBuilder("DocumentChange{updatedTargetIds=");
sb.append(this.updatedTargetIds);
sb.append(", removedTargetIds=");
sb.append(this.removedTargetIds);
sb.append(", key=");
sb.append(this.documentKey);
sb.append(", newDocument=");
sb.append(this.newDocument);
sb.append(UrlTreeKt.componentParamSuffixChar);
return sb.toString();
}
public final boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null || getClass() != obj.getClass()) {
return false;
}
DocumentChange documentChange = (DocumentChange) obj;
if (!this.updatedTargetIds.equals(documentChange.updatedTargetIds) || !this.removedTargetIds.equals(documentChange.removedTargetIds) || !this.documentKey.equals(documentChange.documentKey)) {
return false;
}
MutableDocument mutableDocument = this.newDocument;
MutableDocument mutableDocument2 = documentChange.newDocument;
return mutableDocument != null ? mutableDocument.equals(mutableDocument2) : mutableDocument2 == null;
}
public final int hashCode() {
int hashCode = this.updatedTargetIds.hashCode();
int hashCode2 = this.removedTargetIds.hashCode();
int hashCode3 = this.documentKey.hashCode();
MutableDocument mutableDocument = this.newDocument;
return (((((hashCode * 31) + hashCode2) * 31) + hashCode3) * 31) + (mutableDocument != null ? mutableDocument.hashCode() : 0);
}
public final List<Integer> getUpdatedTargetIds() {
return this.updatedTargetIds;
}
public final List<Integer> getRemovedTargetIds() {
return this.removedTargetIds;
}
public final MutableDocument getNewDocument() {
return this.newDocument;
}
public final DocumentKey getDocumentKey() {
return this.documentKey;
}
}
/* loaded from: classes2.dex */
public static final class ExistenceFilterWatchChange extends WatchChange {
private final ExistenceFilter existenceFilter;
private final int targetId;
public ExistenceFilterWatchChange(int i, ExistenceFilter existenceFilter) {
super();
this.targetId = i;
this.existenceFilter = existenceFilter;
}
public final String toString() {
StringBuilder sb = new StringBuilder("ExistenceFilterWatchChange{targetId=");
sb.append(this.targetId);
sb.append(", existenceFilter=");
sb.append(this.existenceFilter);
sb.append(UrlTreeKt.componentParamSuffixChar);
return sb.toString();
}
public final int getTargetId() {
return this.targetId;
}
public final ExistenceFilter getExistenceFilter() {
return this.existenceFilter;
}
}
/* loaded from: classes2.dex */
public static final class WatchTargetChange extends WatchChange {
private final Status cause;
private final WatchTargetChangeType changeType;
private final QwV resumeToken;
private final List<Integer> targetIds;
public WatchTargetChange(WatchTargetChangeType watchTargetChangeType, List<Integer> list, QwV qwV, Status status) {
super();
Assert.hardAssert(status == null || watchTargetChangeType == WatchTargetChangeType.Removed, "Got cause for a target change that was not a removal", new Object[0]);
this.changeType = watchTargetChangeType;
this.targetIds = list;
this.resumeToken = qwV;
if (status == null || status.isOk()) {
this.cause = null;
} else {
this.cause = status;
}
}
public final String toString() {
StringBuilder sb = new StringBuilder("WatchTargetChange{changeType=");
sb.append(this.changeType);
sb.append(", targetIds=");
sb.append(this.targetIds);
sb.append(UrlTreeKt.componentParamSuffixChar);
return sb.toString();
}
public final boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null || getClass() != obj.getClass()) {
return false;
}
WatchTargetChange watchTargetChange = (WatchTargetChange) obj;
if (this.changeType != watchTargetChange.changeType || !this.targetIds.equals(watchTargetChange.targetIds) || !this.resumeToken.equals(watchTargetChange.resumeToken)) {
return false;
}
Status status = this.cause;
return status != null ? watchTargetChange.cause != null && status.getCode().equals(watchTargetChange.cause.getCode()) : watchTargetChange.cause == null;
}
public final int hashCode() {
int hashCode = this.changeType.hashCode();
int hashCode2 = this.targetIds.hashCode();
int hashCode3 = this.resumeToken.hashCode();
Status status = this.cause;
return (((((hashCode * 31) + hashCode2) * 31) + hashCode3) * 31) + (status != null ? status.getCode().hashCode() : 0);
}
public final List<Integer> getTargetIds() {
return this.targetIds;
}
public final QwV getResumeToken() {
return this.resumeToken;
}
public final WatchTargetChangeType getChangeType() {
return this.changeType;
}
public final Status getCause() {
return this.cause;
}
}
}