private IList <GeneralPurposeTreeNode <NT> > GetHive() { var nodes = Repository.GetTreeUnderRoot(Id); return(TreeUtils.BuildSubtree(nodes)); //var stack = new Stack<GeneralPurposeTreeNode<NT>>(); //Func<GeneralPurposeTreeNode<NT>> getParent = () => stack.Count == 0 ? null : stack.Peek(); //var result = new List<GeneralPurposeTreeNode<NT>>(); //foreach (var node in nodes) { // var parent = getParent(); // try { // while (parent != null && parent.Id != node.ParentId) { // stack.Pop(); // parent = getParent(); // } // if (parent == null) // continue; // if (parent.Childs == null) // parent.Childs = new List<GeneralPurposeTreeNode<NT>>(); // parent.Childs.Add(node); // node.Parent = parent; // } // finally { // if (parent == null) { // result.Add(node); // node.Parent = null; // } // stack.Push(node); // } //} //return result; }
private IList <GeneralPurposeTreeNode <T> > GetChildren() { if (Repository == null) { return(null); } return(TreeUtils.BuildSubtree(Repository.GetTreeUnderNode(this.Id), this)); }