/// <summary> /// Add the IFC entity string into the Trie /// </summary> /// <param name="word">the IFC entity name</param> public void AddEntry(string word) { for (int wordcharCnt = 0; wordcharCnt < word.Length; wordcharCnt++) { IFCEntityTrieNode currNode = m_Root; for (int cnt = wordcharCnt; cnt < word.Length; cnt++) { currNode = currNode.GetChild(word[cnt], FilteredIFCEntityDict, true); if (currNode == null) { break; } } } }
/// <summary> /// Get the list of IFC entities given the partial name /// </summary> /// <param name="partialWord">partial word to search</param> /// <returns>the list of IFC entities that contain the partial word</returns> public IList <string> PartialWordSearch(string partialWord) { SortedList <string, string> foundItems = new SortedList <string, string>(); IFCEntityTrieNode currNode = m_Root; for (int cnt = 0; cnt < partialWord.Length; cnt++) { currNode = currNode.GetChild(partialWord[cnt], FilteredIFCEntityDict); if (currNode == null) { break; } } if (currNode != null) { foreach (short idx in currNode.IndexItemsWithSubstring) { foundItems.Add(FilteredIFCEntityDict[idx], null); } } return(foundItems.Keys.ToList()); }