/// <summary> /// 设置默认值 /// </summary> private void SetDefault(PrimeTreeNode <TNode> node) { if (_async) { node.Leaf = false; } }
/// <summary> /// 设置叶节点状态 /// </summary> private void SetLeaf(PrimeTreeNode <TNode> node) { if (_async) { node.Leaf = true; } }
/// <summary> /// 转换为Prime树节点 /// </summary> private PrimeTreeNode <TNode> ToPrimeTreeNode(TNode node) { var result = new PrimeTreeNode <TNode> { Data = node }; return(result); }
/// <summary> /// 转换为Prime树节点 /// </summary> private PrimeTreeNode <TNode> ToPrimeTreeNode(TNode node) { var result = new PrimeTreeNode <TNode> { Data = node, Expanded = _allExpand ? true : node.Expanded }; return(result); }
/// <summary> /// 添加节点 /// </summary> private void AddNode(List <PrimeTreeNode <TNode> > result, PrimeTreeNode <TNode> node) { if (node == null) { return; } SetDefault(node); if (IsRoot(node.Data)) { result.Add(node); } if (IsLeaf(node.Data)) { return; } node.Children = GetChildren(node.Data); foreach (var child in node.Children) { AddNode(result, child); } }