Esempio n. 1
0
            public static WordTreeNode Create()
            {
                var root = new WordTreeNode();

                var seq = Enum.GetValues(typeof(T))
                          .Cast <T>()
                          .Select(v => new { EnumValue = v, TextValue = v.ToString() });

                foreach (var a in seq)
                {
                    root.Add(a.TextValue, a.EnumValue);
                }
                return(root);
            }
Esempio n. 2
0
 public void Add(string s, T t)
 {
     if (!string.IsNullOrEmpty(s))
     {
         var ch = _UPPER_INVARIANT_MAP[s[0]];
         if (!_CurrentLevel.TryGetValue(ch, ref _this_next))
         {
             _this_next = new WordTreeNode();
             _CurrentLevel.Add(ch, _this_next);
         }
         _this_next.Add(s.Substring(1), t);
     }
     else
     {
         _TValue = t;
     }
 }