/// <summary> /// Get all factor tree nodes that belongs /// to this factor tree node. /// This tree node is also included in the result. /// </summary> /// <returns> /// All factor tree nodes that belongs /// to this factor tree node. /// </returns> public FactorTreeNodeList GetAllChildTreeNodes() { FactorTreeNodeList factorTreeNodeList = new FactorTreeNodeList { this }; if (Children.IsNotEmpty()) { foreach (IFactorTreeNode child in Children) { factorTreeNodeList.AddRange(child.GetAllChildTreeNodes()); } } return(factorTreeNodeList); }
/// <summary> /// Get all leafs that belongs to this factor tree node. /// This tree node may also be included in the result. /// </summary> /// <returns>All leaf tree node that belongs to this factor tree node.</returns> public FactorTreeNodeList GetAllLeafTreeNodes() { FactorTreeNodeList leaves = new FactorTreeNodeList(); if (Children.IsEmpty()) { leaves.Add(this); } else { foreach (IFactorTreeNode child in Children) { leaves.AddRange(child.GetAllLeafTreeNodes()); } } return(leaves); }