PrefixSearchEngine.java
3.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
package com.bitstrips.imoji.search;
import android.os.AsyncTask;
import android.support.annotation.WorkerThread;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
public class PrefixSearchEngine
{
private final SearchIndex a;
public PrefixSearchEngine(SearchIndex paramSearchIndex)
{
this.a = paramSearchIndex;
}
private static List<String> a(String paramString)
{
paramString = paramString.toLowerCase().replace("'", "").split(" ");
ArrayList localArrayList = new ArrayList(paramString.length);
int j = paramString.length;
int i = 0;
while (i < j)
{
Object localObject = paramString[i];
if (!((String)localObject).isEmpty()) {
localArrayList.add(localObject);
}
i += 1;
}
return localArrayList;
}
private static boolean a(List<String> paramList1, List<String> paramList2)
{
paramList1 = paramList1.iterator();
while (paramList1.hasNext()) {
if (!paramList2.contains((String)paramList1.next())) {
return false;
}
}
return true;
}
private static boolean b(List<String> paramList1, List<String> paramList2)
{
paramList1 = paramList1.iterator();
for (;;)
{
if (paramList1.hasNext())
{
String str = (String)paramList1.next();
Iterator localIterator = paramList2.iterator();
do
{
if (!localIterator.hasNext()) {
break;
}
} while (!((String)localIterator.next()).startsWith(str));
}
for (int i = 1; i == 0; i = 0)
{
return false;
return true;
}
}
}
public void fetchMatchingTags(final String paramString, final Callback paramCallback)
{
new AsyncTask() {}.execute(new Void[0]);
}
@WorkerThread
public List<String> getMatchingTags(String paramString)
{
System.currentTimeMillis();
final HashMap localHashMap = new HashMap();
List localList = a(paramString);
if (localList.isEmpty()) {
return new ArrayList();
}
ArrayList localArrayList = new ArrayList();
Iterator localIterator = this.a.getTags().iterator();
label229:
while (localIterator.hasNext())
{
String str = (String)localIterator.next();
paramString = a(str);
if (localList.equals(paramString)) {
paramString = a.a;
}
for (;;)
{
if (paramString == a.f) {
break label229;
}
localHashMap.put(str, Integer.valueOf(paramString.g));
localArrayList.add(str);
break;
if (a(localList, paramString))
{
if (((String)paramString.get(0)).equals(localList.get(0))) {
paramString = a.b;
} else {
paramString = a.c;
}
}
else if (b(localList, paramString))
{
if (((String)paramString.get(0)).startsWith((String)localList.get(0))) {
paramString = a.d;
} else {
paramString = a.e;
}
}
else {
paramString = a.f;
}
}
}
Collections.sort(localArrayList, new Comparator() {});
return localArrayList;
}
public static abstract interface Callback
{
public abstract void onComplete(List<String> paramList);
}
static enum a
{
final int g;
private a(int paramInt)
{
this.g = paramInt;
}
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/com/bitstrips/imoji/search/PrefixSearchEngine.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/