Exemple #1
0
		private static void BuildChildrenHelper(Family family, List<ForestNode[]> startList, Sentence rhs, int position) {
			if (position + 1 != rhs.Count && family.Production != null) {
				throw new Exception();
			}
			if (family.Members.Count == 1) {
				if (position != 0) {
					throw new Exception();
				}
				var onlyNode = family.Members[0];
				AddNode(onlyNode, startList, rhs, position);
			} else if (family.Members.Count == 2) {
				var rightNode = family.Members[1];
				AddNode(rightNode, startList, rhs, position);
				var intermediateNode = (IntermediateNode)family.Members[0];
				var firstCopy = startList.ToList();
				startList.Clear();
				foreach (var subfamily in intermediateNode.Families) {
					var listCopy = firstCopy.ToList();
					BuildChildrenHelper(subfamily, listCopy, rhs, position - 1);
					startList.AddRange(listCopy);
				}
			} else {
				throw new Exception();
			}
		}
Exemple #2
0
		internal void AddFamily(Family family) {
			_familiesInternal.Add(family);
		}
Exemple #3
0
		public FamilyNode(Family family, string id, int rank) {
			_family = family;
			_id = id;
			Rank = rank;
		}
Exemple #4
0
		internal ForestOption(Family family) {
			_family = family;
		}