Esempio n. 1
0
		internal override void GetGraphHelper(Graph g, SppfNodeNode myNode, HashSet<InteriorNode> visited) {
			if (visited.Contains(this)) {
				return;
			}
			visited.Add(this);

			// foreach (var family in Families) {
			for (int i = 0; i < Families.Count; i++) {
				var family = Families[i];
				Production singletonProduction = null;
				INode prevNode;
				if (Families.Count == 1) {
					prevNode = myNode;
					singletonProduction = Families[0].Production;
				} else {
					prevNode = new FamilyNode(family, myNode.Node.Id + "-" + i, myNode.Rank + 1);
					// g.AddEdge(myNode, prevNode, family.Production);
					g.AddEdge(myNode, prevNode);
				}
				foreach (var child in family.Members) {
					var childNode = new SppfNodeNode(child, prevNode.Rank + 1);
					// var childNode = g.GetNode(child, prevNode.Rank + 1);
					// g.AddEdge(prevNode, childNode, singletonProduction);
					g.AddEdge(prevNode, childNode);
					child.GetGraphHelper(g, childNode, visited);
				}
			}
		}
Esempio n. 2
0
		internal Graph Graph() {
			if (_graph == null) {
				//int id = 0;
				_currentNode = new ForestNodeNode(Root, "" + _id++, 0);
				_ids[Root.InternalNode] = 0;
				_graph = new Graph(_currentNode);
				//GetGraphHelper(g, myNode, new HashSet<InteriorNode>(), new Dictionary<InteriorNode, int> { { _node, 0 } }, ref id);
				Root.Accept(this);
			}

			return _graph;
		}
Esempio n. 3
0
		internal abstract void GetGraphHelper(Graph g, SppfNodeNode myNode, HashSet<InteriorNode> visited);
Esempio n. 4
0
		public Graph GetGraph() {
			var node = new SppfNodeNode(this, 0);
			var g = new Graph(node);			
			GetGraphHelper(g, node, new HashSet<InteriorNode>());
			return g;
		}
Esempio n. 5
0
		internal override void GetGraphHelper(Graph g, SppfNodeNode myNode, HashSet<InteriorNode> visited) {
			return;
		}