Initial commit

This commit is contained in:
2025-05-13 19:24:51 +02:00
commit a950f49678
10604 changed files with 932663 additions and 0 deletions

View 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;
}
}

View 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();
}
}

View 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);
}
}

View 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();
}
}

View 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;
}
}