338 lines
9.7 KiB
Java
338 lines
9.7 KiB
Java
package org.simpleframework.xml.util;
|
|
|
|
import java.util.AbstractSet;
|
|
import java.util.ArrayList;
|
|
import java.util.Iterator;
|
|
import java.util.LinkedList;
|
|
import java.util.List;
|
|
import org.simpleframework.xml.util.Match;
|
|
|
|
/* loaded from: classes6.dex */
|
|
public class Resolver<M extends Match> extends AbstractSet<M> {
|
|
protected final Resolver<M>.Stack stack = new Stack();
|
|
protected final Resolver<M>.Cache cache = new Cache(this);
|
|
|
|
public M resolve(String str) {
|
|
List<M> list = (List) this.cache.get(str);
|
|
if (list == null) {
|
|
list = resolveAll(str);
|
|
}
|
|
if (list.isEmpty()) {
|
|
return null;
|
|
}
|
|
return list.get(0);
|
|
}
|
|
|
|
public List<M> resolveAll(String str) {
|
|
List<M> list = (List) this.cache.get(str);
|
|
if (list != null) {
|
|
return list;
|
|
}
|
|
char[] charArray = str.toCharArray();
|
|
if (charArray == null) {
|
|
return null;
|
|
}
|
|
return resolveAll(str, charArray);
|
|
}
|
|
|
|
private List<M> resolveAll(String str, char[] cArr) {
|
|
ArrayList arrayList = new ArrayList();
|
|
Iterator<M> it = this.stack.iterator();
|
|
while (it.hasNext()) {
|
|
Match match = (Match) it.next();
|
|
if (match(cArr, match.getPattern().toCharArray())) {
|
|
this.cache.put(str, arrayList);
|
|
arrayList.add(match);
|
|
}
|
|
}
|
|
return arrayList;
|
|
}
|
|
|
|
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
|
|
public boolean add(M m) {
|
|
this.stack.push((Resolver<M>.Stack) m);
|
|
return true;
|
|
}
|
|
|
|
@Override // java.util.AbstractCollection, java.util.Collection, java.lang.Iterable, java.util.Set
|
|
public Iterator<M> iterator() {
|
|
return (Iterator<M>) this.stack.sequence();
|
|
}
|
|
|
|
public boolean remove(M m) {
|
|
this.cache.clear();
|
|
return this.stack.remove(m);
|
|
}
|
|
|
|
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
|
|
public int size() {
|
|
return this.stack.size();
|
|
}
|
|
|
|
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
|
|
public void clear() {
|
|
this.cache.clear();
|
|
this.stack.clear();
|
|
}
|
|
|
|
private boolean match(char[] cArr, char[] cArr2) {
|
|
return match(cArr, 0, cArr2, 0);
|
|
}
|
|
|
|
/* JADX WARN: Code restructure failed: missing block: B:10:0x0017, code lost:
|
|
|
|
if (r9 < r8.length) goto L58;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:12:0x0019, code lost:
|
|
|
|
return true;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:16:0x001a, code lost:
|
|
|
|
if (r0 != '?') goto L63;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:17:0x001c, code lost:
|
|
|
|
r9 = r9 + 1;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:18:0x001f, code lost:
|
|
|
|
if (r9 < r8.length) goto L63;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:20:0x0021, code lost:
|
|
|
|
return true;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:23:0x0023, code lost:
|
|
|
|
if (r7 >= r6.length) goto L60;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:24:0x0025, code lost:
|
|
|
|
r0 = r6[r7];
|
|
r1 = r8[r9];
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:25:0x0029, code lost:
|
|
|
|
if (r0 == r1) goto L22;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:26:0x002b, code lost:
|
|
|
|
if (r1 != '?') goto L61;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:28:0x003a, code lost:
|
|
|
|
r7 = r7 + 1;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:30:0x0031, code lost:
|
|
|
|
if (r8[r9 - 1] == '?') goto L59;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:32:0x0037, code lost:
|
|
|
|
if (match(r6, r7, r8, r9) == false) goto L62;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:34:0x0039, code lost:
|
|
|
|
return true;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:38:0x003e, code lost:
|
|
|
|
if (r6.length != r7) goto L31;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:40:0x0040, code lost:
|
|
|
|
return false;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:42:0x0041, code lost:
|
|
|
|
r0 = r6[r7];
|
|
r1 = r8[r9];
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:43:0x0045, code lost:
|
|
|
|
if (r0 == r1) goto L55;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:44:0x0047, code lost:
|
|
|
|
if (r1 == '?') goto L56;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:46:0x0049, code lost:
|
|
|
|
return false;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:48:0x004a, code lost:
|
|
|
|
r7 = r7 + 1;
|
|
r9 = r9 + 1;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:6:0x000e, code lost:
|
|
|
|
if (r8[r9] == '*') goto L8;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:7:0x0010, code lost:
|
|
|
|
r0 = r8[r9];
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:8:0x0012, code lost:
|
|
|
|
if (r0 != '*') goto L57;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:9:0x0014, code lost:
|
|
|
|
r9 = r9 + 1;
|
|
*/
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
To view partially-correct add '--show-bad-code' argument
|
|
*/
|
|
private boolean match(char[] r6, int r7, char[] r8, int r9) {
|
|
/*
|
|
r5 = this;
|
|
L0:
|
|
int r0 = r8.length
|
|
r1 = 42
|
|
r2 = 0
|
|
r3 = 1
|
|
if (r9 >= r0) goto L4f
|
|
int r0 = r6.length
|
|
if (r7 >= r0) goto L4f
|
|
char r0 = r8[r9]
|
|
r4 = 63
|
|
if (r0 != r1) goto L41
|
|
L10:
|
|
char r0 = r8[r9]
|
|
if (r0 != r1) goto L1a
|
|
int r9 = r9 + 1
|
|
int r0 = r8.length
|
|
if (r9 < r0) goto L10
|
|
return r3
|
|
L1a:
|
|
if (r0 != r4) goto L22
|
|
int r9 = r9 + 1
|
|
int r0 = r8.length
|
|
if (r9 < r0) goto L22
|
|
return r3
|
|
L22:
|
|
int r0 = r6.length
|
|
if (r7 >= r0) goto L3d
|
|
char r0 = r6[r7]
|
|
char r1 = r8[r9]
|
|
if (r0 == r1) goto L2d
|
|
if (r1 != r4) goto L3a
|
|
L2d:
|
|
int r0 = r9 + (-1)
|
|
char r0 = r8[r0]
|
|
if (r0 == r4) goto L3d
|
|
boolean r0 = r5.match(r6, r7, r8, r9)
|
|
if (r0 == 0) goto L3a
|
|
return r3
|
|
L3a:
|
|
int r7 = r7 + 1
|
|
goto L22
|
|
L3d:
|
|
int r0 = r6.length
|
|
if (r0 != r7) goto L41
|
|
return r2
|
|
L41:
|
|
char r0 = r6[r7]
|
|
char r1 = r8[r9]
|
|
if (r0 == r1) goto L4a
|
|
if (r1 == r4) goto L4a
|
|
return r2
|
|
L4a:
|
|
int r7 = r7 + 1
|
|
int r9 = r9 + 1
|
|
goto L0
|
|
L4f:
|
|
int r0 = r8.length
|
|
if (r0 != r9) goto L57
|
|
int r6 = r6.length
|
|
if (r6 != r7) goto L56
|
|
r2 = r3
|
|
L56:
|
|
return r2
|
|
L57:
|
|
char r6 = r8[r9]
|
|
if (r6 != r1) goto L61
|
|
int r9 = r9 + 1
|
|
int r6 = r8.length
|
|
if (r9 < r6) goto L57
|
|
return r3
|
|
L61:
|
|
return r2
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: org.simpleframework.xml.util.Resolver.match(char[], int, char[], int):boolean");
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
/* loaded from: classes6.dex */
|
|
public class Cache extends LimitedCache<List<M>> {
|
|
final Resolver this$0;
|
|
|
|
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
|
|
public Cache(Resolver resolver) {
|
|
super(1024);
|
|
this.this$0 = resolver;
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
/* loaded from: classes6.dex */
|
|
public class Stack extends LinkedList<M> {
|
|
final Resolver this$0;
|
|
|
|
private Stack(Resolver resolver) {
|
|
this.this$0 = resolver;
|
|
}
|
|
|
|
@Override // java.util.LinkedList, java.util.Deque
|
|
public void push(M m) {
|
|
this.this$0.cache.clear();
|
|
addFirst(m);
|
|
}
|
|
|
|
public void purge(int i) {
|
|
this.this$0.cache.clear();
|
|
remove(i);
|
|
}
|
|
|
|
public Iterator<M> sequence() {
|
|
return new Sequence(this);
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
/* loaded from: classes6.dex */
|
|
public class Sequence implements Iterator<M> {
|
|
private int cursor;
|
|
final Stack this$1;
|
|
|
|
public Sequence(Stack stack) {
|
|
this.this$1 = stack;
|
|
this.cursor = stack.size();
|
|
}
|
|
|
|
@Override // java.util.Iterator
|
|
public M next() {
|
|
if (!hasNext()) {
|
|
return null;
|
|
}
|
|
Stack stack = this.this$1;
|
|
int i = this.cursor - 1;
|
|
this.cursor = i;
|
|
return (M) stack.get(i);
|
|
}
|
|
|
|
@Override // java.util.Iterator
|
|
public void remove() {
|
|
this.this$1.purge(this.cursor);
|
|
}
|
|
|
|
@Override // java.util.Iterator
|
|
public boolean hasNext() {
|
|
return this.cursor > 0;
|
|
}
|
|
}
|
|
}
|
|
}
|