private void AddUniqueAndNode(IForestNode firstChild, IForestNode secondChild) { var childCount = 1 + ((secondChild == null) ? 0 : 1); for (var c = 0; c < _children.Count; c++) { var andNode = _children[c]; if (andNode.Children.Count != childCount) { continue; } if (IsMatchedSubTree(firstChild, secondChild, andNode)) { return; } } // not found so return new and node var newAndNode = new AndForestNode(); newAndNode.AddChild(firstChild); if (childCount > 1) { newAndNode.AddChild(secondChild); } _children.Add(newAndNode); }
private void CloneUniqueChildSubTree(IInternalForestNode internalCompletedParseNode) { for (var a = 0; a < internalCompletedParseNode.Children.Count; a++) { var andNode = internalCompletedParseNode.Children[a]; var newAndNode = new AndForestNode(); for (var c = 0; c < andNode.Children.Count; c++) { var child = andNode.Children[c]; newAndNode.AddChild(child); } _children.Add(newAndNode); } }
private void AddUniqueAndNode(IForestNode firstChild, IForestNode secondChild) { var childCount = 1 + ((secondChild == null) ? 0 : 1); for (var c = 0; c < _children.Count; c++) { var andNode = _children[c]; if (andNode.Children.Count != childCount) continue; if (IsMatchedSubTree(firstChild, secondChild, andNode)) return; } // not found so return new and node var newAndNode = new AndForestNode(); newAndNode.AddChild(firstChild); if (childCount > 1) newAndNode.AddChild(secondChild); _children.Add(newAndNode); }