protected virtual void SetNodeDepth(TreeNodeBase node) { int num = 0; if (node.Degree > 0) { for (int i = 0; i < node.Degree; i++) { if (num < (node[i].Depth + 1)) { num = node[i].Depth + 1; } } } node.pdepth = num; }
protected virtual void SetParentDepth(TreeNodeBase node) { TreeNodeBase parent = node; while (true) { this.SetNodeDepth(parent); if (parent.IsRoot) { return; } parent = parent.Parent as TreeNodeBase; } }
protected virtual void PlusParentDepth(TreeNodeBase node) { if (!this.IsRoot) { ITreeNode node2 = node; for (TreeNodeBase base2 = node.Parent as TreeNodeBase; base2 != null; base2 = node2.Parent as TreeNodeBase) { if (base2.pdepth <= node2.Depth) { base2.pdepth = node2.Depth + 1; } node2 = base2; } } }
protected void PlusDepthAndLevel(TreeNodeBase childNode) { if (childNode != null) { this.PlusChildLevel(childNode); childNode.pparent = this; this.PlusParentDepth(childNode); } }
protected virtual void PlusChildLevel(TreeNodeBase node) { if (node != null) { node.plevel = this.Level + 1; if (node.Degree > 0) { for (int i = 0; i < node.Degree; i++) { this.PlusChildLevel(node[i] as TreeNodeBase); } } } }
protected void MinusDepthAndLevel(TreeNodeBase childNode) { if (childNode != null) { bool flag = true; childNode.pparent = null; this.MinusChildLevel(childNode); if ((this.Depth == (childNode.Depth + 1)) && (this.Degree > 0)) { for (int i = 0; i < this.Degree; i++) { if (this[i].Depth == (this.Depth - 1)) { flag = false; break; } } } if (flag) { this.SetParentDepth(this); } } }
protected virtual void MinusChildLevel(TreeNodeBase node) { if (node != null) { if (node.IsRoot) { node.plevel = 0; } else { node.plevel = node.Parent.Level + 1; } node.plevel = this.Level + 1; if (node.Degree > 0) { for (int i = 0; i < node.Degree; i++) { this.MinusChildLevel(node[i] as TreeNodeBase); } } } }