public void Visit(AndForestNode andNode) { foreach (var child in andNode.Children) { child.Accept(this); } }
private void LazyLoadChildren(AndForestNode andNode) { foreach (var child in andNode.Children) { switch (child) { // skip intermediate nodes by enumerating children only case IIntermediateForestNode intermediateNode: var currentAndNode = this.disambiguationAlgorithm.GetCurrentAndNode(intermediateNode); LazyLoadChildren(currentAndNode); break; // create a internal tree node for symbol forest nodes case ISymbolForestNode symbolNode: this.children.Add(new InternalTreeNode(symbolNode, this.disambiguationAlgorithm)); break; // create a tree token node for token forest nodes case ITokenForestNode tokenNode: this.children.Add(new TokenTreeNode(tokenNode)); break; default: throw new Exception("Unrecognized NodeType"); } } }
private bool AreAndNodesEqual(AndForestNode firstAndNode, AndForestNode secondAndNode) { if (firstAndNode.Children.Count != secondAndNode.Children.Count) { return(false); } for (var i = 0; i < firstAndNode.Children.Count; i++) { if (!Equals( firstAndNode.Children[i], secondAndNode.Children[i])) { return(false); } } return(true); }