//internal void GetGraphHelper(Graph g) { // //g.Add(this); // bool changes = false; // var myNode = new NodeNode(this, 0); // foreach (var children in _children) { // var childNode = new ChildNode(_family.Production.Rhs, StartPosition, EndPosition); // changes |= g.AddEdge(myNode, childNode); // foreach (var child in children) { // var mychildNode = new NodeNode(child, 0); // changes |= g.AddEdge(childNode, mychildNode); // } // } // if (changes) { // foreach (var children in _children) { // foreach (var child in children) { // child.GetGraphHelper(g); // } // } // } //} private static void AddNode(SppfNode node, List <ForestNode[]> startList, Sentence rhs, int position) { ForestNode nodeToAdd; if (node is TerminalNode) { nodeToAdd = new ForestLeaf((TerminalNode)node); } else { nodeToAdd = new ForestInternal((SymbolNode)node, (Nonterminal)rhs[position]); } foreach (var children in startList) { children[position] = nodeToAdd; } }
public SppfNodeNode(SppfNode node, int rank) { Node = node; Rank = rank; }
//internal void GetGraphHelper(Graph g) { // //g.Add(this); // bool changes = false; // var myNode = new NodeNode(this, 0); // foreach (var children in _children) { // var childNode = new ChildNode(_family.Production.Rhs, StartPosition, EndPosition); // changes |= g.AddEdge(myNode, childNode); // foreach (var child in children) { // var mychildNode = new NodeNode(child, 0); // changes |= g.AddEdge(childNode, mychildNode); // } // } // if (changes) { // foreach (var children in _children) { // foreach (var child in children) { // child.GetGraphHelper(g); // } // } // } //} private static void AddNode(SppfNode node, List<ForestNode[]> startList, Sentence rhs, int position) { ForestNode nodeToAdd; if (node is TerminalNode) { nodeToAdd = new ForestLeaf((TerminalNode)node); } else { nodeToAdd = new ForestInternal((SymbolNode)node, (Nonterminal)rhs[position]); } foreach (var children in startList) { children[position] = nodeToAdd; } }
internal Family(InteriorNode node1, SppfNode node2) { _nodes.Add(node1); _nodes.Add(node2); }
internal Family(SppfNode node1) { _nodes.Add(node1); }