コード例 #1
0
        /// <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);
        }
コード例 #2
0
        /// <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);
        }