private NodeFirstLevelTop <T> PutInnerFirst(NodeFirstLevelTop <T> node, string s, int d, T value) { if (node == null) { node = new NodeFirstLevelTop <T>(); } int index = (s[d] - _startSymbol); NodeFirstLevelBottom <T> node1 = node.Next[index]; if (node1 == null) { node1 = new NodeFirstLevelBottom <T>(); } d++; int index1 = (s[d] - _startSymbol); node1.Next[index1] = PutInnerOther(node1.Next[index1], s, d + 1, value); node.Next[index] = node1; return(node); }
public SearchResult Get(String key1) { var key = key1.ToLower(); int d = 0; int index = (key[d] - _startSymbol); if (_root == null) { return new SearchResult() { Result = SearchResultTstEnum.NotFound } } ; NodeFirstLevelBottom <T> node = _root.Next[index]; if (node == null) { return new SearchResult() { Result = SearchResultTstEnum.NotFound } } ; if (d == 0) { d++; index = (key[d] - _startSymbol); Node <T> nd = node.Next[index]; if (nd == null) { return new SearchResult() { Result = SearchResultTstEnum.NotFound } } ; nd = GetInnerOther(nd, key, d + 1); if (nd == null) { return new SearchResult() { Result = SearchResultTstEnum.NotFound } } ; if (nd.HasValue) { return new SearchResult() { Result = SearchResultTstEnum.Found, Value = nd.Value } } ; return(new SearchResult() { Result = SearchResultTstEnum.Contain }); } return(new SearchResult() { Result = SearchResultTstEnum.NotFound }); }