Initial commit
This commit is contained in:
25
sources/org/greenrobot/eventbus/AsyncPoster.java
Normal file
25
sources/org/greenrobot/eventbus/AsyncPoster.java
Normal file
@@ -0,0 +1,25 @@
|
||||
package org.greenrobot.eventbus;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
class AsyncPoster implements Runnable {
|
||||
private final PendingPostQueue a = new PendingPostQueue();
|
||||
private final EventBus b;
|
||||
|
||||
AsyncPoster(EventBus eventBus) {
|
||||
this.b = eventBus;
|
||||
}
|
||||
|
||||
public void a(Subscription subscription, Object obj) {
|
||||
this.a.a(PendingPost.a(subscription, obj));
|
||||
this.b.a().execute(this);
|
||||
}
|
||||
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
PendingPost a = this.a.a();
|
||||
if (a == null) {
|
||||
throw new IllegalStateException("No pending post available");
|
||||
}
|
||||
this.b.a(a);
|
||||
}
|
||||
}
|
48
sources/org/greenrobot/eventbus/BackgroundPoster.java
Normal file
48
sources/org/greenrobot/eventbus/BackgroundPoster.java
Normal file
@@ -0,0 +1,48 @@
|
||||
package org.greenrobot.eventbus;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
final class BackgroundPoster implements Runnable {
|
||||
private final PendingPostQueue a = new PendingPostQueue();
|
||||
private final EventBus b;
|
||||
private volatile boolean c;
|
||||
|
||||
BackgroundPoster(EventBus eventBus) {
|
||||
this.b = eventBus;
|
||||
}
|
||||
|
||||
public void a(Subscription subscription, Object obj) {
|
||||
PendingPost a = PendingPost.a(subscription, obj);
|
||||
synchronized (this) {
|
||||
this.a.a(a);
|
||||
if (!this.c) {
|
||||
this.c = true;
|
||||
this.b.a().execute(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
while (true) {
|
||||
try {
|
||||
PendingPost a = this.a.a(1000);
|
||||
if (a == null) {
|
||||
synchronized (this) {
|
||||
a = this.a.a();
|
||||
if (a == null) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
this.b.a(a);
|
||||
} catch (InterruptedException e) {
|
||||
Log.w("Event", Thread.currentThread().getName() + " was interruppted", e);
|
||||
return;
|
||||
} finally {
|
||||
this.c = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
383
sources/org/greenrobot/eventbus/EventBus.java
Normal file
383
sources/org/greenrobot/eventbus/EventBus.java
Normal file
@@ -0,0 +1,383 @@
|
||||
package org.greenrobot.eventbus;
|
||||
|
||||
import android.os.Looper;
|
||||
import android.util.Log;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import org.greenrobot.eventbus.meta.SubscriberInfoIndex;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class EventBus {
|
||||
public static String q = "EventBus";
|
||||
static volatile EventBus r;
|
||||
private static final EventBusBuilder s = new EventBusBuilder();
|
||||
private static final Map<Class<?>, List<Class<?>>> t = new HashMap();
|
||||
private final Map<Class<?>, CopyOnWriteArrayList<Subscription>> a;
|
||||
private final Map<Object, List<Class<?>>> b;
|
||||
private final Map<Class<?>, Object> c;
|
||||
private final ThreadLocal<PostingThreadState> d;
|
||||
private final HandlerPoster e;
|
||||
private final BackgroundPoster f;
|
||||
private final AsyncPoster g;
|
||||
private final SubscriberMethodFinder h;
|
||||
private final ExecutorService i;
|
||||
private final boolean j;
|
||||
private final boolean k;
|
||||
private final boolean l;
|
||||
private final boolean m;
|
||||
private final boolean n;
|
||||
private final boolean o;
|
||||
private final int p;
|
||||
|
||||
/* renamed from: org.greenrobot.eventbus.EventBus$2, reason: invalid class name */
|
||||
static /* synthetic */ class AnonymousClass2 {
|
||||
static final /* synthetic */ int[] a = new int[ThreadMode.values().length];
|
||||
|
||||
static {
|
||||
try {
|
||||
a[ThreadMode.POSTING.ordinal()] = 1;
|
||||
} catch (NoSuchFieldError unused) {
|
||||
}
|
||||
try {
|
||||
a[ThreadMode.MAIN.ordinal()] = 2;
|
||||
} catch (NoSuchFieldError unused2) {
|
||||
}
|
||||
try {
|
||||
a[ThreadMode.BACKGROUND.ordinal()] = 3;
|
||||
} catch (NoSuchFieldError unused3) {
|
||||
}
|
||||
try {
|
||||
a[ThreadMode.ASYNC.ordinal()] = 4;
|
||||
} catch (NoSuchFieldError unused4) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static final class PostingThreadState {
|
||||
final List<Object> a = new ArrayList();
|
||||
boolean b;
|
||||
boolean c;
|
||||
Subscription d;
|
||||
Object e;
|
||||
boolean f;
|
||||
|
||||
PostingThreadState() {
|
||||
}
|
||||
}
|
||||
|
||||
public EventBus() {
|
||||
this(s);
|
||||
}
|
||||
|
||||
private void a(Object obj, SubscriberMethod subscriberMethod) {
|
||||
Class<?> cls = subscriberMethod.c;
|
||||
Subscription subscription = new Subscription(obj, subscriberMethod);
|
||||
CopyOnWriteArrayList<Subscription> copyOnWriteArrayList = this.a.get(cls);
|
||||
if (copyOnWriteArrayList == null) {
|
||||
copyOnWriteArrayList = new CopyOnWriteArrayList<>();
|
||||
this.a.put(cls, copyOnWriteArrayList);
|
||||
} else if (copyOnWriteArrayList.contains(subscription)) {
|
||||
throw new EventBusException("Subscriber " + obj.getClass() + " already registered to event " + cls);
|
||||
}
|
||||
int size = copyOnWriteArrayList.size();
|
||||
for (int i = 0; i <= size; i++) {
|
||||
if (i == size || subscriberMethod.d > copyOnWriteArrayList.get(i).b.d) {
|
||||
copyOnWriteArrayList.add(i, subscription);
|
||||
break;
|
||||
}
|
||||
}
|
||||
List<Class<?>> list = this.b.get(obj);
|
||||
if (list == null) {
|
||||
list = new ArrayList<>();
|
||||
this.b.put(obj, list);
|
||||
}
|
||||
list.add(cls);
|
||||
if (subscriberMethod.e) {
|
||||
if (!this.o) {
|
||||
b(subscription, this.c.get(cls));
|
||||
return;
|
||||
}
|
||||
for (Map.Entry<Class<?>, Object> entry : this.c.entrySet()) {
|
||||
if (cls.isAssignableFrom(entry.getKey())) {
|
||||
b(subscription, entry.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static EventBus b() {
|
||||
if (r == null) {
|
||||
synchronized (EventBus.class) {
|
||||
if (r == null) {
|
||||
r = new EventBus();
|
||||
}
|
||||
}
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
public void c(Object obj) {
|
||||
List<SubscriberMethod> a = this.h.a(obj.getClass());
|
||||
synchronized (this) {
|
||||
Iterator<SubscriberMethod> it = a.iterator();
|
||||
while (it.hasNext()) {
|
||||
a(obj, it.next());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void d(Object obj) {
|
||||
List<Class<?>> list = this.b.get(obj);
|
||||
if (list != null) {
|
||||
Iterator<Class<?>> it = list.iterator();
|
||||
while (it.hasNext()) {
|
||||
a(obj, it.next());
|
||||
}
|
||||
this.b.remove(obj);
|
||||
} else {
|
||||
Log.w(q, "Subscriber to unregister was not registered before: " + obj.getClass());
|
||||
}
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "EventBus[indexCount=" + this.p + ", eventInheritance=" + this.o + "]";
|
||||
}
|
||||
|
||||
EventBus(EventBusBuilder eventBusBuilder) {
|
||||
this.d = new ThreadLocal<PostingThreadState>(this) { // from class: org.greenrobot.eventbus.EventBus.1
|
||||
/* JADX INFO: Access modifiers changed from: protected */
|
||||
@Override // java.lang.ThreadLocal
|
||||
public PostingThreadState initialValue() {
|
||||
return new PostingThreadState();
|
||||
}
|
||||
};
|
||||
this.a = new HashMap();
|
||||
this.b = new HashMap();
|
||||
this.c = new ConcurrentHashMap();
|
||||
this.e = new HandlerPoster(this, Looper.getMainLooper(), 10);
|
||||
this.f = new BackgroundPoster(this);
|
||||
this.g = new AsyncPoster(this);
|
||||
List<SubscriberInfoIndex> list = eventBusBuilder.j;
|
||||
this.p = list != null ? list.size() : 0;
|
||||
this.h = new SubscriberMethodFinder(eventBusBuilder.j, eventBusBuilder.h, eventBusBuilder.g);
|
||||
this.k = eventBusBuilder.a;
|
||||
this.l = eventBusBuilder.b;
|
||||
this.m = eventBusBuilder.c;
|
||||
this.n = eventBusBuilder.d;
|
||||
this.j = eventBusBuilder.e;
|
||||
this.o = eventBusBuilder.f;
|
||||
this.i = eventBusBuilder.i;
|
||||
}
|
||||
|
||||
private void b(Subscription subscription, Object obj) {
|
||||
if (obj != null) {
|
||||
a(subscription, obj, Looper.getMainLooper() == Looper.myLooper());
|
||||
}
|
||||
}
|
||||
|
||||
public void b(Object obj) {
|
||||
PostingThreadState postingThreadState = this.d.get();
|
||||
List<Object> list = postingThreadState.a;
|
||||
list.add(obj);
|
||||
if (postingThreadState.b) {
|
||||
return;
|
||||
}
|
||||
postingThreadState.c = Looper.getMainLooper() == Looper.myLooper();
|
||||
postingThreadState.b = true;
|
||||
if (!postingThreadState.f) {
|
||||
while (!list.isEmpty()) {
|
||||
try {
|
||||
a(list.remove(0), postingThreadState);
|
||||
} finally {
|
||||
postingThreadState.b = false;
|
||||
postingThreadState.c = false;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
throw new EventBusException("Internal error. Abort state was not reset");
|
||||
}
|
||||
|
||||
public synchronized boolean a(Object obj) {
|
||||
return this.b.containsKey(obj);
|
||||
}
|
||||
|
||||
private void a(Object obj, Class<?> cls) {
|
||||
CopyOnWriteArrayList<Subscription> copyOnWriteArrayList = this.a.get(cls);
|
||||
if (copyOnWriteArrayList != null) {
|
||||
int size = copyOnWriteArrayList.size();
|
||||
int i = 0;
|
||||
while (i < size) {
|
||||
Subscription subscription = copyOnWriteArrayList.get(i);
|
||||
if (subscription.a == obj) {
|
||||
subscription.c = false;
|
||||
copyOnWriteArrayList.remove(i);
|
||||
i--;
|
||||
size--;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void a(Object obj, PostingThreadState postingThreadState) throws Error {
|
||||
boolean a;
|
||||
Class<?> cls = obj.getClass();
|
||||
if (this.o) {
|
||||
List<Class<?>> a2 = a(cls);
|
||||
int size = a2.size();
|
||||
a = false;
|
||||
for (int i = 0; i < size; i++) {
|
||||
a |= a(obj, postingThreadState, a2.get(i));
|
||||
}
|
||||
} else {
|
||||
a = a(obj, postingThreadState, cls);
|
||||
}
|
||||
if (a) {
|
||||
return;
|
||||
}
|
||||
if (this.l) {
|
||||
Log.d(q, "No subscribers registered for event " + cls);
|
||||
}
|
||||
if (!this.n || cls == NoSubscriberEvent.class || cls == SubscriberExceptionEvent.class) {
|
||||
return;
|
||||
}
|
||||
b(new NoSubscriberEvent(this, obj));
|
||||
}
|
||||
|
||||
private boolean a(Object obj, PostingThreadState postingThreadState, Class<?> cls) {
|
||||
CopyOnWriteArrayList<Subscription> copyOnWriteArrayList;
|
||||
synchronized (this) {
|
||||
copyOnWriteArrayList = this.a.get(cls);
|
||||
}
|
||||
if (copyOnWriteArrayList == null || copyOnWriteArrayList.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
Iterator<Subscription> it = copyOnWriteArrayList.iterator();
|
||||
while (it.hasNext()) {
|
||||
Subscription next = it.next();
|
||||
postingThreadState.e = obj;
|
||||
postingThreadState.d = next;
|
||||
try {
|
||||
a(next, obj, postingThreadState.c);
|
||||
if (postingThreadState.f) {
|
||||
return true;
|
||||
}
|
||||
} finally {
|
||||
postingThreadState.e = null;
|
||||
postingThreadState.d = null;
|
||||
postingThreadState.f = false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void a(Subscription subscription, Object obj, boolean z) {
|
||||
int i = AnonymousClass2.a[subscription.b.b.ordinal()];
|
||||
if (i == 1) {
|
||||
a(subscription, obj);
|
||||
return;
|
||||
}
|
||||
if (i == 2) {
|
||||
if (z) {
|
||||
a(subscription, obj);
|
||||
return;
|
||||
} else {
|
||||
this.e.a(subscription, obj);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (i == 3) {
|
||||
if (z) {
|
||||
this.f.a(subscription, obj);
|
||||
return;
|
||||
} else {
|
||||
a(subscription, obj);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (i == 4) {
|
||||
this.g.a(subscription, obj);
|
||||
return;
|
||||
}
|
||||
throw new IllegalStateException("Unknown thread mode: " + subscription.b.b);
|
||||
}
|
||||
|
||||
private static List<Class<?>> a(Class<?> cls) {
|
||||
List<Class<?>> list;
|
||||
synchronized (t) {
|
||||
list = t.get(cls);
|
||||
if (list == null) {
|
||||
list = new ArrayList<>();
|
||||
for (Class<?> cls2 = cls; cls2 != null; cls2 = cls2.getSuperclass()) {
|
||||
list.add(cls2);
|
||||
a(list, cls2.getInterfaces());
|
||||
}
|
||||
t.put(cls, list);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
static void a(List<Class<?>> list, Class<?>[] clsArr) {
|
||||
for (Class<?> cls : clsArr) {
|
||||
if (!list.contains(cls)) {
|
||||
list.add(cls);
|
||||
a(list, cls.getInterfaces());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void a(PendingPost pendingPost) {
|
||||
Object obj = pendingPost.a;
|
||||
Subscription subscription = pendingPost.b;
|
||||
PendingPost.a(pendingPost);
|
||||
if (subscription.c) {
|
||||
a(subscription, obj);
|
||||
}
|
||||
}
|
||||
|
||||
void a(Subscription subscription, Object obj) {
|
||||
try {
|
||||
subscription.b.a.invoke(subscription.a, obj);
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new IllegalStateException("Unexpected exception", e);
|
||||
} catch (InvocationTargetException e2) {
|
||||
a(subscription, obj, e2.getCause());
|
||||
}
|
||||
}
|
||||
|
||||
private void a(Subscription subscription, Object obj, Throwable th) {
|
||||
if (obj instanceof SubscriberExceptionEvent) {
|
||||
if (this.k) {
|
||||
Log.e(q, "SubscriberExceptionEvent subscriber " + subscription.a.getClass() + " threw an exception", th);
|
||||
SubscriberExceptionEvent subscriberExceptionEvent = (SubscriberExceptionEvent) obj;
|
||||
Log.e(q, "Initial event " + subscriberExceptionEvent.b + " caused exception in " + subscriberExceptionEvent.c, subscriberExceptionEvent.a);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (!this.j) {
|
||||
if (this.k) {
|
||||
Log.e(q, "Could not dispatch event: " + obj.getClass() + " to subscribing class " + subscription.a.getClass(), th);
|
||||
}
|
||||
if (this.m) {
|
||||
b(new SubscriberExceptionEvent(this, th, obj, subscription.a));
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
throw new EventBusException("Invoking subscriber failed", th);
|
||||
}
|
||||
|
||||
ExecutorService a() {
|
||||
return this.i;
|
||||
}
|
||||
}
|
24
sources/org/greenrobot/eventbus/EventBusBuilder.java
Normal file
24
sources/org/greenrobot/eventbus/EventBusBuilder.java
Normal file
@@ -0,0 +1,24 @@
|
||||
package org.greenrobot.eventbus;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import org.greenrobot.eventbus.meta.SubscriberInfoIndex;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class EventBusBuilder {
|
||||
private static final ExecutorService k = Executors.newCachedThreadPool();
|
||||
boolean e;
|
||||
boolean g;
|
||||
boolean h;
|
||||
List<SubscriberInfoIndex> j;
|
||||
boolean a = true;
|
||||
boolean b = true;
|
||||
boolean c = true;
|
||||
boolean d = true;
|
||||
boolean f = true;
|
||||
ExecutorService i = k;
|
||||
|
||||
EventBusBuilder() {
|
||||
}
|
||||
}
|
18
sources/org/greenrobot/eventbus/EventBusException.java
Normal file
18
sources/org/greenrobot/eventbus/EventBusException.java
Normal file
@@ -0,0 +1,18 @@
|
||||
package org.greenrobot.eventbus;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class EventBusException extends RuntimeException {
|
||||
private static final long serialVersionUID = -2912559384646531479L;
|
||||
|
||||
public EventBusException(String str) {
|
||||
super(str);
|
||||
}
|
||||
|
||||
public EventBusException(Throwable th) {
|
||||
super(th);
|
||||
}
|
||||
|
||||
public EventBusException(String str, Throwable th) {
|
||||
super(str, th);
|
||||
}
|
||||
}
|
60
sources/org/greenrobot/eventbus/HandlerPoster.java
Normal file
60
sources/org/greenrobot/eventbus/HandlerPoster.java
Normal file
@@ -0,0 +1,60 @@
|
||||
package org.greenrobot.eventbus;
|
||||
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import android.os.SystemClock;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
final class HandlerPoster extends Handler {
|
||||
private final PendingPostQueue a;
|
||||
private final int b;
|
||||
private final EventBus c;
|
||||
private boolean d;
|
||||
|
||||
HandlerPoster(EventBus eventBus, Looper looper, int i) {
|
||||
super(looper);
|
||||
this.c = eventBus;
|
||||
this.b = i;
|
||||
this.a = new PendingPostQueue();
|
||||
}
|
||||
|
||||
void a(Subscription subscription, Object obj) {
|
||||
PendingPost a = PendingPost.a(subscription, obj);
|
||||
synchronized (this) {
|
||||
this.a.a(a);
|
||||
if (!this.d) {
|
||||
this.d = true;
|
||||
if (!sendMessage(obtainMessage())) {
|
||||
throw new EventBusException("Could not send handler message");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.os.Handler
|
||||
public void handleMessage(Message message) {
|
||||
try {
|
||||
long uptimeMillis = SystemClock.uptimeMillis();
|
||||
do {
|
||||
PendingPost a = this.a.a();
|
||||
if (a == null) {
|
||||
synchronized (this) {
|
||||
a = this.a.a();
|
||||
if (a == null) {
|
||||
this.d = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
this.c.a(a);
|
||||
} while (SystemClock.uptimeMillis() - uptimeMillis < this.b);
|
||||
if (!sendMessage(obtainMessage())) {
|
||||
throw new EventBusException("Could not send handler message");
|
||||
}
|
||||
this.d = true;
|
||||
} finally {
|
||||
this.d = false;
|
||||
}
|
||||
}
|
||||
}
|
7
sources/org/greenrobot/eventbus/NoSubscriberEvent.java
Normal file
7
sources/org/greenrobot/eventbus/NoSubscriberEvent.java
Normal file
@@ -0,0 +1,7 @@
|
||||
package org.greenrobot.eventbus;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public final class NoSubscriberEvent {
|
||||
public NoSubscriberEvent(EventBus eventBus, Object obj) {
|
||||
}
|
||||
}
|
42
sources/org/greenrobot/eventbus/PendingPost.java
Normal file
42
sources/org/greenrobot/eventbus/PendingPost.java
Normal file
@@ -0,0 +1,42 @@
|
||||
package org.greenrobot.eventbus;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
final class PendingPost {
|
||||
private static final List<PendingPost> d = new ArrayList();
|
||||
Object a;
|
||||
Subscription b;
|
||||
PendingPost c;
|
||||
|
||||
private PendingPost(Object obj, Subscription subscription) {
|
||||
this.a = obj;
|
||||
this.b = subscription;
|
||||
}
|
||||
|
||||
static PendingPost a(Subscription subscription, Object obj) {
|
||||
synchronized (d) {
|
||||
int size = d.size();
|
||||
if (size <= 0) {
|
||||
return new PendingPost(obj, subscription);
|
||||
}
|
||||
PendingPost remove = d.remove(size - 1);
|
||||
remove.a = obj;
|
||||
remove.b = subscription;
|
||||
remove.c = null;
|
||||
return remove;
|
||||
}
|
||||
}
|
||||
|
||||
static void a(PendingPost pendingPost) {
|
||||
pendingPost.a = null;
|
||||
pendingPost.b = null;
|
||||
pendingPost.c = null;
|
||||
synchronized (d) {
|
||||
if (d.size() < 10000) {
|
||||
d.add(pendingPost);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
50
sources/org/greenrobot/eventbus/PendingPostQueue.java
Normal file
50
sources/org/greenrobot/eventbus/PendingPostQueue.java
Normal file
@@ -0,0 +1,50 @@
|
||||
package org.greenrobot.eventbus;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
final class PendingPostQueue {
|
||||
private PendingPost a;
|
||||
private PendingPost b;
|
||||
|
||||
PendingPostQueue() {
|
||||
}
|
||||
|
||||
synchronized void a(PendingPost pendingPost) {
|
||||
try {
|
||||
if (pendingPost == null) {
|
||||
throw new NullPointerException("null cannot be enqueued");
|
||||
}
|
||||
if (this.b != null) {
|
||||
this.b.c = pendingPost;
|
||||
this.b = pendingPost;
|
||||
} else {
|
||||
if (this.a != null) {
|
||||
throw new IllegalStateException("Head present, but no tail");
|
||||
}
|
||||
this.b = pendingPost;
|
||||
this.a = pendingPost;
|
||||
}
|
||||
notifyAll();
|
||||
} catch (Throwable th) {
|
||||
throw th;
|
||||
}
|
||||
}
|
||||
|
||||
synchronized PendingPost a() {
|
||||
PendingPost pendingPost;
|
||||
pendingPost = this.a;
|
||||
if (this.a != null) {
|
||||
this.a = this.a.c;
|
||||
if (this.a == null) {
|
||||
this.b = null;
|
||||
}
|
||||
}
|
||||
return pendingPost;
|
||||
}
|
||||
|
||||
synchronized PendingPost a(int i) throws InterruptedException {
|
||||
if (this.a == null) {
|
||||
wait(i);
|
||||
}
|
||||
return a();
|
||||
}
|
||||
}
|
19
sources/org/greenrobot/eventbus/Subscribe.java
Normal file
19
sources/org/greenrobot/eventbus/Subscribe.java
Normal file
@@ -0,0 +1,19 @@
|
||||
package org.greenrobot.eventbus;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Target({ElementType.METHOD})
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
/* loaded from: classes2.dex */
|
||||
public @interface Subscribe {
|
||||
int priority() default 0;
|
||||
|
||||
boolean sticky() default false;
|
||||
|
||||
ThreadMode threadMode() default ThreadMode.POSTING;
|
||||
}
|
@@ -0,0 +1,14 @@
|
||||
package org.greenrobot.eventbus;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public final class SubscriberExceptionEvent {
|
||||
public final Throwable a;
|
||||
public final Object b;
|
||||
public final Object c;
|
||||
|
||||
public SubscriberExceptionEvent(EventBus eventBus, Throwable th, Object obj, Object obj2) {
|
||||
this.a = th;
|
||||
this.b = obj;
|
||||
this.c = obj2;
|
||||
}
|
||||
}
|
50
sources/org/greenrobot/eventbus/SubscriberMethod.java
Normal file
50
sources/org/greenrobot/eventbus/SubscriberMethod.java
Normal file
@@ -0,0 +1,50 @@
|
||||
package org.greenrobot.eventbus;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class SubscriberMethod {
|
||||
final Method a;
|
||||
final ThreadMode b;
|
||||
final Class<?> c;
|
||||
final int d;
|
||||
final boolean e;
|
||||
String f;
|
||||
|
||||
public SubscriberMethod(Method method, Class<?> cls, ThreadMode threadMode, int i, boolean z) {
|
||||
this.a = method;
|
||||
this.b = threadMode;
|
||||
this.c = cls;
|
||||
this.d = i;
|
||||
this.e = z;
|
||||
}
|
||||
|
||||
private synchronized void a() {
|
||||
if (this.f == null) {
|
||||
StringBuilder sb = new StringBuilder(64);
|
||||
sb.append(this.a.getDeclaringClass().getName());
|
||||
sb.append('#');
|
||||
sb.append(this.a.getName());
|
||||
sb.append('(');
|
||||
sb.append(this.c.getName());
|
||||
this.f = sb.toString();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == this) {
|
||||
return true;
|
||||
}
|
||||
if (!(obj instanceof SubscriberMethod)) {
|
||||
return false;
|
||||
}
|
||||
a();
|
||||
SubscriberMethod subscriberMethod = (SubscriberMethod) obj;
|
||||
subscriberMethod.a();
|
||||
return this.f.equals(subscriberMethod.f);
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return this.a.hashCode();
|
||||
}
|
||||
}
|
225
sources/org/greenrobot/eventbus/SubscriberMethodFinder.java
Normal file
225
sources/org/greenrobot/eventbus/SubscriberMethodFinder.java
Normal file
@@ -0,0 +1,225 @@
|
||||
package org.greenrobot.eventbus;
|
||||
|
||||
import com.ubtrobot.jimu.robotapi.PeripheralType;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import org.greenrobot.eventbus.meta.SubscriberInfo;
|
||||
import org.greenrobot.eventbus.meta.SubscriberInfoIndex;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
class SubscriberMethodFinder {
|
||||
private static final Map<Class<?>, List<SubscriberMethod>> d = new ConcurrentHashMap();
|
||||
private static final FindState[] e = new FindState[4];
|
||||
private List<SubscriberInfoIndex> a;
|
||||
private final boolean b;
|
||||
private final boolean c;
|
||||
|
||||
SubscriberMethodFinder(List<SubscriberInfoIndex> list, boolean z, boolean z2) {
|
||||
this.a = list;
|
||||
this.b = z;
|
||||
this.c = z2;
|
||||
}
|
||||
|
||||
private List<SubscriberMethod> b(Class<?> cls) {
|
||||
FindState a = a();
|
||||
a.a(cls);
|
||||
while (a.e != null) {
|
||||
a.g = c(a);
|
||||
SubscriberInfo subscriberInfo = a.g;
|
||||
if (subscriberInfo != null) {
|
||||
for (SubscriberMethod subscriberMethod : subscriberInfo.a()) {
|
||||
if (a.a(subscriberMethod.a, subscriberMethod.c)) {
|
||||
a.a.add(subscriberMethod);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
a(a);
|
||||
}
|
||||
a.a();
|
||||
}
|
||||
return b(a);
|
||||
}
|
||||
|
||||
private SubscriberInfo c(FindState findState) {
|
||||
SubscriberInfo subscriberInfo = findState.g;
|
||||
if (subscriberInfo != null && subscriberInfo.b() != null) {
|
||||
SubscriberInfo b = findState.g.b();
|
||||
if (findState.e == b.c()) {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
List<SubscriberInfoIndex> list = this.a;
|
||||
if (list == null) {
|
||||
return null;
|
||||
}
|
||||
Iterator<SubscriberInfoIndex> it = list.iterator();
|
||||
while (it.hasNext()) {
|
||||
SubscriberInfo a = it.next().a(findState.e);
|
||||
if (a != null) {
|
||||
return a;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
List<SubscriberMethod> a(Class<?> cls) {
|
||||
List<SubscriberMethod> list = d.get(cls);
|
||||
if (list != null) {
|
||||
return list;
|
||||
}
|
||||
List<SubscriberMethod> c = this.c ? c(cls) : b(cls);
|
||||
if (!c.isEmpty()) {
|
||||
d.put(cls, c);
|
||||
return c;
|
||||
}
|
||||
throw new EventBusException("Subscriber " + cls + " and its super classes have no public methods with the @Subscribe annotation");
|
||||
}
|
||||
|
||||
static class FindState {
|
||||
final List<SubscriberMethod> a = new ArrayList();
|
||||
final Map<Class, Object> b = new HashMap();
|
||||
final Map<String, Class> c = new HashMap();
|
||||
final StringBuilder d = new StringBuilder(PeripheralType.SERVO);
|
||||
Class<?> e;
|
||||
boolean f;
|
||||
SubscriberInfo g;
|
||||
|
||||
FindState() {
|
||||
}
|
||||
|
||||
void a(Class<?> cls) {
|
||||
this.e = cls;
|
||||
this.f = false;
|
||||
this.g = null;
|
||||
}
|
||||
|
||||
void b() {
|
||||
this.a.clear();
|
||||
this.b.clear();
|
||||
this.c.clear();
|
||||
this.d.setLength(0);
|
||||
this.e = null;
|
||||
this.f = false;
|
||||
this.g = null;
|
||||
}
|
||||
|
||||
boolean a(Method method, Class<?> cls) {
|
||||
Object put = this.b.put(cls, method);
|
||||
if (put == null) {
|
||||
return true;
|
||||
}
|
||||
if (put instanceof Method) {
|
||||
if (b((Method) put, cls)) {
|
||||
this.b.put(cls, this);
|
||||
} else {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
}
|
||||
return b(method, cls);
|
||||
}
|
||||
|
||||
private boolean b(Method method, Class<?> cls) {
|
||||
this.d.setLength(0);
|
||||
this.d.append(method.getName());
|
||||
StringBuilder sb = this.d;
|
||||
sb.append('>');
|
||||
sb.append(cls.getName());
|
||||
String sb2 = this.d.toString();
|
||||
Class<?> declaringClass = method.getDeclaringClass();
|
||||
Class put = this.c.put(sb2, declaringClass);
|
||||
if (put == null || put.isAssignableFrom(declaringClass)) {
|
||||
return true;
|
||||
}
|
||||
this.c.put(sb2, put);
|
||||
return false;
|
||||
}
|
||||
|
||||
void a() {
|
||||
if (this.f) {
|
||||
this.e = null;
|
||||
return;
|
||||
}
|
||||
this.e = this.e.getSuperclass();
|
||||
String name = this.e.getName();
|
||||
if (name.startsWith("java.") || name.startsWith("javax.") || name.startsWith("android.")) {
|
||||
this.e = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private List<SubscriberMethod> c(Class<?> cls) {
|
||||
FindState a = a();
|
||||
a.a(cls);
|
||||
while (a.e != null) {
|
||||
a(a);
|
||||
a.a();
|
||||
}
|
||||
return b(a);
|
||||
}
|
||||
|
||||
private FindState a() {
|
||||
synchronized (e) {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
FindState findState = e[i];
|
||||
if (findState != null) {
|
||||
e[i] = null;
|
||||
return findState;
|
||||
}
|
||||
}
|
||||
return new FindState();
|
||||
}
|
||||
}
|
||||
|
||||
private List<SubscriberMethod> b(FindState findState) {
|
||||
ArrayList arrayList = new ArrayList(findState.a);
|
||||
findState.b();
|
||||
synchronized (e) {
|
||||
int i = 0;
|
||||
while (true) {
|
||||
if (i >= 4) {
|
||||
break;
|
||||
}
|
||||
if (e[i] == null) {
|
||||
e[i] = findState;
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
return arrayList;
|
||||
}
|
||||
|
||||
private void a(FindState findState) {
|
||||
Method[] methods;
|
||||
try {
|
||||
methods = findState.e.getDeclaredMethods();
|
||||
} catch (Throwable unused) {
|
||||
methods = findState.e.getMethods();
|
||||
findState.f = true;
|
||||
}
|
||||
for (Method method : methods) {
|
||||
int modifiers = method.getModifiers();
|
||||
if ((modifiers & 1) != 0 && (modifiers & 5192) == 0) {
|
||||
Class<?>[] parameterTypes = method.getParameterTypes();
|
||||
if (parameterTypes.length == 1) {
|
||||
Subscribe subscribe = (Subscribe) method.getAnnotation(Subscribe.class);
|
||||
if (subscribe != null) {
|
||||
Class<?> cls = parameterTypes[0];
|
||||
if (findState.a(method, cls)) {
|
||||
findState.a.add(new SubscriberMethod(method, cls, subscribe.threadMode(), subscribe.priority(), subscribe.sticky()));
|
||||
}
|
||||
}
|
||||
} else if (this.b && method.isAnnotationPresent(Subscribe.class)) {
|
||||
throw new EventBusException("@Subscribe method " + (method.getDeclaringClass().getName() + "." + method.getName()) + "must have exactly 1 parameter but has " + parameterTypes.length);
|
||||
}
|
||||
} else if (this.b && method.isAnnotationPresent(Subscribe.class)) {
|
||||
throw new EventBusException((method.getDeclaringClass().getName() + "." + method.getName()) + " is a illegal @Subscribe method: must be public, non-static, and non-abstract");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
25
sources/org/greenrobot/eventbus/Subscription.java
Normal file
25
sources/org/greenrobot/eventbus/Subscription.java
Normal file
@@ -0,0 +1,25 @@
|
||||
package org.greenrobot.eventbus;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
final class Subscription {
|
||||
final Object a;
|
||||
final SubscriberMethod b;
|
||||
volatile boolean c = true;
|
||||
|
||||
Subscription(Object obj, SubscriberMethod subscriberMethod) {
|
||||
this.a = obj;
|
||||
this.b = subscriberMethod;
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (!(obj instanceof Subscription)) {
|
||||
return false;
|
||||
}
|
||||
Subscription subscription = (Subscription) obj;
|
||||
return this.a == subscription.a && this.b.equals(subscription.b);
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return this.a.hashCode() + this.b.f.hashCode();
|
||||
}
|
||||
}
|
9
sources/org/greenrobot/eventbus/ThreadMode.java
Normal file
9
sources/org/greenrobot/eventbus/ThreadMode.java
Normal file
@@ -0,0 +1,9 @@
|
||||
package org.greenrobot.eventbus;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public enum ThreadMode {
|
||||
POSTING,
|
||||
MAIN,
|
||||
BACKGROUND,
|
||||
ASYNC
|
||||
}
|
12
sources/org/greenrobot/eventbus/meta/SubscriberInfo.java
Normal file
12
sources/org/greenrobot/eventbus/meta/SubscriberInfo.java
Normal file
@@ -0,0 +1,12 @@
|
||||
package org.greenrobot.eventbus.meta;
|
||||
|
||||
import org.greenrobot.eventbus.SubscriberMethod;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public interface SubscriberInfo {
|
||||
SubscriberMethod[] a();
|
||||
|
||||
SubscriberInfo b();
|
||||
|
||||
Class<?> c();
|
||||
}
|
@@ -0,0 +1,6 @@
|
||||
package org.greenrobot.eventbus.meta;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public interface SubscriberInfoIndex {
|
||||
SubscriberInfo a(Class<?> cls);
|
||||
}
|
10
sources/org/greenrobot/eventbus/util/ErrorDialogConfig.java
Normal file
10
sources/org/greenrobot/eventbus/util/ErrorDialogConfig.java
Normal file
@@ -0,0 +1,10 @@
|
||||
package org.greenrobot.eventbus.util;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class ErrorDialogConfig {
|
||||
EventBus a() {
|
||||
throw null;
|
||||
}
|
||||
}
|
@@ -0,0 +1,6 @@
|
||||
package org.greenrobot.eventbus.util;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public abstract class ErrorDialogFragmentFactory<T> {
|
||||
protected final ErrorDialogConfig a;
|
||||
}
|
@@ -0,0 +1,60 @@
|
||||
package org.greenrobot.eventbus.util;
|
||||
|
||||
import android.R;
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.app.DialogFragment;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class ErrorDialogFragments {
|
||||
public static int a;
|
||||
public static Class<?> b;
|
||||
|
||||
@TargetApi(11)
|
||||
public static class Honeycomb extends DialogFragment implements DialogInterface.OnClickListener {
|
||||
@Override // android.content.DialogInterface.OnClickListener
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
ErrorDialogFragments.a(dialogInterface, i, getActivity(), getArguments());
|
||||
}
|
||||
|
||||
@Override // android.app.DialogFragment
|
||||
public Dialog onCreateDialog(Bundle bundle) {
|
||||
return ErrorDialogFragments.a(getActivity(), getArguments(), this);
|
||||
}
|
||||
}
|
||||
|
||||
public static Dialog a(Context context, Bundle bundle, DialogInterface.OnClickListener onClickListener) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||
builder.setTitle(bundle.getString("de.greenrobot.eventbus.errordialog.title"));
|
||||
builder.setMessage(bundle.getString("de.greenrobot.eventbus.errordialog.message"));
|
||||
int i = a;
|
||||
if (i != 0) {
|
||||
builder.setIcon(i);
|
||||
}
|
||||
builder.setPositiveButton(R.string.ok, onClickListener);
|
||||
return builder.create();
|
||||
}
|
||||
|
||||
public static void a(DialogInterface dialogInterface, int i, Activity activity, Bundle bundle) {
|
||||
Class<?> cls = b;
|
||||
if (cls == null) {
|
||||
if (!bundle.getBoolean("de.greenrobot.eventbus.errordialog.finish_after_dialog", false) || activity == null) {
|
||||
return;
|
||||
}
|
||||
activity.finish();
|
||||
return;
|
||||
}
|
||||
try {
|
||||
cls.newInstance();
|
||||
ErrorDialogManager.a.a.a();
|
||||
throw null;
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("Event cannot be constructed", e);
|
||||
}
|
||||
}
|
||||
}
|
28
sources/org/greenrobot/eventbus/util/ErrorDialogManager.java
Normal file
28
sources/org/greenrobot/eventbus/util/ErrorDialogManager.java
Normal file
@@ -0,0 +1,28 @@
|
||||
package org.greenrobot.eventbus.util;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.Fragment;
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class ErrorDialogManager {
|
||||
public static ErrorDialogFragmentFactory<?> a;
|
||||
|
||||
@TargetApi(11)
|
||||
public static class HoneycombManagerFragment extends Fragment {
|
||||
private EventBus a;
|
||||
|
||||
@Override // android.app.Fragment
|
||||
public void onPause() {
|
||||
this.a.d(this);
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
@Override // android.app.Fragment
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
ErrorDialogManager.a.a.a();
|
||||
throw null;
|
||||
}
|
||||
}
|
||||
}
|
668
sources/org/greenrobot/greendao/AbstractDao.java
Normal file
668
sources/org/greenrobot/greendao/AbstractDao.java
Normal file
@@ -0,0 +1,668 @@
|
||||
package org.greenrobot.greendao;
|
||||
|
||||
import android.database.CrossProcessCursor;
|
||||
import android.database.Cursor;
|
||||
import android.database.CursorWindow;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.database.sqlite.SQLiteStatement;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import org.greenrobot.greendao.database.Database;
|
||||
import org.greenrobot.greendao.database.DatabaseStatement;
|
||||
import org.greenrobot.greendao.identityscope.IdentityScope;
|
||||
import org.greenrobot.greendao.identityscope.IdentityScopeLong;
|
||||
import org.greenrobot.greendao.internal.DaoConfig;
|
||||
import org.greenrobot.greendao.internal.TableStatements;
|
||||
import org.greenrobot.greendao.query.QueryBuilder;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public abstract class AbstractDao<T, K> {
|
||||
protected final DaoConfig a;
|
||||
protected final Database b;
|
||||
protected final boolean c;
|
||||
protected final IdentityScope<K, T> d;
|
||||
protected final IdentityScopeLong<T> e;
|
||||
protected final TableStatements f;
|
||||
protected final AbstractDaoSession g;
|
||||
protected final int h;
|
||||
|
||||
public AbstractDao(DaoConfig daoConfig, AbstractDaoSession abstractDaoSession) {
|
||||
this.a = daoConfig;
|
||||
this.g = abstractDaoSession;
|
||||
this.b = daoConfig.a;
|
||||
this.c = this.b.b() instanceof SQLiteDatabase;
|
||||
this.d = (IdentityScope<K, T>) daoConfig.a();
|
||||
IdentityScope<K, T> identityScope = this.d;
|
||||
if (identityScope instanceof IdentityScopeLong) {
|
||||
this.e = (IdentityScopeLong) identityScope;
|
||||
} else {
|
||||
this.e = null;
|
||||
}
|
||||
this.f = daoConfig.i;
|
||||
Property property = daoConfig.g;
|
||||
this.h = property != null ? property.a : -1;
|
||||
}
|
||||
|
||||
public T a(long j) {
|
||||
return d(this.b.a(this.f.f(), new String[]{Long.toString(j)}));
|
||||
}
|
||||
|
||||
protected abstract T a(Cursor cursor, int i);
|
||||
|
||||
protected abstract K a(T t, long j);
|
||||
|
||||
protected abstract void a(Cursor cursor, T t, int i);
|
||||
|
||||
protected abstract void a(SQLiteStatement sQLiteStatement, T t);
|
||||
|
||||
protected void a(T t) {
|
||||
}
|
||||
|
||||
protected abstract void a(DatabaseStatement databaseStatement, T t);
|
||||
|
||||
protected abstract K b(Cursor cursor, int i);
|
||||
|
||||
public void b(Iterable<T> iterable) {
|
||||
a(iterable, i());
|
||||
}
|
||||
|
||||
public String[] c() {
|
||||
return this.a.d;
|
||||
}
|
||||
|
||||
protected T d(Cursor cursor) {
|
||||
try {
|
||||
return c(cursor);
|
||||
} finally {
|
||||
cursor.close();
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract K d(T t);
|
||||
|
||||
public Property e() {
|
||||
return this.a.g;
|
||||
}
|
||||
|
||||
public Property[] f() {
|
||||
return this.a.c;
|
||||
}
|
||||
|
||||
public AbstractDaoSession g() {
|
||||
return this.g;
|
||||
}
|
||||
|
||||
public String h() {
|
||||
return this.a.b;
|
||||
}
|
||||
|
||||
public void i(T t) {
|
||||
a();
|
||||
K e = e((AbstractDao<T, K>) t);
|
||||
Cursor a = this.b.a(this.f.e(), new String[]{e.toString()});
|
||||
try {
|
||||
if (!a.moveToFirst()) {
|
||||
throw new DaoException("Entity does not exist in the database anymore: " + t.getClass() + " with key " + e);
|
||||
}
|
||||
if (a.isLast()) {
|
||||
a(a, (Cursor) t, 0);
|
||||
a((AbstractDao<T, K>) e, (K) t, true);
|
||||
} else {
|
||||
throw new DaoException("Expected unique result, but count was " + a.getCount());
|
||||
}
|
||||
} finally {
|
||||
a.close();
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract boolean i();
|
||||
|
||||
public List<T> j() {
|
||||
return a(this.b.a(this.f.d(), null));
|
||||
}
|
||||
|
||||
public QueryBuilder<T> k() {
|
||||
return QueryBuilder.a(this);
|
||||
}
|
||||
|
||||
private CursorWindow e(Cursor cursor) {
|
||||
this.d.unlock();
|
||||
try {
|
||||
return cursor.moveToNext() ? ((CrossProcessCursor) cursor).getWindow() : null;
|
||||
} finally {
|
||||
this.d.lock();
|
||||
}
|
||||
}
|
||||
|
||||
public void b(Iterable<T> iterable, boolean z) {
|
||||
a(this.f.b(), (Iterable) iterable, z);
|
||||
}
|
||||
|
||||
protected T c(Cursor cursor) {
|
||||
if (!cursor.moveToFirst()) {
|
||||
return null;
|
||||
}
|
||||
if (cursor.isLast()) {
|
||||
return a(cursor, 0, true);
|
||||
}
|
||||
throw new DaoException("Expected unique result, but count was " + cursor.getCount());
|
||||
}
|
||||
|
||||
public long f(T t) {
|
||||
return b(t, this.f.c(), true);
|
||||
}
|
||||
|
||||
public long g(T t) {
|
||||
return b(t, this.f.b(), true);
|
||||
}
|
||||
|
||||
public T h(K k) {
|
||||
T t;
|
||||
a();
|
||||
if (k == null) {
|
||||
return null;
|
||||
}
|
||||
IdentityScope<K, T> identityScope = this.d;
|
||||
return (identityScope == null || (t = identityScope.get(k)) == null) ? d(this.b.a(this.f.e(), new String[]{k.toString()})) : t;
|
||||
}
|
||||
|
||||
public void j(T t) {
|
||||
a();
|
||||
DatabaseStatement g = this.f.g();
|
||||
if (this.b.d()) {
|
||||
synchronized (g) {
|
||||
if (this.c) {
|
||||
a((AbstractDao<T, K>) t, (SQLiteStatement) g.b(), true);
|
||||
} else {
|
||||
a((AbstractDao<T, K>) t, g, true);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
this.b.a();
|
||||
try {
|
||||
synchronized (g) {
|
||||
a((AbstractDao<T, K>) t, g, true);
|
||||
}
|
||||
this.b.c();
|
||||
} finally {
|
||||
this.b.e();
|
||||
}
|
||||
}
|
||||
|
||||
private long b(T t, DatabaseStatement databaseStatement, boolean z) {
|
||||
long b;
|
||||
if (this.b.d()) {
|
||||
b = b((AbstractDao<T, K>) t, databaseStatement);
|
||||
} else {
|
||||
this.b.a();
|
||||
try {
|
||||
b = b((AbstractDao<T, K>) t, databaseStatement);
|
||||
this.b.c();
|
||||
} finally {
|
||||
this.b.e();
|
||||
}
|
||||
}
|
||||
if (z) {
|
||||
a((AbstractDao<T, K>) t, b, true);
|
||||
}
|
||||
return b;
|
||||
}
|
||||
|
||||
protected List<T> a(Cursor cursor) {
|
||||
try {
|
||||
return b(cursor);
|
||||
} finally {
|
||||
cursor.close();
|
||||
}
|
||||
}
|
||||
|
||||
public void d(Iterable<T> iterable) {
|
||||
DatabaseStatement g = this.f.g();
|
||||
this.b.a();
|
||||
try {
|
||||
synchronized (g) {
|
||||
if (this.d != null) {
|
||||
this.d.lock();
|
||||
}
|
||||
try {
|
||||
if (this.c) {
|
||||
SQLiteStatement sQLiteStatement = (SQLiteStatement) g.b();
|
||||
Iterator<T> it = iterable.iterator();
|
||||
while (it.hasNext()) {
|
||||
a((AbstractDao<T, K>) it.next(), sQLiteStatement, false);
|
||||
}
|
||||
} else {
|
||||
Iterator<T> it2 = iterable.iterator();
|
||||
while (it2.hasNext()) {
|
||||
a((AbstractDao<T, K>) it2.next(), g, false);
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
if (this.d != null) {
|
||||
this.d.unlock();
|
||||
}
|
||||
}
|
||||
}
|
||||
this.b.c();
|
||||
} catch (RuntimeException e) {
|
||||
e = e;
|
||||
try {
|
||||
this.b.e();
|
||||
} catch (RuntimeException e2) {
|
||||
DaoLog.b("Could not end transaction (rethrowing initial exception)", e2);
|
||||
throw e;
|
||||
}
|
||||
} catch (Throwable th) {
|
||||
try {
|
||||
this.b.e();
|
||||
throw th;
|
||||
} catch (RuntimeException e3) {
|
||||
throw e3;
|
||||
}
|
||||
}
|
||||
try {
|
||||
this.b.e();
|
||||
e = null;
|
||||
if (e != null) {
|
||||
throw e;
|
||||
}
|
||||
} catch (RuntimeException e4) {
|
||||
throw e4;
|
||||
}
|
||||
}
|
||||
|
||||
public void c(Iterable<T> iterable) {
|
||||
b(iterable, i());
|
||||
}
|
||||
|
||||
public void a(Iterable<T> iterable, boolean z) {
|
||||
a(this.f.c(), (Iterable) iterable, z);
|
||||
}
|
||||
|
||||
public void c(K k) {
|
||||
a();
|
||||
DatabaseStatement a = this.f.a();
|
||||
if (this.b.d()) {
|
||||
synchronized (a) {
|
||||
a((AbstractDao<T, K>) k, a);
|
||||
}
|
||||
} else {
|
||||
this.b.a();
|
||||
try {
|
||||
synchronized (a) {
|
||||
a((AbstractDao<T, K>) k, a);
|
||||
}
|
||||
this.b.c();
|
||||
} finally {
|
||||
this.b.e();
|
||||
}
|
||||
}
|
||||
IdentityScope<K, T> identityScope = this.d;
|
||||
if (identityScope != null) {
|
||||
identityScope.remove(k);
|
||||
}
|
||||
}
|
||||
|
||||
protected K e(T t) {
|
||||
K d = d((AbstractDao<T, K>) t);
|
||||
if (d != null) {
|
||||
return d;
|
||||
}
|
||||
if (t == null) {
|
||||
throw new NullPointerException("Entity may not be null");
|
||||
}
|
||||
throw new DaoException("Entity has no key");
|
||||
}
|
||||
|
||||
public void a(T... tArr) {
|
||||
b(Arrays.asList(tArr), i());
|
||||
}
|
||||
|
||||
private void a(DatabaseStatement databaseStatement, Iterable<T> iterable, boolean z) {
|
||||
this.b.a();
|
||||
try {
|
||||
synchronized (databaseStatement) {
|
||||
if (this.d != null) {
|
||||
this.d.lock();
|
||||
}
|
||||
try {
|
||||
if (this.c) {
|
||||
SQLiteStatement sQLiteStatement = (SQLiteStatement) databaseStatement.b();
|
||||
for (T t : iterable) {
|
||||
a(sQLiteStatement, (SQLiteStatement) t);
|
||||
if (z) {
|
||||
a((AbstractDao<T, K>) t, sQLiteStatement.executeInsert(), false);
|
||||
} else {
|
||||
sQLiteStatement.execute();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (T t2 : iterable) {
|
||||
a(databaseStatement, (DatabaseStatement) t2);
|
||||
if (z) {
|
||||
a((AbstractDao<T, K>) t2, databaseStatement.c(), false);
|
||||
} else {
|
||||
databaseStatement.execute();
|
||||
}
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
if (this.d != null) {
|
||||
this.d.unlock();
|
||||
}
|
||||
}
|
||||
}
|
||||
this.b.c();
|
||||
} finally {
|
||||
this.b.e();
|
||||
}
|
||||
}
|
||||
|
||||
private long b(T t, DatabaseStatement databaseStatement) {
|
||||
synchronized (databaseStatement) {
|
||||
if (this.c) {
|
||||
SQLiteStatement sQLiteStatement = (SQLiteStatement) databaseStatement.b();
|
||||
a(sQLiteStatement, (SQLiteStatement) t);
|
||||
return sQLiteStatement.executeInsert();
|
||||
}
|
||||
a(databaseStatement, (DatabaseStatement) t);
|
||||
return databaseStatement.c();
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX WARN: Removed duplicated region for block: B:15:0x0054 */
|
||||
/* JADX WARN: Removed duplicated region for block: B:26:0x007d */
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
||||
*/
|
||||
protected java.util.List<T> b(android.database.Cursor r7) {
|
||||
/*
|
||||
r6 = this;
|
||||
int r0 = r7.getCount()
|
||||
if (r0 != 0) goto Lc
|
||||
java.util.ArrayList r7 = new java.util.ArrayList
|
||||
r7.<init>()
|
||||
return r7
|
||||
Lc:
|
||||
java.util.ArrayList r1 = new java.util.ArrayList
|
||||
r1.<init>(r0)
|
||||
r2 = 0
|
||||
boolean r3 = r7 instanceof android.database.CrossProcessCursor
|
||||
r4 = 0
|
||||
if (r3 == 0) goto L4d
|
||||
r2 = r7
|
||||
android.database.CrossProcessCursor r2 = (android.database.CrossProcessCursor) r2
|
||||
android.database.CursorWindow r2 = r2.getWindow()
|
||||
if (r2 == 0) goto L4d
|
||||
int r3 = r2.getNumRows()
|
||||
if (r3 != r0) goto L2d
|
||||
org.greenrobot.greendao.internal.FastCursor r7 = new org.greenrobot.greendao.internal.FastCursor
|
||||
r7.<init>(r2)
|
||||
r3 = 1
|
||||
goto L4e
|
||||
L2d:
|
||||
java.lang.StringBuilder r3 = new java.lang.StringBuilder
|
||||
r3.<init>()
|
||||
java.lang.String r5 = "Window vs. result size: "
|
||||
r3.append(r5)
|
||||
int r5 = r2.getNumRows()
|
||||
r3.append(r5)
|
||||
java.lang.String r5 = "/"
|
||||
r3.append(r5)
|
||||
r3.append(r0)
|
||||
java.lang.String r3 = r3.toString()
|
||||
org.greenrobot.greendao.DaoLog.a(r3)
|
||||
L4d:
|
||||
r3 = 0
|
||||
L4e:
|
||||
boolean r5 = r7.moveToFirst()
|
||||
if (r5 == 0) goto L8a
|
||||
org.greenrobot.greendao.identityscope.IdentityScope<K, T> r5 = r6.d
|
||||
if (r5 == 0) goto L60
|
||||
r5.lock()
|
||||
org.greenrobot.greendao.identityscope.IdentityScope<K, T> r5 = r6.d
|
||||
r5.a(r0)
|
||||
L60:
|
||||
if (r3 != 0) goto L6c
|
||||
if (r2 == 0) goto L6c
|
||||
org.greenrobot.greendao.identityscope.IdentityScope<K, T> r0 = r6.d // Catch: java.lang.Throwable -> L81
|
||||
if (r0 == 0) goto L6c
|
||||
r6.a(r7, r2, r1) // Catch: java.lang.Throwable -> L81
|
||||
goto L79
|
||||
L6c:
|
||||
java.lang.Object r0 = r6.a(r7, r4, r4) // Catch: java.lang.Throwable -> L81
|
||||
r1.add(r0) // Catch: java.lang.Throwable -> L81
|
||||
boolean r0 = r7.moveToNext() // Catch: java.lang.Throwable -> L81
|
||||
if (r0 != 0) goto L6c
|
||||
L79:
|
||||
org.greenrobot.greendao.identityscope.IdentityScope<K, T> r7 = r6.d
|
||||
if (r7 == 0) goto L8a
|
||||
r7.unlock()
|
||||
goto L8a
|
||||
L81:
|
||||
r7 = move-exception
|
||||
org.greenrobot.greendao.identityscope.IdentityScope<K, T> r0 = r6.d
|
||||
if (r0 == 0) goto L89
|
||||
r0.unlock()
|
||||
L89:
|
||||
throw r7
|
||||
L8a:
|
||||
return r1
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: org.greenrobot.greendao.AbstractDao.b(android.database.Cursor):java.util.List");
|
||||
}
|
||||
|
||||
public Database d() {
|
||||
return this.b;
|
||||
}
|
||||
|
||||
protected void a(T t, long j, boolean z) {
|
||||
if (j != -1) {
|
||||
a((AbstractDao<T, K>) a((AbstractDao<T, K>) t, j), (K) t, z);
|
||||
} else {
|
||||
DaoLog.b("Could not insert row (executeInsert returned -1)");
|
||||
}
|
||||
}
|
||||
|
||||
private void a(Cursor cursor, CursorWindow cursorWindow, List<T> list) {
|
||||
int startPosition = cursorWindow.getStartPosition() + cursorWindow.getNumRows();
|
||||
int i = 0;
|
||||
while (true) {
|
||||
list.add(a(cursor, 0, false));
|
||||
int i2 = i + 1;
|
||||
if (i2 >= startPosition) {
|
||||
CursorWindow e = e(cursor);
|
||||
if (e == null) {
|
||||
return;
|
||||
} else {
|
||||
startPosition = e.getStartPosition() + e.getNumRows();
|
||||
}
|
||||
} else if (!cursor.moveToNext()) {
|
||||
return;
|
||||
}
|
||||
i = i2 + 1;
|
||||
}
|
||||
}
|
||||
|
||||
public void b() {
|
||||
this.b.a("DELETE FROM '" + this.a.b + "'");
|
||||
IdentityScope<K, T> identityScope = this.d;
|
||||
if (identityScope != null) {
|
||||
identityScope.clear();
|
||||
}
|
||||
}
|
||||
|
||||
protected final T a(Cursor cursor, int i, boolean z) {
|
||||
if (this.e != null) {
|
||||
if (i != 0 && cursor.isNull(this.h + i)) {
|
||||
return null;
|
||||
}
|
||||
long j = cursor.getLong(this.h + i);
|
||||
IdentityScopeLong<T> identityScopeLong = this.e;
|
||||
T a = z ? identityScopeLong.a(j) : identityScopeLong.b(j);
|
||||
if (a != null) {
|
||||
return a;
|
||||
}
|
||||
T a2 = a(cursor, i);
|
||||
a((AbstractDao<T, K>) a2);
|
||||
if (z) {
|
||||
this.e.a(j, (long) a2);
|
||||
} else {
|
||||
this.e.b(j, (long) a2);
|
||||
}
|
||||
return a2;
|
||||
}
|
||||
if (this.d != null) {
|
||||
K b = b(cursor, i);
|
||||
if (i != 0 && b == null) {
|
||||
return null;
|
||||
}
|
||||
IdentityScope<K, T> identityScope = this.d;
|
||||
T a3 = z ? identityScope.get(b) : identityScope.a((IdentityScope<K, T>) b);
|
||||
if (a3 != null) {
|
||||
return a3;
|
||||
}
|
||||
T a4 = a(cursor, i);
|
||||
a((AbstractDao<T, K>) b, (K) a4, z);
|
||||
return a4;
|
||||
}
|
||||
if (i != 0 && b(cursor, i) == null) {
|
||||
return null;
|
||||
}
|
||||
T a5 = a(cursor, i);
|
||||
a((AbstractDao<T, K>) a5);
|
||||
return a5;
|
||||
}
|
||||
|
||||
public void b(T t) {
|
||||
a();
|
||||
c((AbstractDao<T, K>) e((AbstractDao<T, K>) t));
|
||||
}
|
||||
|
||||
public void b(T... tArr) {
|
||||
d((Iterable) Arrays.asList(tArr));
|
||||
}
|
||||
|
||||
/* JADX WARN: Multi-variable type inference failed */
|
||||
private void a(K k, DatabaseStatement databaseStatement) {
|
||||
if (k instanceof Long) {
|
||||
databaseStatement.a(1, ((Long) k).longValue());
|
||||
} else if (k != 0) {
|
||||
databaseStatement.a(1, k.toString());
|
||||
} else {
|
||||
throw new DaoException("Cannot delete entity, key is null");
|
||||
}
|
||||
databaseStatement.execute();
|
||||
}
|
||||
|
||||
private void a(Iterable<T> iterable, Iterable<K> iterable2) {
|
||||
ArrayList arrayList;
|
||||
a();
|
||||
DatabaseStatement a = this.f.a();
|
||||
this.b.a();
|
||||
try {
|
||||
synchronized (a) {
|
||||
if (this.d != null) {
|
||||
this.d.lock();
|
||||
arrayList = new ArrayList();
|
||||
} else {
|
||||
arrayList = null;
|
||||
}
|
||||
if (iterable != null) {
|
||||
try {
|
||||
Iterator<T> it = iterable.iterator();
|
||||
while (it.hasNext()) {
|
||||
K e = e((AbstractDao<T, K>) it.next());
|
||||
a((AbstractDao<T, K>) e, a);
|
||||
if (arrayList != null) {
|
||||
arrayList.add(e);
|
||||
}
|
||||
}
|
||||
} catch (Throwable th) {
|
||||
if (this.d != null) {
|
||||
this.d.unlock();
|
||||
}
|
||||
throw th;
|
||||
}
|
||||
}
|
||||
if (iterable2 != null) {
|
||||
for (K k : iterable2) {
|
||||
a((AbstractDao<T, K>) k, a);
|
||||
if (arrayList != null) {
|
||||
arrayList.add(k);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.d != null) {
|
||||
this.d.unlock();
|
||||
}
|
||||
}
|
||||
this.b.c();
|
||||
if (arrayList != null && this.d != null) {
|
||||
this.d.a((Iterable) arrayList);
|
||||
}
|
||||
} finally {
|
||||
this.b.e();
|
||||
}
|
||||
}
|
||||
|
||||
public void a(Iterable<T> iterable) {
|
||||
a(iterable, (Iterable) null);
|
||||
}
|
||||
|
||||
/* JADX WARN: Multi-variable type inference failed */
|
||||
protected void a(T t, DatabaseStatement databaseStatement, boolean z) {
|
||||
a(databaseStatement, (DatabaseStatement) t);
|
||||
int length = this.a.d.length + 1;
|
||||
Object d = d((AbstractDao<T, K>) t);
|
||||
if (d instanceof Long) {
|
||||
databaseStatement.a(length, ((Long) d).longValue());
|
||||
} else if (d != null) {
|
||||
databaseStatement.a(length, d.toString());
|
||||
} else {
|
||||
throw new DaoException("Cannot update entity without key - was it inserted before?");
|
||||
}
|
||||
databaseStatement.execute();
|
||||
a((AbstractDao<T, K>) d, t, z);
|
||||
}
|
||||
|
||||
/* JADX WARN: Multi-variable type inference failed */
|
||||
protected void a(T t, SQLiteStatement sQLiteStatement, boolean z) {
|
||||
a(sQLiteStatement, (SQLiteStatement) t);
|
||||
int length = this.a.d.length + 1;
|
||||
Object d = d((AbstractDao<T, K>) t);
|
||||
if (d instanceof Long) {
|
||||
sQLiteStatement.bindLong(length, ((Long) d).longValue());
|
||||
} else if (d != null) {
|
||||
sQLiteStatement.bindString(length, d.toString());
|
||||
} else {
|
||||
throw new DaoException("Cannot update entity without key - was it inserted before?");
|
||||
}
|
||||
sQLiteStatement.execute();
|
||||
a((AbstractDao<T, K>) d, t, z);
|
||||
}
|
||||
|
||||
protected final void a(K k, T t, boolean z) {
|
||||
a((AbstractDao<T, K>) t);
|
||||
IdentityScope<K, T> identityScope = this.d;
|
||||
if (identityScope == null || k == null) {
|
||||
return;
|
||||
}
|
||||
if (z) {
|
||||
identityScope.put(k, t);
|
||||
} else {
|
||||
identityScope.a(k, t);
|
||||
}
|
||||
}
|
||||
|
||||
protected void a() {
|
||||
if (this.a.e.length == 1) {
|
||||
return;
|
||||
}
|
||||
throw new DaoException(this + " (" + this.a.b + ") does not have a single-column primary key");
|
||||
}
|
||||
}
|
35
sources/org/greenrobot/greendao/AbstractDaoMaster.java
Normal file
35
sources/org/greenrobot/greendao/AbstractDaoMaster.java
Normal file
@@ -0,0 +1,35 @@
|
||||
package org.greenrobot.greendao;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import org.greenrobot.greendao.database.Database;
|
||||
import org.greenrobot.greendao.identityscope.IdentityScopeType;
|
||||
import org.greenrobot.greendao.internal.DaoConfig;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public abstract class AbstractDaoMaster {
|
||||
protected final Map<Class<? extends AbstractDao<?, ?>>, DaoConfig> daoConfigMap = new HashMap();
|
||||
protected final Database db;
|
||||
protected final int schemaVersion;
|
||||
|
||||
public AbstractDaoMaster(Database database, int i) {
|
||||
this.db = database;
|
||||
this.schemaVersion = i;
|
||||
}
|
||||
|
||||
public Database getDatabase() {
|
||||
return this.db;
|
||||
}
|
||||
|
||||
public int getSchemaVersion() {
|
||||
return this.schemaVersion;
|
||||
}
|
||||
|
||||
public abstract AbstractDaoSession newSession();
|
||||
|
||||
public abstract AbstractDaoSession newSession(IdentityScopeType identityScopeType);
|
||||
|
||||
protected void registerDaoClass(Class<? extends AbstractDao<?, ?>> cls) {
|
||||
this.daoConfigMap.put(cls, new DaoConfig(this.db, cls));
|
||||
}
|
||||
}
|
40
sources/org/greenrobot/greendao/AbstractDaoSession.java
Normal file
40
sources/org/greenrobot/greendao/AbstractDaoSession.java
Normal file
@@ -0,0 +1,40 @@
|
||||
package org.greenrobot.greendao;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import org.greenrobot.greendao.database.Database;
|
||||
import org.greenrobot.greendao.query.QueryBuilder;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class AbstractDaoSession {
|
||||
private final Map<Class<?>, AbstractDao<?, ?>> a = new HashMap();
|
||||
|
||||
public AbstractDaoSession(Database database) {
|
||||
}
|
||||
|
||||
protected <T> void a(Class<T> cls, AbstractDao<T, ?> abstractDao) {
|
||||
this.a.put(cls, abstractDao);
|
||||
}
|
||||
|
||||
/* JADX WARN: Multi-variable type inference failed */
|
||||
public <T> long b(T t) {
|
||||
return a((Class<? extends Object>) t.getClass()).g(t);
|
||||
}
|
||||
|
||||
/* JADX WARN: Multi-variable type inference failed */
|
||||
public <T> void a(T t) {
|
||||
a((Class<? extends Object>) t.getClass()).b((AbstractDao<?, ?>) t);
|
||||
}
|
||||
|
||||
public <T> QueryBuilder<T> b(Class<T> cls) {
|
||||
return (QueryBuilder<T>) a((Class<? extends Object>) cls).k();
|
||||
}
|
||||
|
||||
public AbstractDao<?, ?> a(Class<? extends Object> cls) {
|
||||
AbstractDao<?, ?> abstractDao = this.a.get(cls);
|
||||
if (abstractDao != null) {
|
||||
return abstractDao;
|
||||
}
|
||||
throw new DaoException("No DAO registered for " + cls);
|
||||
}
|
||||
}
|
33
sources/org/greenrobot/greendao/DaoException.java
Normal file
33
sources/org/greenrobot/greendao/DaoException.java
Normal file
@@ -0,0 +1,33 @@
|
||||
package org.greenrobot.greendao;
|
||||
|
||||
import android.database.SQLException;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class DaoException extends SQLException {
|
||||
private static final long serialVersionUID = -5877937327907457779L;
|
||||
|
||||
public DaoException() {
|
||||
}
|
||||
|
||||
protected void safeInitCause(Throwable th) {
|
||||
try {
|
||||
initCause(th);
|
||||
} catch (Throwable th2) {
|
||||
DaoLog.a("Could not set initial cause", th2);
|
||||
DaoLog.a("Initial cause is:", th);
|
||||
}
|
||||
}
|
||||
|
||||
public DaoException(String str) {
|
||||
super(str);
|
||||
}
|
||||
|
||||
public DaoException(String str, Throwable th) {
|
||||
super(str);
|
||||
safeInitCause(th);
|
||||
}
|
||||
|
||||
public DaoException(Throwable th) {
|
||||
safeInitCause(th);
|
||||
}
|
||||
}
|
22
sources/org/greenrobot/greendao/DaoLog.java
Normal file
22
sources/org/greenrobot/greendao/DaoLog.java
Normal file
@@ -0,0 +1,22 @@
|
||||
package org.greenrobot.greendao;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class DaoLog {
|
||||
public static int a(String str) {
|
||||
return Log.d("greenDAO", str);
|
||||
}
|
||||
|
||||
public static int b(String str) {
|
||||
return Log.w("greenDAO", str);
|
||||
}
|
||||
|
||||
public static int a(String str, Throwable th) {
|
||||
return Log.e("greenDAO", str, th);
|
||||
}
|
||||
|
||||
public static int b(String str, Throwable th) {
|
||||
return Log.w("greenDAO", str, th);
|
||||
}
|
||||
}
|
21
sources/org/greenrobot/greendao/InternalQueryDaoAccess.java
Normal file
21
sources/org/greenrobot/greendao/InternalQueryDaoAccess.java
Normal file
@@ -0,0 +1,21 @@
|
||||
package org.greenrobot.greendao;
|
||||
|
||||
import android.database.Cursor;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public final class InternalQueryDaoAccess<T> {
|
||||
private final AbstractDao<T, ?> a;
|
||||
|
||||
public InternalQueryDaoAccess(AbstractDao<T, ?> abstractDao) {
|
||||
this.a = abstractDao;
|
||||
}
|
||||
|
||||
public List<T> a(Cursor cursor) {
|
||||
return this.a.a(cursor);
|
||||
}
|
||||
|
||||
public T b(Cursor cursor) {
|
||||
return this.a.d(cursor);
|
||||
}
|
||||
}
|
48
sources/org/greenrobot/greendao/Property.java
Normal file
48
sources/org/greenrobot/greendao/Property.java
Normal file
@@ -0,0 +1,48 @@
|
||||
package org.greenrobot.greendao;
|
||||
|
||||
import org.greenrobot.greendao.query.WhereCondition;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class Property {
|
||||
public final int a;
|
||||
public final Class<?> b;
|
||||
public final String c;
|
||||
public final boolean d;
|
||||
public final String e;
|
||||
|
||||
public Property(int i, Class<?> cls, String str, boolean z, String str2) {
|
||||
this.a = i;
|
||||
this.b = cls;
|
||||
this.c = str;
|
||||
this.d = z;
|
||||
this.e = str2;
|
||||
}
|
||||
|
||||
public WhereCondition a(Object obj) {
|
||||
return new WhereCondition.PropertyCondition(this, "=?", obj);
|
||||
}
|
||||
|
||||
public WhereCondition b(Object obj) {
|
||||
return new WhereCondition.PropertyCondition(this, ">?", obj);
|
||||
}
|
||||
|
||||
public WhereCondition c(Object obj) {
|
||||
return new WhereCondition.PropertyCondition(this, "<=?", obj);
|
||||
}
|
||||
|
||||
public WhereCondition d(Object obj) {
|
||||
return new WhereCondition.PropertyCondition(this, "<>?", obj);
|
||||
}
|
||||
|
||||
public WhereCondition a(String str) {
|
||||
return new WhereCondition.PropertyCondition(this, " LIKE ?", str);
|
||||
}
|
||||
|
||||
public WhereCondition b() {
|
||||
return new WhereCondition.PropertyCondition(this, " IS NULL");
|
||||
}
|
||||
|
||||
public WhereCondition a() {
|
||||
return new WhereCondition.PropertyCondition(this, " IS NOT NULL");
|
||||
}
|
||||
}
|
18
sources/org/greenrobot/greendao/async/AsyncDaoException.java
Normal file
18
sources/org/greenrobot/greendao/async/AsyncDaoException.java
Normal file
@@ -0,0 +1,18 @@
|
||||
package org.greenrobot.greendao.async;
|
||||
|
||||
import org.greenrobot.greendao.DaoException;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class AsyncDaoException extends DaoException {
|
||||
private static final long serialVersionUID = 5872157552005102382L;
|
||||
private final AsyncOperation failedOperation;
|
||||
|
||||
public AsyncDaoException(AsyncOperation asyncOperation, Throwable th) {
|
||||
super(th);
|
||||
this.failedOperation = asyncOperation;
|
||||
}
|
||||
|
||||
public AsyncOperation getFailedOperation() {
|
||||
return this.failedOperation;
|
||||
}
|
||||
}
|
30
sources/org/greenrobot/greendao/async/AsyncOperation.java
Normal file
30
sources/org/greenrobot/greendao/async/AsyncOperation.java
Normal file
@@ -0,0 +1,30 @@
|
||||
package org.greenrobot.greendao.async;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class AsyncOperation {
|
||||
|
||||
public enum OperationType {
|
||||
Insert,
|
||||
InsertInTxIterable,
|
||||
InsertInTxArray,
|
||||
InsertOrReplace,
|
||||
InsertOrReplaceInTxIterable,
|
||||
InsertOrReplaceInTxArray,
|
||||
Update,
|
||||
UpdateInTxIterable,
|
||||
UpdateInTxArray,
|
||||
Delete,
|
||||
DeleteInTxIterable,
|
||||
DeleteInTxArray,
|
||||
DeleteByKey,
|
||||
DeleteAll,
|
||||
TransactionRunnable,
|
||||
TransactionCallable,
|
||||
QueryList,
|
||||
QueryUnique,
|
||||
Load,
|
||||
LoadAll,
|
||||
Count,
|
||||
Refresh
|
||||
}
|
||||
}
|
@@ -0,0 +1,5 @@
|
||||
package org.greenrobot.greendao.converter;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public interface PropertyConverter<P, D> {
|
||||
}
|
23
sources/org/greenrobot/greendao/database/Database.java
Normal file
23
sources/org/greenrobot/greendao/database/Database.java
Normal file
@@ -0,0 +1,23 @@
|
||||
package org.greenrobot.greendao.database;
|
||||
|
||||
import android.database.Cursor;
|
||||
import android.database.SQLException;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public interface Database {
|
||||
Cursor a(String str, String[] strArr);
|
||||
|
||||
void a();
|
||||
|
||||
void a(String str) throws SQLException;
|
||||
|
||||
Object b();
|
||||
|
||||
DatabaseStatement b(String str);
|
||||
|
||||
void c();
|
||||
|
||||
boolean d();
|
||||
|
||||
void e();
|
||||
}
|
120
sources/org/greenrobot/greendao/database/DatabaseOpenHelper.java
Normal file
120
sources/org/greenrobot/greendao/database/DatabaseOpenHelper.java
Normal file
@@ -0,0 +1,120 @@
|
||||
package org.greenrobot.greendao.database;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.database.DatabaseErrorHandler;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.database.sqlite.SQLiteOpenHelper;
|
||||
import org.greenrobot.greendao.DaoException;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public abstract class DatabaseOpenHelper extends SQLiteOpenHelper {
|
||||
private final Context context;
|
||||
private EncryptedHelper encryptedHelper;
|
||||
private boolean loadSQLCipherNativeLibs;
|
||||
private final String name;
|
||||
private final int version;
|
||||
|
||||
interface EncryptedHelper {
|
||||
Database a(String str);
|
||||
|
||||
Database a(char[] cArr);
|
||||
|
||||
Database b(String str);
|
||||
|
||||
Database b(char[] cArr);
|
||||
}
|
||||
|
||||
public DatabaseOpenHelper(Context context, String str, int i) {
|
||||
this(context, str, null, i);
|
||||
}
|
||||
|
||||
private EncryptedHelper checkEncryptedHelper() {
|
||||
if (this.encryptedHelper == null) {
|
||||
try {
|
||||
Class.forName("net.sqlcipher.database.SQLiteOpenHelper");
|
||||
try {
|
||||
this.encryptedHelper = (EncryptedHelper) Class.forName("org.greenrobot.greendao.database.SqlCipherEncryptedHelper").getConstructor(DatabaseOpenHelper.class, Context.class, String.class, Integer.TYPE, Boolean.TYPE).newInstance(this, this.context, this.name, Integer.valueOf(this.version), Boolean.valueOf(this.loadSQLCipherNativeLibs));
|
||||
} catch (Exception e) {
|
||||
throw new DaoException(e);
|
||||
}
|
||||
} catch (ClassNotFoundException unused) {
|
||||
throw new DaoException("Using an encrypted database requires SQLCipher, make sure to add it to dependencies: https://greenrobot.org/greendao/documentation/database-encryption/");
|
||||
}
|
||||
}
|
||||
return this.encryptedHelper;
|
||||
}
|
||||
|
||||
public Database getEncryptedReadableDb(String str) {
|
||||
return checkEncryptedHelper().a(str);
|
||||
}
|
||||
|
||||
public Database getEncryptedWritableDb(String str) {
|
||||
return checkEncryptedHelper().b(str);
|
||||
}
|
||||
|
||||
public Database getReadableDb() {
|
||||
return wrap(getReadableDatabase());
|
||||
}
|
||||
|
||||
public Database getWritableDb() {
|
||||
return wrap(getWritableDatabase());
|
||||
}
|
||||
|
||||
@Override // android.database.sqlite.SQLiteOpenHelper
|
||||
public void onCreate(SQLiteDatabase sQLiteDatabase) {
|
||||
onCreate(wrap(sQLiteDatabase));
|
||||
}
|
||||
|
||||
public void onCreate(Database database) {
|
||||
}
|
||||
|
||||
@Override // android.database.sqlite.SQLiteOpenHelper
|
||||
public void onOpen(SQLiteDatabase sQLiteDatabase) {
|
||||
onOpen(wrap(sQLiteDatabase));
|
||||
}
|
||||
|
||||
public void onOpen(Database database) {
|
||||
}
|
||||
|
||||
@Override // android.database.sqlite.SQLiteOpenHelper
|
||||
public void onUpgrade(SQLiteDatabase sQLiteDatabase, int i, int i2) {
|
||||
onUpgrade(wrap(sQLiteDatabase), i, i2);
|
||||
}
|
||||
|
||||
public void onUpgrade(Database database, int i, int i2) {
|
||||
}
|
||||
|
||||
public void setLoadSQLCipherNativeLibs(boolean z) {
|
||||
this.loadSQLCipherNativeLibs = z;
|
||||
}
|
||||
|
||||
protected Database wrap(SQLiteDatabase sQLiteDatabase) {
|
||||
return new StandardDatabase(sQLiteDatabase);
|
||||
}
|
||||
|
||||
public DatabaseOpenHelper(Context context, String str, SQLiteDatabase.CursorFactory cursorFactory, int i) {
|
||||
super(context, str, cursorFactory, i);
|
||||
this.loadSQLCipherNativeLibs = true;
|
||||
this.context = context;
|
||||
this.name = str;
|
||||
this.version = i;
|
||||
}
|
||||
|
||||
public Database getEncryptedReadableDb(char[] cArr) {
|
||||
return checkEncryptedHelper().a(cArr);
|
||||
}
|
||||
|
||||
public Database getEncryptedWritableDb(char[] cArr) {
|
||||
return checkEncryptedHelper().b(cArr);
|
||||
}
|
||||
|
||||
@SuppressLint({"NewApi"})
|
||||
public DatabaseOpenHelper(Context context, String str, SQLiteDatabase.CursorFactory cursorFactory, int i, DatabaseErrorHandler databaseErrorHandler) {
|
||||
super(context, str, cursorFactory, i, databaseErrorHandler);
|
||||
this.loadSQLCipherNativeLibs = true;
|
||||
this.context = context;
|
||||
this.name = str;
|
||||
this.version = i;
|
||||
}
|
||||
}
|
@@ -0,0 +1,20 @@
|
||||
package org.greenrobot.greendao.database;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public interface DatabaseStatement {
|
||||
void a();
|
||||
|
||||
void a(int i, double d);
|
||||
|
||||
void a(int i, long j);
|
||||
|
||||
void a(int i, String str);
|
||||
|
||||
Object b();
|
||||
|
||||
long c();
|
||||
|
||||
void close();
|
||||
|
||||
void execute();
|
||||
}
|
@@ -0,0 +1,54 @@
|
||||
package org.greenrobot.greendao.database;
|
||||
|
||||
import android.database.Cursor;
|
||||
import android.database.SQLException;
|
||||
import net.sqlcipher.database.SQLiteDatabase;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class EncryptedDatabase implements Database {
|
||||
private final SQLiteDatabase a;
|
||||
|
||||
public EncryptedDatabase(SQLiteDatabase sQLiteDatabase) {
|
||||
this.a = sQLiteDatabase;
|
||||
}
|
||||
|
||||
@Override // org.greenrobot.greendao.database.Database
|
||||
public Cursor a(String str, String[] strArr) {
|
||||
return this.a.rawQuery(str, strArr);
|
||||
}
|
||||
|
||||
@Override // org.greenrobot.greendao.database.Database
|
||||
public DatabaseStatement b(String str) {
|
||||
return new EncryptedDatabaseStatement(this.a.compileStatement(str));
|
||||
}
|
||||
|
||||
@Override // org.greenrobot.greendao.database.Database
|
||||
public void c() {
|
||||
this.a.setTransactionSuccessful();
|
||||
}
|
||||
|
||||
@Override // org.greenrobot.greendao.database.Database
|
||||
public boolean d() {
|
||||
return this.a.isDbLockedByCurrentThread();
|
||||
}
|
||||
|
||||
@Override // org.greenrobot.greendao.database.Database
|
||||
public void e() {
|
||||
this.a.endTransaction();
|
||||
}
|
||||
|
||||
@Override // org.greenrobot.greendao.database.Database
|
||||
public void a(String str) throws SQLException {
|
||||
this.a.execSQL(str);
|
||||
}
|
||||
|
||||
@Override // org.greenrobot.greendao.database.Database
|
||||
public Object b() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
@Override // org.greenrobot.greendao.database.Database
|
||||
public void a() {
|
||||
this.a.beginTransaction();
|
||||
}
|
||||
}
|
@@ -0,0 +1,52 @@
|
||||
package org.greenrobot.greendao.database;
|
||||
|
||||
import net.sqlcipher.database.SQLiteStatement;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class EncryptedDatabaseStatement implements DatabaseStatement {
|
||||
private final SQLiteStatement a;
|
||||
|
||||
public EncryptedDatabaseStatement(SQLiteStatement sQLiteStatement) {
|
||||
this.a = sQLiteStatement;
|
||||
}
|
||||
|
||||
@Override // org.greenrobot.greendao.database.DatabaseStatement
|
||||
public void a(int i, String str) {
|
||||
this.a.bindString(i, str);
|
||||
}
|
||||
|
||||
@Override // org.greenrobot.greendao.database.DatabaseStatement
|
||||
public Object b() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
@Override // org.greenrobot.greendao.database.DatabaseStatement
|
||||
public long c() {
|
||||
return this.a.executeInsert();
|
||||
}
|
||||
|
||||
@Override // org.greenrobot.greendao.database.DatabaseStatement
|
||||
public void close() {
|
||||
this.a.close();
|
||||
}
|
||||
|
||||
@Override // org.greenrobot.greendao.database.DatabaseStatement
|
||||
public void execute() {
|
||||
this.a.execute();
|
||||
}
|
||||
|
||||
@Override // org.greenrobot.greendao.database.DatabaseStatement
|
||||
public void a(int i, long j) {
|
||||
this.a.bindLong(i, j);
|
||||
}
|
||||
|
||||
@Override // org.greenrobot.greendao.database.DatabaseStatement
|
||||
public void a() {
|
||||
this.a.clearBindings();
|
||||
}
|
||||
|
||||
@Override // org.greenrobot.greendao.database.DatabaseStatement
|
||||
public void a(int i, double d) {
|
||||
this.a.bindDouble(i, d);
|
||||
}
|
||||
}
|
@@ -0,0 +1,32 @@
|
||||
package org.greenrobot.greendao.database;
|
||||
|
||||
import net.sqlcipher.database.SQLiteDatabase;
|
||||
import net.sqlcipher.database.SQLiteOpenHelper;
|
||||
import org.greenrobot.greendao.database.DatabaseOpenHelper;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
class SqlCipherEncryptedHelper extends SQLiteOpenHelper implements DatabaseOpenHelper.EncryptedHelper {
|
||||
private Database a(SQLiteDatabase sQLiteDatabase) {
|
||||
return new EncryptedDatabase(sQLiteDatabase);
|
||||
}
|
||||
|
||||
@Override // org.greenrobot.greendao.database.DatabaseOpenHelper.EncryptedHelper
|
||||
public Database b(String str) {
|
||||
return a(getWritableDatabase(str));
|
||||
}
|
||||
|
||||
@Override // org.greenrobot.greendao.database.DatabaseOpenHelper.EncryptedHelper
|
||||
public Database a(String str) {
|
||||
return a(getReadableDatabase(str));
|
||||
}
|
||||
|
||||
@Override // org.greenrobot.greendao.database.DatabaseOpenHelper.EncryptedHelper
|
||||
public Database b(char[] cArr) {
|
||||
return a(getWritableDatabase(cArr));
|
||||
}
|
||||
|
||||
@Override // org.greenrobot.greendao.database.DatabaseOpenHelper.EncryptedHelper
|
||||
public Database a(char[] cArr) {
|
||||
return a(getReadableDatabase(cArr));
|
||||
}
|
||||
}
|
@@ -0,0 +1,54 @@
|
||||
package org.greenrobot.greendao.database;
|
||||
|
||||
import android.database.Cursor;
|
||||
import android.database.SQLException;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class StandardDatabase implements Database {
|
||||
private final SQLiteDatabase a;
|
||||
|
||||
public StandardDatabase(SQLiteDatabase sQLiteDatabase) {
|
||||
this.a = sQLiteDatabase;
|
||||
}
|
||||
|
||||
@Override // org.greenrobot.greendao.database.Database
|
||||
public Cursor a(String str, String[] strArr) {
|
||||
return this.a.rawQuery(str, strArr);
|
||||
}
|
||||
|
||||
@Override // org.greenrobot.greendao.database.Database
|
||||
public DatabaseStatement b(String str) {
|
||||
return new StandardDatabaseStatement(this.a.compileStatement(str));
|
||||
}
|
||||
|
||||
@Override // org.greenrobot.greendao.database.Database
|
||||
public void c() {
|
||||
this.a.setTransactionSuccessful();
|
||||
}
|
||||
|
||||
@Override // org.greenrobot.greendao.database.Database
|
||||
public boolean d() {
|
||||
return this.a.isDbLockedByCurrentThread();
|
||||
}
|
||||
|
||||
@Override // org.greenrobot.greendao.database.Database
|
||||
public void e() {
|
||||
this.a.endTransaction();
|
||||
}
|
||||
|
||||
@Override // org.greenrobot.greendao.database.Database
|
||||
public void a(String str) throws SQLException {
|
||||
this.a.execSQL(str);
|
||||
}
|
||||
|
||||
@Override // org.greenrobot.greendao.database.Database
|
||||
public Object b() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
@Override // org.greenrobot.greendao.database.Database
|
||||
public void a() {
|
||||
this.a.beginTransaction();
|
||||
}
|
||||
}
|
@@ -0,0 +1,52 @@
|
||||
package org.greenrobot.greendao.database;
|
||||
|
||||
import android.database.sqlite.SQLiteStatement;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class StandardDatabaseStatement implements DatabaseStatement {
|
||||
private final SQLiteStatement a;
|
||||
|
||||
public StandardDatabaseStatement(SQLiteStatement sQLiteStatement) {
|
||||
this.a = sQLiteStatement;
|
||||
}
|
||||
|
||||
@Override // org.greenrobot.greendao.database.DatabaseStatement
|
||||
public void a(int i, String str) {
|
||||
this.a.bindString(i, str);
|
||||
}
|
||||
|
||||
@Override // org.greenrobot.greendao.database.DatabaseStatement
|
||||
public Object b() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
@Override // org.greenrobot.greendao.database.DatabaseStatement
|
||||
public long c() {
|
||||
return this.a.executeInsert();
|
||||
}
|
||||
|
||||
@Override // org.greenrobot.greendao.database.DatabaseStatement
|
||||
public void close() {
|
||||
this.a.close();
|
||||
}
|
||||
|
||||
@Override // org.greenrobot.greendao.database.DatabaseStatement
|
||||
public void execute() {
|
||||
this.a.execute();
|
||||
}
|
||||
|
||||
@Override // org.greenrobot.greendao.database.DatabaseStatement
|
||||
public void a(int i, long j) {
|
||||
this.a.bindLong(i, j);
|
||||
}
|
||||
|
||||
@Override // org.greenrobot.greendao.database.DatabaseStatement
|
||||
public void a() {
|
||||
this.a.clearBindings();
|
||||
}
|
||||
|
||||
@Override // org.greenrobot.greendao.database.DatabaseStatement
|
||||
public void a(int i, double d) {
|
||||
this.a.bindDouble(i, d);
|
||||
}
|
||||
}
|
@@ -0,0 +1,24 @@
|
||||
package org.greenrobot.greendao.identityscope;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public interface IdentityScope<K, T> {
|
||||
T a(K k);
|
||||
|
||||
void a(int i);
|
||||
|
||||
void a(Iterable<K> iterable);
|
||||
|
||||
void a(K k, T t);
|
||||
|
||||
void clear();
|
||||
|
||||
T get(K k);
|
||||
|
||||
void lock();
|
||||
|
||||
void put(K k, T t);
|
||||
|
||||
void remove(K k);
|
||||
|
||||
void unlock();
|
||||
}
|
@@ -0,0 +1,129 @@
|
||||
package org.greenrobot.greendao.identityscope;
|
||||
|
||||
import java.lang.ref.Reference;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.Iterator;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
import org.greenrobot.greendao.internal.LongHashMap;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class IdentityScopeLong<T> implements IdentityScope<Long, T> {
|
||||
private final LongHashMap<Reference<T>> a = new LongHashMap<>();
|
||||
private final ReentrantLock b = new ReentrantLock();
|
||||
|
||||
@Override // org.greenrobot.greendao.identityscope.IdentityScope
|
||||
/* renamed from: b, reason: merged with bridge method [inline-methods] */
|
||||
public T a(Long l) {
|
||||
return b(l.longValue());
|
||||
}
|
||||
|
||||
@Override // org.greenrobot.greendao.identityscope.IdentityScope
|
||||
/* renamed from: c, reason: merged with bridge method [inline-methods] */
|
||||
public void remove(Long l) {
|
||||
this.b.lock();
|
||||
try {
|
||||
this.a.b(l.longValue());
|
||||
} finally {
|
||||
this.b.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // org.greenrobot.greendao.identityscope.IdentityScope
|
||||
public void clear() {
|
||||
this.b.lock();
|
||||
try {
|
||||
this.a.a();
|
||||
} finally {
|
||||
this.b.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // org.greenrobot.greendao.identityscope.IdentityScope
|
||||
public void lock() {
|
||||
this.b.lock();
|
||||
}
|
||||
|
||||
/* JADX WARN: Multi-variable type inference failed */
|
||||
@Override // org.greenrobot.greendao.identityscope.IdentityScope
|
||||
public /* bridge */ /* synthetic */ void put(Long l, Object obj) {
|
||||
a2(l, (Long) obj);
|
||||
}
|
||||
|
||||
@Override // org.greenrobot.greendao.identityscope.IdentityScope
|
||||
public void unlock() {
|
||||
this.b.unlock();
|
||||
}
|
||||
|
||||
/* JADX WARN: Multi-variable type inference failed */
|
||||
@Override // org.greenrobot.greendao.identityscope.IdentityScope
|
||||
public /* bridge */ /* synthetic */ void a(Long l, Object obj) {
|
||||
b(l, (Long) obj);
|
||||
}
|
||||
|
||||
public T b(long j) {
|
||||
Reference<T> a = this.a.a(j);
|
||||
if (a != null) {
|
||||
return a.get();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // org.greenrobot.greendao.identityscope.IdentityScope
|
||||
/* renamed from: a, reason: avoid collision after fix types in other method and merged with bridge method [inline-methods] */
|
||||
public T get(Long l) {
|
||||
return a(l.longValue());
|
||||
}
|
||||
|
||||
public T a(long j) {
|
||||
this.b.lock();
|
||||
try {
|
||||
Reference<T> a = this.a.a(j);
|
||||
if (a != null) {
|
||||
return a.get();
|
||||
}
|
||||
return null;
|
||||
} finally {
|
||||
this.b.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
public void b(Long l, T t) {
|
||||
b(l.longValue(), (long) t);
|
||||
}
|
||||
|
||||
public void b(long j, T t) {
|
||||
this.a.a(j, new WeakReference(t));
|
||||
}
|
||||
|
||||
/* renamed from: a, reason: avoid collision after fix types in other method */
|
||||
public void a2(Long l, T t) {
|
||||
a(l.longValue(), (long) t);
|
||||
}
|
||||
|
||||
public void a(long j, T t) {
|
||||
this.b.lock();
|
||||
try {
|
||||
this.a.a(j, new WeakReference(t));
|
||||
} finally {
|
||||
this.b.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // org.greenrobot.greendao.identityscope.IdentityScope
|
||||
public void a(Iterable<Long> iterable) {
|
||||
this.b.lock();
|
||||
try {
|
||||
Iterator<Long> it = iterable.iterator();
|
||||
while (it.hasNext()) {
|
||||
this.a.b(it.next().longValue());
|
||||
}
|
||||
} finally {
|
||||
this.b.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // org.greenrobot.greendao.identityscope.IdentityScope
|
||||
public void a(int i) {
|
||||
this.a.a(i);
|
||||
}
|
||||
}
|
@@ -0,0 +1,98 @@
|
||||
package org.greenrobot.greendao.identityscope;
|
||||
|
||||
import java.lang.ref.Reference;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class IdentityScopeObject<K, T> implements IdentityScope<K, T> {
|
||||
private final HashMap<K, Reference<T>> a = new HashMap<>();
|
||||
private final ReentrantLock b = new ReentrantLock();
|
||||
|
||||
@Override // org.greenrobot.greendao.identityscope.IdentityScope
|
||||
public T a(K k) {
|
||||
Reference<T> reference = this.a.get(k);
|
||||
if (reference != null) {
|
||||
return reference.get();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // org.greenrobot.greendao.identityscope.IdentityScope
|
||||
public void a(int i) {
|
||||
}
|
||||
|
||||
@Override // org.greenrobot.greendao.identityscope.IdentityScope
|
||||
public void clear() {
|
||||
this.b.lock();
|
||||
try {
|
||||
this.a.clear();
|
||||
} finally {
|
||||
this.b.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // org.greenrobot.greendao.identityscope.IdentityScope
|
||||
public T get(K k) {
|
||||
this.b.lock();
|
||||
try {
|
||||
Reference<T> reference = this.a.get(k);
|
||||
if (reference != null) {
|
||||
return reference.get();
|
||||
}
|
||||
return null;
|
||||
} finally {
|
||||
this.b.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // org.greenrobot.greendao.identityscope.IdentityScope
|
||||
public void lock() {
|
||||
this.b.lock();
|
||||
}
|
||||
|
||||
@Override // org.greenrobot.greendao.identityscope.IdentityScope
|
||||
public void put(K k, T t) {
|
||||
this.b.lock();
|
||||
try {
|
||||
this.a.put(k, new WeakReference(t));
|
||||
} finally {
|
||||
this.b.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // org.greenrobot.greendao.identityscope.IdentityScope
|
||||
public void remove(K k) {
|
||||
this.b.lock();
|
||||
try {
|
||||
this.a.remove(k);
|
||||
} finally {
|
||||
this.b.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // org.greenrobot.greendao.identityscope.IdentityScope
|
||||
public void unlock() {
|
||||
this.b.unlock();
|
||||
}
|
||||
|
||||
@Override // org.greenrobot.greendao.identityscope.IdentityScope
|
||||
public void a(K k, T t) {
|
||||
this.a.put(k, new WeakReference(t));
|
||||
}
|
||||
|
||||
@Override // org.greenrobot.greendao.identityscope.IdentityScope
|
||||
public void a(Iterable<K> iterable) {
|
||||
this.b.lock();
|
||||
try {
|
||||
Iterator<K> it = iterable.iterator();
|
||||
while (it.hasNext()) {
|
||||
this.a.remove(it.next());
|
||||
}
|
||||
} finally {
|
||||
this.b.unlock();
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,7 @@
|
||||
package org.greenrobot.greendao.identityscope;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public enum IdentityScopeType {
|
||||
Session,
|
||||
None
|
||||
}
|
128
sources/org/greenrobot/greendao/internal/DaoConfig.java
Normal file
128
sources/org/greenrobot/greendao/internal/DaoConfig.java
Normal file
@@ -0,0 +1,128 @@
|
||||
package org.greenrobot.greendao.internal;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import org.greenrobot.greendao.AbstractDao;
|
||||
import org.greenrobot.greendao.DaoException;
|
||||
import org.greenrobot.greendao.Property;
|
||||
import org.greenrobot.greendao.database.Database;
|
||||
import org.greenrobot.greendao.identityscope.IdentityScope;
|
||||
import org.greenrobot.greendao.identityscope.IdentityScopeLong;
|
||||
import org.greenrobot.greendao.identityscope.IdentityScopeObject;
|
||||
import org.greenrobot.greendao.identityscope.IdentityScopeType;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public final class DaoConfig implements Cloneable {
|
||||
public final Database a;
|
||||
public final String b;
|
||||
public final Property[] c;
|
||||
public final String[] d;
|
||||
public final String[] e;
|
||||
public final String[] f;
|
||||
public final Property g;
|
||||
public final boolean h;
|
||||
public final TableStatements i;
|
||||
private IdentityScope<?, ?> j;
|
||||
|
||||
public DaoConfig(Database database, Class<? extends AbstractDao<?, ?>> cls) {
|
||||
this.a = database;
|
||||
try {
|
||||
this.b = (String) cls.getField("TABLENAME").get(null);
|
||||
Property[] a = a(cls);
|
||||
this.c = a;
|
||||
this.d = new String[a.length];
|
||||
ArrayList arrayList = new ArrayList();
|
||||
ArrayList arrayList2 = new ArrayList();
|
||||
Property property = null;
|
||||
for (int i = 0; i < a.length; i++) {
|
||||
Property property2 = a[i];
|
||||
String str = property2.e;
|
||||
this.d[i] = str;
|
||||
if (property2.d) {
|
||||
arrayList.add(str);
|
||||
property = property2;
|
||||
} else {
|
||||
arrayList2.add(str);
|
||||
}
|
||||
}
|
||||
this.f = (String[]) arrayList2.toArray(new String[arrayList2.size()]);
|
||||
this.e = (String[]) arrayList.toArray(new String[arrayList.size()]);
|
||||
boolean z = true;
|
||||
this.g = this.e.length == 1 ? property : null;
|
||||
this.i = new TableStatements(database, this.b, this.d, this.e);
|
||||
if (this.g == null) {
|
||||
this.h = false;
|
||||
return;
|
||||
}
|
||||
Class<?> cls2 = this.g.b;
|
||||
if (!cls2.equals(Long.TYPE) && !cls2.equals(Long.class) && !cls2.equals(Integer.TYPE) && !cls2.equals(Integer.class) && !cls2.equals(Short.TYPE) && !cls2.equals(Short.class) && !cls2.equals(Byte.TYPE) && !cls2.equals(Byte.class)) {
|
||||
z = false;
|
||||
}
|
||||
this.h = z;
|
||||
} catch (Exception e) {
|
||||
throw new DaoException("Could not init DAOConfig", e);
|
||||
}
|
||||
}
|
||||
|
||||
private static Property[] a(Class<? extends AbstractDao<?, ?>> cls) throws ClassNotFoundException, IllegalArgumentException, IllegalAccessException {
|
||||
Field[] declaredFields = Class.forName(cls.getName() + "$Properties").getDeclaredFields();
|
||||
ArrayList arrayList = new ArrayList();
|
||||
for (Field field : declaredFields) {
|
||||
if ((field.getModifiers() & 9) == 9) {
|
||||
Object obj = field.get(null);
|
||||
if (obj instanceof Property) {
|
||||
arrayList.add((Property) obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
Property[] propertyArr = new Property[arrayList.size()];
|
||||
Iterator it = arrayList.iterator();
|
||||
while (it.hasNext()) {
|
||||
Property property = (Property) it.next();
|
||||
int i = property.a;
|
||||
if (propertyArr[i] != null) {
|
||||
throw new DaoException("Duplicate property ordinals");
|
||||
}
|
||||
propertyArr[i] = property;
|
||||
}
|
||||
return propertyArr;
|
||||
}
|
||||
|
||||
public DaoConfig clone() {
|
||||
return new DaoConfig(this);
|
||||
}
|
||||
|
||||
public IdentityScope<?, ?> a() {
|
||||
return this.j;
|
||||
}
|
||||
|
||||
public void a(IdentityScopeType identityScopeType) {
|
||||
if (identityScopeType == IdentityScopeType.None) {
|
||||
this.j = null;
|
||||
return;
|
||||
}
|
||||
if (identityScopeType == IdentityScopeType.Session) {
|
||||
if (this.h) {
|
||||
this.j = new IdentityScopeLong();
|
||||
return;
|
||||
} else {
|
||||
this.j = new IdentityScopeObject();
|
||||
return;
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("Unsupported type: " + identityScopeType);
|
||||
}
|
||||
|
||||
public DaoConfig(DaoConfig daoConfig) {
|
||||
this.a = daoConfig.a;
|
||||
this.b = daoConfig.b;
|
||||
this.c = daoConfig.c;
|
||||
this.d = daoConfig.d;
|
||||
this.e = daoConfig.e;
|
||||
this.f = daoConfig.f;
|
||||
this.g = daoConfig.g;
|
||||
this.i = daoConfig.i;
|
||||
this.h = daoConfig.h;
|
||||
}
|
||||
}
|
242
sources/org/greenrobot/greendao/internal/FastCursor.java
Normal file
242
sources/org/greenrobot/greendao/internal/FastCursor.java
Normal file
@@ -0,0 +1,242 @@
|
||||
package org.greenrobot.greendao.internal;
|
||||
|
||||
import android.content.ContentResolver;
|
||||
import android.database.CharArrayBuffer;
|
||||
import android.database.ContentObserver;
|
||||
import android.database.Cursor;
|
||||
import android.database.CursorWindow;
|
||||
import android.database.DataSetObserver;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public final class FastCursor implements Cursor {
|
||||
private final CursorWindow a;
|
||||
private int b;
|
||||
private final int c;
|
||||
|
||||
public FastCursor(CursorWindow cursorWindow) {
|
||||
this.a = cursorWindow;
|
||||
this.c = cursorWindow.getNumRows();
|
||||
}
|
||||
|
||||
@Override // android.database.Cursor, java.io.Closeable, java.lang.AutoCloseable
|
||||
public void close() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override // android.database.Cursor
|
||||
public void copyStringToBuffer(int i, CharArrayBuffer charArrayBuffer) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override // android.database.Cursor
|
||||
public void deactivate() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override // android.database.Cursor
|
||||
public byte[] getBlob(int i) {
|
||||
return this.a.getBlob(this.b, i);
|
||||
}
|
||||
|
||||
@Override // android.database.Cursor
|
||||
public int getColumnCount() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override // android.database.Cursor
|
||||
public int getColumnIndex(String str) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override // android.database.Cursor
|
||||
public int getColumnIndexOrThrow(String str) throws IllegalArgumentException {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override // android.database.Cursor
|
||||
public String getColumnName(int i) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override // android.database.Cursor
|
||||
public String[] getColumnNames() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override // android.database.Cursor
|
||||
public int getCount() {
|
||||
return this.a.getNumRows();
|
||||
}
|
||||
|
||||
@Override // android.database.Cursor
|
||||
public double getDouble(int i) {
|
||||
return this.a.getDouble(this.b, i);
|
||||
}
|
||||
|
||||
@Override // android.database.Cursor
|
||||
public Bundle getExtras() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override // android.database.Cursor
|
||||
public float getFloat(int i) {
|
||||
return this.a.getFloat(this.b, i);
|
||||
}
|
||||
|
||||
@Override // android.database.Cursor
|
||||
public int getInt(int i) {
|
||||
return this.a.getInt(this.b, i);
|
||||
}
|
||||
|
||||
@Override // android.database.Cursor
|
||||
public long getLong(int i) {
|
||||
return this.a.getLong(this.b, i);
|
||||
}
|
||||
|
||||
@Override // android.database.Cursor
|
||||
public Uri getNotificationUri() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // android.database.Cursor
|
||||
public int getPosition() {
|
||||
return this.b;
|
||||
}
|
||||
|
||||
@Override // android.database.Cursor
|
||||
public short getShort(int i) {
|
||||
return this.a.getShort(this.b, i);
|
||||
}
|
||||
|
||||
@Override // android.database.Cursor
|
||||
public String getString(int i) {
|
||||
return this.a.getString(this.b, i);
|
||||
}
|
||||
|
||||
@Override // android.database.Cursor
|
||||
public int getType(int i) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override // android.database.Cursor
|
||||
public boolean getWantsAllOnMoveCalls() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override // android.database.Cursor
|
||||
public boolean isAfterLast() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override // android.database.Cursor
|
||||
public boolean isBeforeFirst() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override // android.database.Cursor
|
||||
public boolean isClosed() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override // android.database.Cursor
|
||||
public boolean isFirst() {
|
||||
return this.b == 0;
|
||||
}
|
||||
|
||||
@Override // android.database.Cursor
|
||||
public boolean isLast() {
|
||||
return this.b == this.c - 1;
|
||||
}
|
||||
|
||||
@Override // android.database.Cursor
|
||||
public boolean isNull(int i) {
|
||||
return this.a.isNull(this.b, i);
|
||||
}
|
||||
|
||||
@Override // android.database.Cursor
|
||||
public boolean move(int i) {
|
||||
return moveToPosition(this.b + i);
|
||||
}
|
||||
|
||||
@Override // android.database.Cursor
|
||||
public boolean moveToFirst() {
|
||||
this.b = 0;
|
||||
return this.c > 0;
|
||||
}
|
||||
|
||||
@Override // android.database.Cursor
|
||||
public boolean moveToLast() {
|
||||
int i = this.c;
|
||||
if (i <= 0) {
|
||||
return false;
|
||||
}
|
||||
this.b = i - 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // android.database.Cursor
|
||||
public boolean moveToNext() {
|
||||
int i = this.b;
|
||||
if (i >= this.c - 1) {
|
||||
return false;
|
||||
}
|
||||
this.b = i + 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // android.database.Cursor
|
||||
public boolean moveToPosition(int i) {
|
||||
if (i < 0 || i >= this.c) {
|
||||
return false;
|
||||
}
|
||||
this.b = i;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // android.database.Cursor
|
||||
public boolean moveToPrevious() {
|
||||
int i = this.b;
|
||||
if (i <= 0) {
|
||||
return false;
|
||||
}
|
||||
this.b = i - 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // android.database.Cursor
|
||||
public void registerContentObserver(ContentObserver contentObserver) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override // android.database.Cursor
|
||||
public void registerDataSetObserver(DataSetObserver dataSetObserver) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override // android.database.Cursor
|
||||
public boolean requery() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override // android.database.Cursor
|
||||
public Bundle respond(Bundle bundle) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override // android.database.Cursor
|
||||
public void setNotificationUri(ContentResolver contentResolver, Uri uri) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override // android.database.Cursor
|
||||
public void unregisterContentObserver(ContentObserver contentObserver) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override // android.database.Cursor
|
||||
public void unregisterDataSetObserver(DataSetObserver dataSetObserver) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}
|
110
sources/org/greenrobot/greendao/internal/LongHashMap.java
Normal file
110
sources/org/greenrobot/greendao/internal/LongHashMap.java
Normal file
@@ -0,0 +1,110 @@
|
||||
package org.greenrobot.greendao.internal;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public final class LongHashMap<T> {
|
||||
private Entry<T>[] a;
|
||||
private int b;
|
||||
private int c;
|
||||
private int d;
|
||||
|
||||
static final class Entry<T> {
|
||||
final long a;
|
||||
T b;
|
||||
Entry<T> c;
|
||||
|
||||
Entry(long j, T t, Entry<T> entry) {
|
||||
this.a = j;
|
||||
this.b = t;
|
||||
this.c = entry;
|
||||
}
|
||||
}
|
||||
|
||||
public LongHashMap() {
|
||||
this(16);
|
||||
}
|
||||
|
||||
public T a(long j) {
|
||||
for (Entry<T> entry = this.a[((((int) j) ^ ((int) (j >>> 32))) & Integer.MAX_VALUE) % this.b]; entry != null; entry = entry.c) {
|
||||
if (entry.a == j) {
|
||||
return entry.b;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public T b(long j) {
|
||||
int i = ((((int) j) ^ ((int) (j >>> 32))) & Integer.MAX_VALUE) % this.b;
|
||||
Entry<T> entry = this.a[i];
|
||||
Entry<T> entry2 = null;
|
||||
while (entry != null) {
|
||||
Entry<T> entry3 = entry.c;
|
||||
if (entry.a == j) {
|
||||
if (entry2 == null) {
|
||||
this.a[i] = entry3;
|
||||
} else {
|
||||
entry2.c = entry3;
|
||||
}
|
||||
this.d--;
|
||||
return entry.b;
|
||||
}
|
||||
entry2 = entry;
|
||||
entry = entry3;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public LongHashMap(int i) {
|
||||
this.b = i;
|
||||
this.c = (i * 4) / 3;
|
||||
this.a = new Entry[i];
|
||||
}
|
||||
|
||||
public T a(long j, T t) {
|
||||
int i = ((((int) j) ^ ((int) (j >>> 32))) & Integer.MAX_VALUE) % this.b;
|
||||
Entry<T> entry = this.a[i];
|
||||
for (Entry<T> entry2 = entry; entry2 != null; entry2 = entry2.c) {
|
||||
if (entry2.a == j) {
|
||||
T t2 = entry2.b;
|
||||
entry2.b = t;
|
||||
return t2;
|
||||
}
|
||||
}
|
||||
this.a[i] = new Entry<>(j, t, entry);
|
||||
this.d++;
|
||||
if (this.d <= this.c) {
|
||||
return null;
|
||||
}
|
||||
b(this.b * 2);
|
||||
return null;
|
||||
}
|
||||
|
||||
public void b(int i) {
|
||||
Entry<T>[] entryArr = new Entry[i];
|
||||
int length = this.a.length;
|
||||
for (int i2 = 0; i2 < length; i2++) {
|
||||
Entry<T> entry = this.a[i2];
|
||||
while (entry != null) {
|
||||
long j = entry.a;
|
||||
int i3 = ((((int) (j >>> 32)) ^ ((int) j)) & Integer.MAX_VALUE) % i;
|
||||
Entry<T> entry2 = entry.c;
|
||||
entry.c = entryArr[i3];
|
||||
entryArr[i3] = entry;
|
||||
entry = entry2;
|
||||
}
|
||||
}
|
||||
this.a = entryArr;
|
||||
this.b = i;
|
||||
this.c = (i * 4) / 3;
|
||||
}
|
||||
|
||||
public void a() {
|
||||
this.d = 0;
|
||||
Arrays.fill(this.a, (Object) null);
|
||||
}
|
||||
|
||||
public void a(int i) {
|
||||
b((i * 5) / 3);
|
||||
}
|
||||
}
|
145
sources/org/greenrobot/greendao/internal/SqlUtils.java
Normal file
145
sources/org/greenrobot/greendao/internal/SqlUtils.java
Normal file
@@ -0,0 +1,145 @@
|
||||
package org.greenrobot.greendao.internal;
|
||||
|
||||
import org.greenrobot.greendao.DaoException;
|
||||
import org.greenrobot.greendao.Property;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class SqlUtils {
|
||||
static {
|
||||
"0123456789ABCDEF".toCharArray();
|
||||
}
|
||||
|
||||
public static StringBuilder a(StringBuilder sb, String str, Property property) {
|
||||
if (str != null) {
|
||||
sb.append(str);
|
||||
sb.append('.');
|
||||
}
|
||||
sb.append('\"');
|
||||
sb.append(property.e);
|
||||
sb.append('\"');
|
||||
return sb;
|
||||
}
|
||||
|
||||
public static StringBuilder b(StringBuilder sb, String[] strArr) {
|
||||
for (int i = 0; i < strArr.length; i++) {
|
||||
a(sb, strArr[i]);
|
||||
sb.append("=?");
|
||||
if (i < strArr.length - 1) {
|
||||
sb.append(',');
|
||||
}
|
||||
}
|
||||
return sb;
|
||||
}
|
||||
|
||||
public static StringBuilder a(StringBuilder sb, String str) {
|
||||
sb.append('\"');
|
||||
sb.append(str);
|
||||
sb.append('\"');
|
||||
return sb;
|
||||
}
|
||||
|
||||
public static StringBuilder a(StringBuilder sb, String str, String str2) {
|
||||
sb.append(str);
|
||||
sb.append(".\"");
|
||||
sb.append(str2);
|
||||
sb.append('\"');
|
||||
return sb;
|
||||
}
|
||||
|
||||
public static StringBuilder a(StringBuilder sb, String str, String[] strArr) {
|
||||
int length = strArr.length;
|
||||
for (int i = 0; i < length; i++) {
|
||||
a(sb, str, strArr[i]);
|
||||
if (i < length - 1) {
|
||||
sb.append(',');
|
||||
}
|
||||
}
|
||||
return sb;
|
||||
}
|
||||
|
||||
public static StringBuilder b(StringBuilder sb, String str, String[] strArr) {
|
||||
for (int i = 0; i < strArr.length; i++) {
|
||||
a(sb, str, strArr[i]);
|
||||
sb.append("=?");
|
||||
if (i < strArr.length - 1) {
|
||||
sb.append(',');
|
||||
}
|
||||
}
|
||||
return sb;
|
||||
}
|
||||
|
||||
public static StringBuilder a(StringBuilder sb, String[] strArr) {
|
||||
int length = strArr.length;
|
||||
for (int i = 0; i < length; i++) {
|
||||
sb.append('\"');
|
||||
sb.append(strArr[i]);
|
||||
sb.append('\"');
|
||||
if (i < length - 1) {
|
||||
sb.append(',');
|
||||
}
|
||||
}
|
||||
return sb;
|
||||
}
|
||||
|
||||
public static StringBuilder a(StringBuilder sb, int i) {
|
||||
for (int i2 = 0; i2 < i; i2++) {
|
||||
if (i2 < i - 1) {
|
||||
sb.append("?,");
|
||||
} else {
|
||||
sb.append('?');
|
||||
}
|
||||
}
|
||||
return sb;
|
||||
}
|
||||
|
||||
public static String a(String str, String str2, String[] strArr) {
|
||||
StringBuilder sb = new StringBuilder(str);
|
||||
sb.append('\"');
|
||||
sb.append(str2);
|
||||
sb.append('\"');
|
||||
sb.append(" (");
|
||||
a(sb, strArr);
|
||||
sb.append(") VALUES (");
|
||||
a(sb, strArr.length);
|
||||
sb.append(')');
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static String a(String str, String str2, String[] strArr, boolean z) {
|
||||
if (str2 != null && str2.length() >= 0) {
|
||||
StringBuilder sb = new StringBuilder(z ? "SELECT DISTINCT " : "SELECT ");
|
||||
a(sb, str2, strArr);
|
||||
sb.append(" FROM ");
|
||||
sb.append('\"');
|
||||
sb.append(str);
|
||||
sb.append('\"');
|
||||
sb.append(' ');
|
||||
sb.append(str2);
|
||||
sb.append(' ');
|
||||
return sb.toString();
|
||||
}
|
||||
throw new DaoException("Table alias required");
|
||||
}
|
||||
|
||||
public static String a(String str, String[] strArr) {
|
||||
String str2 = '\"' + str + '\"';
|
||||
StringBuilder sb = new StringBuilder("DELETE FROM ");
|
||||
sb.append(str2);
|
||||
if (strArr != null && strArr.length > 0) {
|
||||
sb.append(" WHERE ");
|
||||
b(sb, str2, strArr);
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static String a(String str, String[] strArr, String[] strArr2) {
|
||||
String str2 = '\"' + str + '\"';
|
||||
StringBuilder sb = new StringBuilder("UPDATE ");
|
||||
sb.append(str2);
|
||||
sb.append(" SET ");
|
||||
b(sb, strArr);
|
||||
sb.append(" WHERE ");
|
||||
b(sb, str2, strArr2);
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
110
sources/org/greenrobot/greendao/internal/TableStatements.java
Normal file
110
sources/org/greenrobot/greendao/internal/TableStatements.java
Normal file
@@ -0,0 +1,110 @@
|
||||
package org.greenrobot.greendao.internal;
|
||||
|
||||
import org.greenrobot.greendao.database.Database;
|
||||
import org.greenrobot.greendao.database.DatabaseStatement;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class TableStatements {
|
||||
private final Database a;
|
||||
private final String b;
|
||||
private final String[] c;
|
||||
private final String[] d;
|
||||
private DatabaseStatement e;
|
||||
private DatabaseStatement f;
|
||||
private DatabaseStatement g;
|
||||
private DatabaseStatement h;
|
||||
private volatile String i;
|
||||
private volatile String j;
|
||||
private volatile String k;
|
||||
|
||||
public TableStatements(Database database, String str, String[] strArr, String[] strArr2) {
|
||||
this.a = database;
|
||||
this.b = str;
|
||||
this.c = strArr;
|
||||
this.d = strArr2;
|
||||
}
|
||||
|
||||
public DatabaseStatement a() {
|
||||
if (this.h == null) {
|
||||
DatabaseStatement b = this.a.b(SqlUtils.a(this.b, this.d));
|
||||
synchronized (this) {
|
||||
if (this.h == null) {
|
||||
this.h = b;
|
||||
}
|
||||
}
|
||||
if (this.h != b) {
|
||||
b.close();
|
||||
}
|
||||
}
|
||||
return this.h;
|
||||
}
|
||||
|
||||
public DatabaseStatement b() {
|
||||
if (this.f == null) {
|
||||
DatabaseStatement b = this.a.b(SqlUtils.a("INSERT OR REPLACE INTO ", this.b, this.c));
|
||||
synchronized (this) {
|
||||
if (this.f == null) {
|
||||
this.f = b;
|
||||
}
|
||||
}
|
||||
if (this.f != b) {
|
||||
b.close();
|
||||
}
|
||||
}
|
||||
return this.f;
|
||||
}
|
||||
|
||||
public DatabaseStatement c() {
|
||||
if (this.e == null) {
|
||||
DatabaseStatement b = this.a.b(SqlUtils.a("INSERT INTO ", this.b, this.c));
|
||||
synchronized (this) {
|
||||
if (this.e == null) {
|
||||
this.e = b;
|
||||
}
|
||||
}
|
||||
if (this.e != b) {
|
||||
b.close();
|
||||
}
|
||||
}
|
||||
return this.e;
|
||||
}
|
||||
|
||||
public String d() {
|
||||
if (this.i == null) {
|
||||
this.i = SqlUtils.a(this.b, "T", this.c, false);
|
||||
}
|
||||
return this.i;
|
||||
}
|
||||
|
||||
public String e() {
|
||||
if (this.j == null) {
|
||||
StringBuilder sb = new StringBuilder(d());
|
||||
sb.append("WHERE ");
|
||||
SqlUtils.b(sb, "T", this.d);
|
||||
this.j = sb.toString();
|
||||
}
|
||||
return this.j;
|
||||
}
|
||||
|
||||
public String f() {
|
||||
if (this.k == null) {
|
||||
this.k = d() + "WHERE ROWID=?";
|
||||
}
|
||||
return this.k;
|
||||
}
|
||||
|
||||
public DatabaseStatement g() {
|
||||
if (this.g == null) {
|
||||
DatabaseStatement b = this.a.b(SqlUtils.a(this.b, this.c, this.d));
|
||||
synchronized (this) {
|
||||
if (this.g == null) {
|
||||
this.g = b;
|
||||
}
|
||||
}
|
||||
if (this.g != b) {
|
||||
b.close();
|
||||
}
|
||||
}
|
||||
return this.g;
|
||||
}
|
||||
}
|
51
sources/org/greenrobot/greendao/query/AbstractQuery.java
Normal file
51
sources/org/greenrobot/greendao/query/AbstractQuery.java
Normal file
@@ -0,0 +1,51 @@
|
||||
package org.greenrobot.greendao.query;
|
||||
|
||||
import org.greenrobot.greendao.AbstractDao;
|
||||
import org.greenrobot.greendao.DaoException;
|
||||
import org.greenrobot.greendao.InternalQueryDaoAccess;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
abstract class AbstractQuery<T> {
|
||||
protected final AbstractDao<T, ?> a;
|
||||
protected final InternalQueryDaoAccess<T> b;
|
||||
protected final String c;
|
||||
protected final String[] d;
|
||||
protected final Thread e = Thread.currentThread();
|
||||
|
||||
protected AbstractQuery(AbstractDao<T, ?> abstractDao, String str, String[] strArr) {
|
||||
this.a = abstractDao;
|
||||
this.b = new InternalQueryDaoAccess<>(abstractDao);
|
||||
this.c = str;
|
||||
this.d = strArr;
|
||||
}
|
||||
|
||||
protected static String[] a(Object[] objArr) {
|
||||
int length = objArr.length;
|
||||
String[] strArr = new String[length];
|
||||
for (int i = 0; i < length; i++) {
|
||||
Object obj = objArr[i];
|
||||
if (obj != null) {
|
||||
strArr[i] = obj.toString();
|
||||
} else {
|
||||
strArr[i] = null;
|
||||
}
|
||||
}
|
||||
return strArr;
|
||||
}
|
||||
|
||||
public AbstractQuery<T> a(int i, Object obj) {
|
||||
a();
|
||||
if (obj != null) {
|
||||
this.d[i] = obj.toString();
|
||||
} else {
|
||||
this.d[i] = null;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
protected void a() {
|
||||
if (Thread.currentThread() != this.e) {
|
||||
throw new DaoException("Method may be called only in owner thread, use forCurrentThread to get an instance for this thread");
|
||||
}
|
||||
}
|
||||
}
|
61
sources/org/greenrobot/greendao/query/AbstractQueryData.java
Normal file
61
sources/org/greenrobot/greendao/query/AbstractQueryData.java
Normal file
@@ -0,0 +1,61 @@
|
||||
package org.greenrobot.greendao.query;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import org.greenrobot.greendao.AbstractDao;
|
||||
import org.greenrobot.greendao.query.AbstractQuery;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
abstract class AbstractQueryData<T, Q extends AbstractQuery<T>> {
|
||||
final String a;
|
||||
final AbstractDao<T, ?> b;
|
||||
final String[] c;
|
||||
final Map<Long, WeakReference<Q>> d = new HashMap();
|
||||
|
||||
AbstractQueryData(AbstractDao<T, ?> abstractDao, String str, String[] strArr) {
|
||||
this.b = abstractDao;
|
||||
this.a = str;
|
||||
this.c = strArr;
|
||||
}
|
||||
|
||||
protected abstract Q a();
|
||||
|
||||
Q a(Q q) {
|
||||
if (Thread.currentThread() != q.e) {
|
||||
return b();
|
||||
}
|
||||
String[] strArr = this.c;
|
||||
System.arraycopy(strArr, 0, q.d, 0, strArr.length);
|
||||
return q;
|
||||
}
|
||||
|
||||
Q b() {
|
||||
Q q;
|
||||
long id = Thread.currentThread().getId();
|
||||
synchronized (this.d) {
|
||||
WeakReference<Q> weakReference = this.d.get(Long.valueOf(id));
|
||||
q = weakReference != null ? weakReference.get() : null;
|
||||
if (q == null) {
|
||||
c();
|
||||
q = a();
|
||||
this.d.put(Long.valueOf(id), new WeakReference<>(q));
|
||||
} else {
|
||||
System.arraycopy(this.c, 0, q.d, 0, this.c.length);
|
||||
}
|
||||
}
|
||||
return q;
|
||||
}
|
||||
|
||||
void c() {
|
||||
synchronized (this.d) {
|
||||
Iterator<Map.Entry<Long, WeakReference<Q>>> it = this.d.entrySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
if (it.next().getValue().get() == null) {
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,24 @@
|
||||
package org.greenrobot.greendao.query;
|
||||
|
||||
import org.greenrobot.greendao.AbstractDao;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
abstract class AbstractQueryWithLimit<T> extends AbstractQuery<T> {
|
||||
protected final int f;
|
||||
protected final int g;
|
||||
|
||||
protected AbstractQueryWithLimit(AbstractDao<T, ?> abstractDao, String str, String[] strArr, int i, int i2) {
|
||||
super(abstractDao, str, strArr);
|
||||
this.f = i;
|
||||
this.g = i2;
|
||||
}
|
||||
|
||||
@Override // org.greenrobot.greendao.query.AbstractQuery
|
||||
public AbstractQueryWithLimit<T> a(int i, Object obj) {
|
||||
if (i < 0 || !(i == this.f || i == this.g)) {
|
||||
super.a(i, obj);
|
||||
return this;
|
||||
}
|
||||
throw new IllegalArgumentException("Illegal parameter index: " + i);
|
||||
}
|
||||
}
|
28
sources/org/greenrobot/greendao/query/Join.java
Normal file
28
sources/org/greenrobot/greendao/query/Join.java
Normal file
@@ -0,0 +1,28 @@
|
||||
package org.greenrobot.greendao.query;
|
||||
|
||||
import org.greenrobot.greendao.AbstractDao;
|
||||
import org.greenrobot.greendao.Property;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class Join<SRC, DST> {
|
||||
final String a;
|
||||
final AbstractDao<DST, ?> b;
|
||||
final Property c;
|
||||
final Property d;
|
||||
final String e;
|
||||
final WhereCollector<DST> f;
|
||||
|
||||
public Join(String str, Property property, AbstractDao<DST, ?> abstractDao, Property property2, String str2) {
|
||||
this.a = str;
|
||||
this.c = property;
|
||||
this.b = abstractDao;
|
||||
this.d = property2;
|
||||
this.e = str2;
|
||||
this.f = new WhereCollector<>(abstractDao, str2);
|
||||
}
|
||||
|
||||
public Join<SRC, DST> a(WhereCondition whereCondition, WhereCondition... whereConditionArr) {
|
||||
this.f.a(whereCondition, whereConditionArr);
|
||||
return this;
|
||||
}
|
||||
}
|
54
sources/org/greenrobot/greendao/query/Query.java
Normal file
54
sources/org/greenrobot/greendao/query/Query.java
Normal file
@@ -0,0 +1,54 @@
|
||||
package org.greenrobot.greendao.query;
|
||||
|
||||
import java.util.List;
|
||||
import org.greenrobot.greendao.AbstractDao;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class Query<T> extends AbstractQueryWithLimit<T> {
|
||||
private final QueryData<T> h;
|
||||
|
||||
private static final class QueryData<T2> extends AbstractQueryData<T2, Query<T2>> {
|
||||
private final int e;
|
||||
private final int f;
|
||||
|
||||
QueryData(AbstractDao<T2, ?> abstractDao, String str, String[] strArr, int i, int i2) {
|
||||
super(abstractDao, str, strArr);
|
||||
this.e = i;
|
||||
this.f = i2;
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: protected */
|
||||
@Override // org.greenrobot.greendao.query.AbstractQueryData
|
||||
public Query<T2> a() {
|
||||
return new Query<>(this, this.b, this.a, (String[]) this.c.clone(), this.e, this.f);
|
||||
}
|
||||
}
|
||||
|
||||
static <T2> Query<T2> a(AbstractDao<T2, ?> abstractDao, String str, Object[] objArr, int i, int i2) {
|
||||
return new QueryData(abstractDao, str, AbstractQuery.a(objArr), i, i2).b();
|
||||
}
|
||||
|
||||
public Query<T> b() {
|
||||
return (Query) this.h.a(this);
|
||||
}
|
||||
|
||||
public List<T> c() {
|
||||
a();
|
||||
return this.b.a(this.a.d().a(this.c, this.d));
|
||||
}
|
||||
|
||||
public T d() {
|
||||
a();
|
||||
return this.b.b(this.a.d().a(this.c, this.d));
|
||||
}
|
||||
|
||||
private Query(QueryData<T> queryData, AbstractDao<T, ?> abstractDao, String str, String[] strArr, int i, int i2) {
|
||||
super(abstractDao, str, strArr, i, i2);
|
||||
this.h = queryData;
|
||||
}
|
||||
|
||||
@Override // org.greenrobot.greendao.query.AbstractQueryWithLimit, org.greenrobot.greendao.query.AbstractQuery
|
||||
public Query<T> a(int i, Object obj) {
|
||||
return (Query) super.a(i, obj);
|
||||
}
|
||||
}
|
196
sources/org/greenrobot/greendao/query/QueryBuilder.java
Normal file
196
sources/org/greenrobot/greendao/query/QueryBuilder.java
Normal file
@@ -0,0 +1,196 @@
|
||||
package org.greenrobot.greendao.query;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.greenrobot.greendao.AbstractDao;
|
||||
import org.greenrobot.greendao.DaoLog;
|
||||
import org.greenrobot.greendao.Property;
|
||||
import org.greenrobot.greendao.internal.SqlUtils;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public class QueryBuilder<T> {
|
||||
public static boolean k;
|
||||
public static boolean l;
|
||||
private final WhereCollector<T> a;
|
||||
private StringBuilder b;
|
||||
private final List<Object> c;
|
||||
private final List<Join<T, ?>> d;
|
||||
private final AbstractDao<T, ?> e;
|
||||
private final String f;
|
||||
private Integer g;
|
||||
private Integer h;
|
||||
private boolean i;
|
||||
private String j;
|
||||
|
||||
protected QueryBuilder(AbstractDao<T, ?> abstractDao) {
|
||||
this(abstractDao, "T");
|
||||
}
|
||||
|
||||
public static <T2> QueryBuilder<T2> a(AbstractDao<T2, ?> abstractDao) {
|
||||
return new QueryBuilder<>(abstractDao);
|
||||
}
|
||||
|
||||
private void d() {
|
||||
StringBuilder sb = this.b;
|
||||
if (sb == null) {
|
||||
this.b = new StringBuilder();
|
||||
} else if (sb.length() > 0) {
|
||||
this.b.append(",");
|
||||
}
|
||||
}
|
||||
|
||||
private StringBuilder e() {
|
||||
StringBuilder sb = new StringBuilder(SqlUtils.a(this.e.h(), this.f, this.e.c(), this.i));
|
||||
a(sb, this.f);
|
||||
StringBuilder sb2 = this.b;
|
||||
if (sb2 != null && sb2.length() > 0) {
|
||||
sb.append(" ORDER BY ");
|
||||
sb.append((CharSequence) this.b);
|
||||
}
|
||||
return sb;
|
||||
}
|
||||
|
||||
public QueryBuilder<T> b(Property... propertyArr) {
|
||||
a(" DESC", propertyArr);
|
||||
return this;
|
||||
}
|
||||
|
||||
public T c() {
|
||||
return a().d();
|
||||
}
|
||||
|
||||
protected QueryBuilder(AbstractDao<T, ?> abstractDao, String str) {
|
||||
this.e = abstractDao;
|
||||
this.f = str;
|
||||
this.c = new ArrayList();
|
||||
this.d = new ArrayList();
|
||||
this.a = new WhereCollector<>(abstractDao, str);
|
||||
this.j = " COLLATE NOCASE";
|
||||
}
|
||||
|
||||
private int b(StringBuilder sb) {
|
||||
if (this.h == null) {
|
||||
return -1;
|
||||
}
|
||||
if (this.g == null) {
|
||||
throw new IllegalStateException("Offset cannot be set without limit");
|
||||
}
|
||||
sb.append(" OFFSET ?");
|
||||
this.c.add(this.h);
|
||||
return this.c.size() - 1;
|
||||
}
|
||||
|
||||
public QueryBuilder<T> a(WhereCondition whereCondition, WhereCondition... whereConditionArr) {
|
||||
this.a.a(whereCondition, whereConditionArr);
|
||||
return this;
|
||||
}
|
||||
|
||||
public <J> Join<T, J> a(Class<J> cls, Property property) {
|
||||
return a(this.e.e(), cls, property);
|
||||
}
|
||||
|
||||
public <J> Join<T, J> a(Property property, Class<J> cls, Property property2) {
|
||||
return a(this.f, property, this.e.g().a((Class<? extends Object>) cls), property2);
|
||||
}
|
||||
|
||||
private <J> Join<T, J> a(String str, Property property, AbstractDao<J, ?> abstractDao, Property property2) {
|
||||
Join<T, J> join = new Join<>(str, property, abstractDao, property2, "J" + (this.d.size() + 1));
|
||||
this.d.add(join);
|
||||
return join;
|
||||
}
|
||||
|
||||
public List<T> b() {
|
||||
return a().c();
|
||||
}
|
||||
|
||||
public QueryBuilder<T> a(Property... propertyArr) {
|
||||
a(" ASC", propertyArr);
|
||||
return this;
|
||||
}
|
||||
|
||||
private void a(String str, Property... propertyArr) {
|
||||
String str2;
|
||||
for (Property property : propertyArr) {
|
||||
d();
|
||||
a(this.b, property);
|
||||
if (String.class.equals(property.b) && (str2 = this.j) != null) {
|
||||
this.b.append(str2);
|
||||
}
|
||||
this.b.append(str);
|
||||
}
|
||||
}
|
||||
|
||||
protected StringBuilder a(StringBuilder sb, Property property) {
|
||||
this.a.a(property);
|
||||
sb.append(this.f);
|
||||
sb.append('.');
|
||||
sb.append('\'');
|
||||
sb.append(property.e);
|
||||
sb.append('\'');
|
||||
return sb;
|
||||
}
|
||||
|
||||
public QueryBuilder<T> a(int i) {
|
||||
this.g = Integer.valueOf(i);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Query<T> a() {
|
||||
StringBuilder e = e();
|
||||
int a = a(e);
|
||||
int b = b(e);
|
||||
String sb = e.toString();
|
||||
a(sb);
|
||||
return Query.a(this.e, sb, this.c.toArray(), a, b);
|
||||
}
|
||||
|
||||
private int a(StringBuilder sb) {
|
||||
if (this.g == null) {
|
||||
return -1;
|
||||
}
|
||||
sb.append(" LIMIT ?");
|
||||
this.c.add(this.g);
|
||||
return this.c.size() - 1;
|
||||
}
|
||||
|
||||
private void a(String str) {
|
||||
if (k) {
|
||||
DaoLog.a("Built SQL for query: " + str);
|
||||
}
|
||||
if (l) {
|
||||
DaoLog.a("Values for query: " + this.c);
|
||||
}
|
||||
}
|
||||
|
||||
private void a(StringBuilder sb, String str) {
|
||||
this.c.clear();
|
||||
for (Join<T, ?> join : this.d) {
|
||||
sb.append(" JOIN ");
|
||||
sb.append('\"');
|
||||
sb.append(join.b.h());
|
||||
sb.append('\"');
|
||||
sb.append(' ');
|
||||
sb.append(join.e);
|
||||
sb.append(" ON ");
|
||||
SqlUtils.a(sb, join.a, join.c);
|
||||
sb.append('=');
|
||||
SqlUtils.a(sb, join.e, join.d);
|
||||
}
|
||||
boolean z = !this.a.a();
|
||||
if (z) {
|
||||
sb.append(" WHERE ");
|
||||
this.a.a(sb, str, this.c);
|
||||
}
|
||||
for (Join<T, ?> join2 : this.d) {
|
||||
if (!join2.f.a()) {
|
||||
if (!z) {
|
||||
sb.append(" WHERE ");
|
||||
z = true;
|
||||
} else {
|
||||
sb.append(" AND ");
|
||||
}
|
||||
join2.f.a(sb, join2.e, this.c);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
74
sources/org/greenrobot/greendao/query/WhereCollector.java
Normal file
74
sources/org/greenrobot/greendao/query/WhereCollector.java
Normal file
@@ -0,0 +1,74 @@
|
||||
package org.greenrobot.greendao.query;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
import org.greenrobot.greendao.AbstractDao;
|
||||
import org.greenrobot.greendao.DaoException;
|
||||
import org.greenrobot.greendao.Property;
|
||||
import org.greenrobot.greendao.query.WhereCondition;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
class WhereCollector<T> {
|
||||
private final AbstractDao<T, ?> a;
|
||||
private final List<WhereCondition> b = new ArrayList();
|
||||
|
||||
WhereCollector(AbstractDao<T, ?> abstractDao, String str) {
|
||||
this.a = abstractDao;
|
||||
}
|
||||
|
||||
void a(WhereCondition whereCondition, WhereCondition... whereConditionArr) {
|
||||
a(whereCondition);
|
||||
this.b.add(whereCondition);
|
||||
for (WhereCondition whereCondition2 : whereConditionArr) {
|
||||
a(whereCondition2);
|
||||
this.b.add(whereCondition2);
|
||||
}
|
||||
}
|
||||
|
||||
void a(WhereCondition whereCondition) {
|
||||
if (whereCondition instanceof WhereCondition.PropertyCondition) {
|
||||
a(((WhereCondition.PropertyCondition) whereCondition).d);
|
||||
}
|
||||
}
|
||||
|
||||
void a(Property property) {
|
||||
AbstractDao<T, ?> abstractDao = this.a;
|
||||
if (abstractDao != null) {
|
||||
Property[] f = abstractDao.f();
|
||||
int length = f.length;
|
||||
boolean z = false;
|
||||
int i = 0;
|
||||
while (true) {
|
||||
if (i >= length) {
|
||||
break;
|
||||
}
|
||||
if (property == f[i]) {
|
||||
z = true;
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if (z) {
|
||||
return;
|
||||
}
|
||||
throw new DaoException("Property '" + property.c + "' is not part of " + this.a);
|
||||
}
|
||||
}
|
||||
|
||||
void a(StringBuilder sb, String str, List<Object> list) {
|
||||
ListIterator<WhereCondition> listIterator = this.b.listIterator();
|
||||
while (listIterator.hasNext()) {
|
||||
if (listIterator.hasPrevious()) {
|
||||
sb.append(" AND ");
|
||||
}
|
||||
WhereCondition next = listIterator.next();
|
||||
next.a(sb, str);
|
||||
next.a(list);
|
||||
}
|
||||
}
|
||||
|
||||
boolean a() {
|
||||
return this.b.isEmpty();
|
||||
}
|
||||
}
|
105
sources/org/greenrobot/greendao/query/WhereCondition.java
Normal file
105
sources/org/greenrobot/greendao/query/WhereCondition.java
Normal file
@@ -0,0 +1,105 @@
|
||||
package org.greenrobot.greendao.query;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import org.greenrobot.greendao.DaoException;
|
||||
import org.greenrobot.greendao.Property;
|
||||
import org.greenrobot.greendao.internal.SqlUtils;
|
||||
|
||||
/* loaded from: classes2.dex */
|
||||
public interface WhereCondition {
|
||||
void a(StringBuilder sb, String str);
|
||||
|
||||
void a(List<Object> list);
|
||||
|
||||
public static class PropertyCondition extends AbstractCondition {
|
||||
public final Property d;
|
||||
public final String e;
|
||||
|
||||
public PropertyCondition(Property property, String str) {
|
||||
this.d = property;
|
||||
this.e = str;
|
||||
}
|
||||
|
||||
private static Object a(Property property, Object obj) {
|
||||
if (obj != null && obj.getClass().isArray()) {
|
||||
throw new DaoException("Illegal value: found array, but simple object required");
|
||||
}
|
||||
Class<?> cls = property.b;
|
||||
if (cls == Date.class) {
|
||||
if (obj instanceof Date) {
|
||||
return Long.valueOf(((Date) obj).getTime());
|
||||
}
|
||||
if (obj instanceof Long) {
|
||||
return obj;
|
||||
}
|
||||
throw new DaoException("Illegal date value: expected java.util.Date or Long for value " + obj);
|
||||
}
|
||||
if (cls == Boolean.TYPE || cls == Boolean.class) {
|
||||
if (obj instanceof Boolean) {
|
||||
return Integer.valueOf(((Boolean) obj).booleanValue() ? 1 : 0);
|
||||
}
|
||||
if (obj instanceof Number) {
|
||||
int intValue = ((Number) obj).intValue();
|
||||
if (intValue != 0 && intValue != 1) {
|
||||
throw new DaoException("Illegal boolean value: numbers must be 0 or 1, but was " + obj);
|
||||
}
|
||||
} else if (obj instanceof String) {
|
||||
String str = (String) obj;
|
||||
if ("TRUE".equalsIgnoreCase(str)) {
|
||||
return 1;
|
||||
}
|
||||
if ("FALSE".equalsIgnoreCase(str)) {
|
||||
return 0;
|
||||
}
|
||||
throw new DaoException("Illegal boolean value: Strings must be \"TRUE\" or \"FALSE\" (case insensitive), but was " + obj);
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
public PropertyCondition(Property property, String str, Object obj) {
|
||||
super(a(property, obj));
|
||||
this.d = property;
|
||||
this.e = str;
|
||||
}
|
||||
|
||||
@Override // org.greenrobot.greendao.query.WhereCondition
|
||||
public void a(StringBuilder sb, String str) {
|
||||
SqlUtils.a(sb, str, this.d);
|
||||
sb.append(this.e);
|
||||
}
|
||||
}
|
||||
|
||||
public static abstract class AbstractCondition implements WhereCondition {
|
||||
protected final boolean a;
|
||||
protected final Object b;
|
||||
protected final Object[] c;
|
||||
|
||||
public AbstractCondition() {
|
||||
this.a = false;
|
||||
this.b = null;
|
||||
this.c = null;
|
||||
}
|
||||
|
||||
@Override // org.greenrobot.greendao.query.WhereCondition
|
||||
public void a(List<Object> list) {
|
||||
if (this.a) {
|
||||
list.add(this.b);
|
||||
return;
|
||||
}
|
||||
Object[] objArr = this.c;
|
||||
if (objArr != null) {
|
||||
for (Object obj : objArr) {
|
||||
list.add(obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public AbstractCondition(Object obj) {
|
||||
this.b = obj;
|
||||
this.a = true;
|
||||
this.c = null;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user