77 lines
2.7 KiB
Java
77 lines
2.7 KiB
Java
|
package com.discord.stores;
|
||
|
|
||
|
import com.discord.stores.updates.ObservationDeck;
|
||
|
import d0.t.r;
|
||
|
import d0.z.d.m;
|
||
|
import java.util.HashSet;
|
||
|
import java.util.Set;
|
||
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
||
|
import kotlin.reflect.KProperty;
|
||
|
/* compiled from: StoreV2.kt */
|
||
|
public abstract class StoreV2 extends Store implements DispatchHandler, ObservationDeck.UpdateSource {
|
||
|
private final Set<ObservationDeck.UpdateSource> updateSources = new HashSet();
|
||
|
|
||
|
/* compiled from: StoreV2.kt */
|
||
|
public static final class MarkChangedDelegate<T> {
|
||
|
private final ObservationDeck.UpdateSource overrideUpdateSource;
|
||
|
private T value;
|
||
|
|
||
|
public MarkChangedDelegate(T t, ObservationDeck.UpdateSource updateSource) {
|
||
|
this.value = t;
|
||
|
this.overrideUpdateSource = updateSource;
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: this call moved to the top of the method (can break code semantics) */
|
||
|
public /* synthetic */ MarkChangedDelegate(Object obj, ObservationDeck.UpdateSource updateSource, int i, DefaultConstructorMarker defaultConstructorMarker) {
|
||
|
this(obj, (i & 2) != 0 ? null : updateSource);
|
||
|
}
|
||
|
|
||
|
public final T getValue(StoreV2 storeV2, KProperty<?> kProperty) {
|
||
|
m.checkNotNullParameter(kProperty, "property");
|
||
|
return this.value;
|
||
|
}
|
||
|
|
||
|
public final void setValue(StoreV2 storeV2, KProperty<?> kProperty, T t) {
|
||
|
m.checkNotNullParameter(kProperty, "property");
|
||
|
if (!m.areEqual(this.value, t)) {
|
||
|
this.value = t;
|
||
|
ObservationDeck.UpdateSource updateSource = this.overrideUpdateSource;
|
||
|
if (updateSource != null) {
|
||
|
if (storeV2 != null) {
|
||
|
storeV2.markChanged(updateSource);
|
||
|
}
|
||
|
} else if (storeV2 != null) {
|
||
|
storeV2.markChanged();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public final Set<ObservationDeck.UpdateSource> getUpdateSources() {
|
||
|
return this.updateSources;
|
||
|
}
|
||
|
|
||
|
public final void markChanged() {
|
||
|
this.updateSources.add(this);
|
||
|
}
|
||
|
|
||
|
public final void markChanged(ObservationDeck.UpdateSource... updateSourceArr) {
|
||
|
m.checkNotNullParameter(updateSourceArr, "updates");
|
||
|
markChanged();
|
||
|
r.addAll(this.updateSources, updateSourceArr);
|
||
|
}
|
||
|
|
||
|
public final void markUnchanged(ObservationDeck.UpdateSource updateSource) {
|
||
|
m.checkNotNullParameter(updateSource, "updateSource");
|
||
|
this.updateSources.remove(updateSource);
|
||
|
}
|
||
|
|
||
|
@Override // com.discord.stores.DispatchHandler
|
||
|
public void onDispatchEnded() {
|
||
|
this.updateSources.clear();
|
||
|
}
|
||
|
|
||
|
public void snapshotData() {
|
||
|
}
|
||
|
}
|