示例#1
0
        public void Add(string word, string key)
        {
            if (word == null)
                return;

            if (word.Length == 0)
            {
                if (_keys == null)
                    _keys = new List<string>();

                _keys.Add(key);
                return;
            }

            if (_dictionary == null)
                _dictionary = new Dictionary<char, MonitorIndexItem>();

            if (!_dictionary.ContainsKey(word[0]))
                _dictionary[word[0]] = new MonitorIndexItem();

            _dictionary[word[0]].Add(word.Substring(1), key);
        }
示例#2
0
 public void Flush()
 {
     _root = new MonitorIndexItem();
     _keyIndex = new Dictionary<string, List<string>>();
 }