Example #1
0
        private void Find(TextTrieMap.CharacterNode node, String text, int start,
                          int index, TextTrieMap.ResultHandler handler)
        {
            IIterator itr = node.Iterator();

            if (itr != null)
            {
                if (!handler.HandlePrefixMatch(index - start, itr))
                {
                    return;
                }
            }
            if (index < text.Length)
            {
                IList childNodes = node.GetChildNodes();
                if (childNodes == null)
                {
                    return;
                }
                int ch    = IBM.ICU.Text.UTF16.CharAt(text, index);
                int chLen = IBM.ICU.Text.UTF16.GetCharCount(ch);
                for (int i = 0; i < childNodes.Count; i++)
                {
                    TextTrieMap.CharacterNode child = (TextTrieMap.CharacterNode)childNodes[i];
                    if (Compare(ch, child.GetCharacter()))
                    {
                        Find(child, text, start, index + chLen, handler);
                        break;
                    }
                }
            }
        }