Esempio n. 1
0
    /// <summary>
    /// This method checks to see if a certain path is contained in the subtrie.
    /// </summary>
    /// <param name="myList"></param>
    /// <returns></returns>
    public bool Contains(IList <ArrayPathType> myList)
    {
        List <ITrieNode <ArrayPathType, StoredItemType> > myRootItem = Root;
        ITrieNode <ArrayPathType, StoredItemType>         lastMatch  = null;

        for (int i = 0; i < myList.Count; i++)
        {
            var Match = SearchSubtreeForMatchingType(myList[i], myRootItem);
            if (Match == null)
            {
                break;
            }
            else
            {
                myRootItem = Match.Children;
                lastMatch  = Match;
            }
        }
        return(lastMatch != null && lastMatch.CompareTo(myList[myList.Count - 1]) == 0);
    }