private void LazyLoadChildren(IAndForestNode andNode) { for (int c = 0; c < andNode.Children.Count; c++) { var child = andNode.Children[c]; switch (child.NodeType) { // skip intermediate nodes by enumerating children only case ForestNodeType.Intermediate: var intermediateNode = child as IIntermediateForestNode; var currentAndNode = _disambiguationAlgorithm.GetCurrentAndNode(intermediateNode); LazyLoadChildren(currentAndNode); break; // create a internal tree node for symbol forest nodes case ForestNodeType.Symbol: var symbolNode = child as ISymbolForestNode; _children.Add(new InternalTreeNode(symbolNode, _disambiguationAlgorithm)); break; // create a tree token node for token forest nodes case ForestNodeType.Token: _children.Add(new TokenTreeNode(child as ITokenForestNode)); break; default: throw new Exception("Unrecognized NodeType"); } } }
public override void Visit(IAndForestNode andNode) { foreach (var child in andNode.Children) { child.Accept(this); } }
public virtual void Visit(IAndForestNode andNode) { for (var c = 0; c < andNode.Children.Count; c++) { var child = andNode.Children[c]; child.Accept(this); } }
public virtual void Visit(IAndForestNode andNode) { for (var c = 0; c < andNode.Children.Count; c++) { var child = andNode.Children[c]; child.Accept(this); } }
public void Visit(IAndForestNode andNode) { for (var i = 0; i < andNode.Children.Count; i++) { var child = andNode.Children[i]; child.Accept(this); } }
private static bool IsMatchedSubTree(IForestNode firstChild, IForestNode secondChild, IAndForestNode andNode) { var firstCompareNode = andNode.Children[0]; // if first child matches the compare node, continue // otherwise return false if (!firstChild.Equals(firstCompareNode)) return false; if (secondChild == null) return true; var secondCompareNode = andNode.Children[1]; // return true if the second child matches // otherwise return false return secondChild.Equals(secondCompareNode); }
bool AreAndNodesEqual(IAndForestNode firstAndNode, IAndForestNode secondAndNode) { if (firstAndNode.Children.Count != secondAndNode.Children.Count) { return(false); } for (int i = 0; i < firstAndNode.Children.Count; i++) { if (!Equals( firstAndNode.Children[i], secondAndNode.Children[i])) { return(false); } } return(true); }
public override void Visit(IAndForestNode andNode) { foreach (var child in andNode.Children) child.Accept(this); }
private static bool IsMatchedSubTree(IForestNode firstChild, IForestNode secondChild, IAndForestNode andNode) { var firstCompareNode = andNode.Children[0]; // if first child matches the compare node, continue // otherwise return false if (!firstChild.Equals(firstCompareNode)) { return(false); } if (secondChild == null) { return(true); } var secondCompareNode = andNode.Children[1]; // return true if the second child matches // otherwise return false return(secondChild.Equals(secondCompareNode)); }
private void LazyLoadChildren(IAndForestNode andNode) { for (int c = 0; c < andNode.Children.Count; c++) { var child = andNode.Children[c]; switch (child.NodeType) { // skip intermediate nodes by enumerating children only case ForestNodeType.Intermediate: var intermediateNode = child as IIntermediateForestNode; var currentAndNode = _disambiguationAlgorithm.GetCurrentAndNode(intermediateNode); LazyLoadChildren(currentAndNode); break; // create a internal tree node for symbol forest nodes case ForestNodeType.Symbol: var symbolNode = child as ISymbolForestNode; _children.Add(new InternalTreeNode(symbolNode, _disambiguationAlgorithm)); break; // create a tree token node for token forest nodes case ForestNodeType.Token: _children.Add(new TokenTreeNode(child as ITokenForestNode)); break; default: throw new Exception("Unrecognized NodeType"); } } }