/// <summary> /// 转换为Prime树节点 /// </summary> private PrimeTreeNode <TNode> ToPrimeTreeNode(TNode node) { var result = new PrimeTreeNode <TNode> { Data = node }; return(result); }
/// <summary> /// 添加节点 /// </summary> private void AddNode(List <PrimeTreeNode <TNode> > result, PrimeTreeNode <TNode> node) { if (node == null) { return; } if (IsRoot(node.Data)) { result.Add(node); } if (IsLeaf(node.Data)) { return; } node.Children = GetChilds(node.Data); foreach (var child in node.Children) { AddNode(result, child); } }