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(); } }
internal void AddFamily(Family family) { _familiesInternal.Add(family); }
public FamilyNode(Family family, string id, int rank) { _family = family; _id = id; Rank = rank; }
internal ForestOption(Family family) { _family = family; }