Lines Matching defs:trie
37 final SmartDialTrie trie = new SmartDialTrie();
38 trie.put(new ContactNumber(0, "Jason", "0", "0", 1));
39 assertEquals(1, trie.size());
40 trie.put(new ContactNumber(1, "Mary", "0", "1", 2));
41 assertEquals(2, trie.size());
42 trie.put(new ContactNumber(2, "John", "0", "2", 3));
43 assertEquals(3, trie.size());
47 final SmartDialTrie trie = new SmartDialTrie();
50 trie.put(jasonsmith);
51 trie.put(jasonsmitt);
52 assertTrue(trie.getAllWithPrefix("5276676484").contains(jasonsmith));
53 assertFalse(trie.getAllWithPrefix("5276676484").contains(jasonsmitt));
55 assertFalse(trie.getAllWithPrefix("5276676488").contains(jasonsmith));
56 assertTrue(trie.getAllWithPrefix("5276676488").contains(jasonsmitt));
61 final SmartDialTrie trie = new SmartDialTrie();
65 trie.put(maryjane);
66 trie.put(sarahsmith);
67 trie.put(jasonsmitt);
70 assertTrue(checkContains(trie, maryjane, "6279"));
71 assertFalse(checkContains(trie, jasonsmitt, "6279"));
74 assertFalse(checkContains(trie, maryjane, "72"));
75 assertTrue(checkContains(trie, sarahsmith, "72"));
76 assertFalse(checkContains(trie, jasonsmitt, "72"));
79 assertFalse(checkContains(trie, maryjane, "76"));
80 assertTrue(checkContains(trie, sarahsmith, "76"));
81 assertTrue(checkContains(trie, jasonsmitt, "76"));
85 final SmartDialTrie trie = new SmartDialTrie();
87 trie.put(jasonfwilliams);
90 assertTrue(checkContains(trie, jasonfwilliams, "527"));
92 assertTrue(checkContains(trie, jasonfwilliams, "945"));
94 assertFalse(checkContains(trie, jasonfwilliams, "66"));
98 final SmartDialTrie trie = new SmartDialTrie();
101 trie.put(martinjuniorharry);
103 assertTrue(checkContains(trie, martinjuniorharry, "654"));
105 assertFalse(checkContains(trie, martinjuniorharry, "456"));
107 assertTrue(checkContains(trie, martinjuniorharry, "6542"));
109 assertTrue(checkContains(trie, martinjuniorharry, "542"));
111 assertTrue(checkContains(trie, martinjuniorharry, "642"));
113 assertTrue(checkContains(trie, martinjuniorharry, "6542779"));
115 assertTrue(checkContains(trie, martinjuniorharry, "65742779"));
117 assertTrue(checkContains(trie, martinjuniorharry, "542779"));
119 assertFalse(checkContains(trie, martinjuniorharry, "547"));
121 assertFalse(checkContains(trie, martinjuniorharry, "655"));
123 assertFalse(checkContains(trie, martinjuniorharry, "653"));
125 assertFalse(checkContains(trie, martinjuniorharry, "6543"));
127 assertEquals(8, trie.numEntries());
131 final SmartDialTrie trie = new SmartDialTrie();
134 trie.put(alphabet);
135 assertEquals(20, trie.numEntries());
137 assertTrue(checkContains(trie, alphabet, "22233344455566677778889999"));
138 assertTrue(checkContains(trie, alphabet, "33344455566677778889999"));
139 assertTrue(checkContains(trie, alphabet, "44455566677778889999"));
140 assertTrue(checkContains(trie, alphabet, "55566677778889999"));
141 assertTrue(checkContains(trie, alphabet, "66677778889999"));
142 assertTrue(checkContains(trie, alphabet, "77778889999"));
143 assertTrue(checkContains(trie, alphabet, "8889999"));
144 assertTrue(checkContains(trie, alphabet, "9999"));
146 assertTrue(checkContains(trie, alphabet, "12345678"));
149 assertTrue(checkContains(trie, alphabet, "2389999"));
150 assertTrue(checkContains(trie, alphabet, "239999"));
151 assertTrue(checkContains(trie, alphabet, "23888"));
152 assertTrue(checkContains(trie, alphabet, "2333"));
153 assertTrue(checkContains(trie, alphabet, "289999"));
154 assertTrue(checkContains(trie, alphabet, "2888"));
155 assertTrue(checkContains(trie, alphabet, "29999"));
156 assertTrue(checkContains(trie, alphabet, "3888"));
157 assertTrue(checkContains(trie, alphabet, "39999"));
158 assertTrue(checkContains(trie, alphabet, "389999"));
159 assertTrue(checkContains(trie, alphabet, "89999"));
163 final SmartDialTrie trie = new SmartDialTrie();
168 trie.put(alphabet);
169 assertTrue(checkContains(trie, alphabet, "2222"));
173 assertEquals(38, trie.numEntries());
178 trie.put(alphabet2);
180 assertEquals(40, trie.numEntries());
184 final SmartDialTrie trie = new SmartDialTrie();
186 final ParseInfo info = trie.parseToIndexes(name, 2, 2);
200 final ParseInfo info2 = trie.parseToIndexes(name2, 2, 2);
205 final ParseInfo info3 = trie.parseToIndexes(name3, 3, 3);
210 final ParseInfo info4 = trie.parseToIndexes(name4, 2, 3);
215 final ParseInfo info5 = trie.parseToIndexes(name5, 4, 4);
221 final SmartDialTrie trie = new SmartDialTrie();
224 trie.put(reenee);
225 trie.put(bronte);
226 assertTrue(checkContains(trie, reenee, "733633"));
227 assertTrue(checkContains(trie, bronte, "276683"));
231 final SmartDialTrie trie = new SmartDialTrie();
234 trie.put(contact);
235 trie.put(teacher);
236 assertTrue(checkContains(trie, contact, "12345678"));
238 assertTrue(checkContains(trie, teacher, "17847233"));
240 assertTrue(checkContains(trie, teacher, "14832"));
244 final SmartDialTrie trie = new SmartDialTrie();
246 trie.put(contactno1);
248 trie.put(contactno2);
250 trie.put(contactno3);
252 assertTrue(checkContains(trie, contactno1, "510"));
253 assertFalse(checkContains(trie, contactno1, "511"));
254 assertTrue(checkContains(trie, contactno2, "77212862357"));
255 assertFalse(checkContains(trie, contactno2, "77212862356"));
256 assertTrue(checkContains(trie, contactno3, "1368"));
257 assertFalse(checkContains(trie, contactno3, "1367"));
262 final SmartDialTrie trie = new SmartDialTrie();
264 trie.put(contactno1);
267 assertTrue(checkContains(trie, contactno1, "1368"));
268 assertTrue(checkContains(trie, contactno1, "368497"));
269 assertFalse(checkContains(trie, contactno1, "2368497"));
272 trie.put(contactno2);
274 assertTrue(checkContains(trie, contactno2, "6591776930"));
275 assertTrue(checkContains(trie, contactno2, "91776930"));
276 assertFalse(checkContains(trie, contactno2, "591776930"));
279 trie.put(contactno3);
280 assertTrue(checkContains(trie, contactno3, "85212345678"));
281 assertTrue(checkContains(trie, contactno3, "12345678"));
282 assertFalse(checkContains(trie, contactno2, "5212345678"));
286 trie.put(contactno4);
287 assertTrue(checkContains(trie, contactno4, "85112345678"));
288 assertFalse(checkContains(trie, contactno4, "12345678"));
292 trie.put(contactno5);
297 final SmartDialTrie trie = new SmartDialTrie(true /* formatNanp */);
300 trie.put(contactno1);
302 assertTrue(checkContains(trie, contactno1, "16503337596"));
303 assertTrue(checkContains(trie, contactno1, "6503337596"));
304 assertTrue(checkContains(trie, contactno1, "3337596"));
308 trie.put(contactno2);
309 assertTrue(checkContains(trie, contactno2, "5109921234"));
310 assertTrue(checkContains(trie, contactno2, "9921234"));
314 trie.put(contactno3);
315 assertTrue(checkContains(trie, contactno3, "4151234567"));
316 assertTrue(checkContains(trie, contactno3, "1234567"));
320 trie.put(contactno4);
321 assertTrue(checkContains(trie, contactno4, "15102849170"));
322 assertTrue(checkContains(trie, contactno4, "5102849170"));
323 assertTrue(checkContains(trie, contactno4, "2849170"));
327 trie.put(contactno5);
329 assertTrue(checkContains(trie, contactno5, "1415123123"));
331 assertFalse(checkContains(trie, contactno5, "415123123"));
332 assertFalse(checkContains(trie, contactno5, "123123"));
336 trie.put(contactno6);
338 assertTrue(checkContains(trie, contactno6, "415123123"));
340 assertFalse(checkContains(trie, contactno6, "123123"));
344 trie.put(contactno7);
345 trie, contactno7, "15102849170"));
346 assertTrue(checkContains(trie, contactno7, "5102849170"));
347 assertTrue(checkContains(trie, contactno7, "2849170"));
348 assertFalse(checkContains(trie, contactno7, "849170"));
349 assertFalse(checkContains(trie, contactno7, "10849170"));
353 trie.put(contactno8);
354 assertTrue(checkContains(trie, contactno8, "1510284917"));
355 assertTrue(checkContains(trie, contactno8, "510284917"));
356 assertFalse(checkContains(trie, contactno8, "2849170"));
360 trie.put(contactno9);
361 assertTrue(checkContains(trie, contactno9, "8575102849170"));
362 assertFalse(checkContains(trie, contactno9, "5102849170"));
363 assertFalse(checkContains(trie, contactno9, "2849170"));
409 private boolean checkContains(SmartDialTrie trie, ContactNumber contact, CharSequence prefix) {
410 return trie.getAllWithPrefix(prefix).contains(contact);