/// <summary> /// Get all factor tree nodes that belongs /// to this factor tree node. /// This tree node is also included in the result. /// </summary> public FactorTreeNodeList GetAllChildTreeNodes() { FactorTreeNodeList factorTreeNodeList; factorTreeNodeList = new FactorTreeNodeList(); factorTreeNodeList.Add(this); if (_children.IsNotEmpty()) { foreach (FactorTreeNode 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> public FactorTreeNodeList GetAllLeafTreeNodes() { FactorTreeNodeList leafs; leafs = new FactorTreeNodeList(); if (_children.IsEmpty()) { leafs.Add(this); } else { foreach (FactorTreeNode child in _children) { leafs.AddRange(child.GetAllLeafTreeNodes()); } } return(leafs); }
/// <summary> /// Add a factor tree node to the parents /// of this factor tree node. /// </summary> /// <param name='factorTreeNode'>Factor tree node to add.</param> public void AddParent(FactorTreeNode factorTreeNode) { _parents.Add(factorTreeNode); }
/// <summary> /// Add a factor tree node to the children /// of this factor tree node. /// </summary> /// <param name='factorTreeNode'>Factor tree node to add.</param> public void AddChild(FactorTreeNode factorTreeNode) { factorTreeNode.AddParent(this); _children.Add(factorTreeNode); }