Пример #1
0
        protected virtual IEnumerable <TValue> SearchDeep(string query, int position)
        {
            TrieNodeBase <TValue> nextNode = this.GetChildOrNull(query, position);

            return(nextNode != null
                       ? nextNode.Retrieve(query, position + nextNode.KeyLength)
                       : Enumerable.Empty <TValue>());
        }
Пример #2
0
        public void Add(string key, int position, TValue value)
        {
            if (key == null)
            {
                throw new ArgumentNullException("key");
            }
            if (EndOfString(position, key))
            {
                this.AddValue(value);
                return;
            }

            TrieNodeBase <TValue> child = this.GetOrCreateChild(key[position]);

            child.Add(key, position + 1, value);
        }