isLeaf() public method

public isLeaf ( ) : bool
return bool
Beispiel #1
0
        public List <EmojiSearchResult> findEmoji(string str)
        {
            List <EmojiSearchResult> emojiSearchResults = new List <EmojiSearchResult>();

            EmojiTreeNode currentNode = root;
            int           start       = 0;

            for (int i = 0; i < str.Length; i++)
            {
                Char ch = str[i];

                currentNode = currentNode.get(ch);

                if (currentNode != null)
                {
                    if (currentNode.isLeaf())
                    {
                        // save
                        emojiSearchResults.Add(new EmojiSearchResult(currentNode.code, start, i));
                    }
                    else
                    {
                        continue;
                    }
                }


                currentNode = root;
                start       = i + 1;
            }

            return(emojiSearchResults);
        }