public static WordTrieNode_v2 Create() { var root = new WordTrieNode_v2(); 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); }
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 WordTrieNode_v2(); _CurrentLevel.Add(ch, _this_next); } _this_next.Add(s.Substring(1), t); } else { _TValue = t; } }
public EnumParser() { _FirstWordTrieNode = WordTrieNode_v2.Create(); }