internal Node(Node parent, Char c) { _parent = parent; _char = c; _values = new List<string>(); _transitions = new Dictionary<Char, Node>(); }
private void AddKeyword(string keyword) { if (string.IsNullOrEmpty(keyword)) throw new ArgumentException(); Node current = _root; foreach (var item in keyword) { Node next = null; foreach (var transition in current.Transitions) { if (transition != null && transition.Char.CompareTo(item) == 0) { next = transition; break; } } if (next == null) { next = new Node(current, item); current.AddTransition(next); } current = next; } current.AddValue(keyword); current.Lable = keyword; }
internal void AddTransition(Node node) { _transitions.Add(node.Char, node); }