/// <summary>
        /// Get all child factors that belongs to this factor tree node.
        /// The factor for this tree node is also included in the result.
        /// </summary>
        public FactorList GetAllChildFactors()
        {
            FactorList factors;

            factors = new FactorList();
            factors.Add(Factor);
            if (_children.IsNotEmpty())
            {
                foreach (FactorTreeNode child in _children)
                {
                    factors.AddRange(child.GetAllChildFactors());
                }
            }
            return(factors);
        }
        /// <summary>
        /// Get all child factors that belongs to this factor tree node.
        /// The factor for this tree node may also
        /// be included in the result.
        /// </summary>
        public FactorList GetAllLeafFactors()
        {
            FactorList leafs;

            leafs = new FactorList();
            if (_children.IsEmpty())
            {
                leafs.Add(Factor);
            }
            else
            {
                foreach (FactorTreeNode child in _children)
                {
                    leafs.AddRange(child.GetAllLeafFactors());
                }
            }
            return(leafs);
        }
        /// <summary>
        /// Get all factors that have an impact on this factors value.
        /// Only factors that are automatically calculated
        /// has dependent factors.
        /// </summary>
        /// <returns>Dependent factors.</returns>
        public FactorList GetDependentFactors()
        {
            FactorList factors;

            factors = new FactorList();
            switch (Id)
            {
            case ((Int32)FactorId.RedListCategoryAutomatic):
            case ((Int32)FactorId.RedListCriteriaDocumentationAutomatic):
            case ((Int32)FactorId.RedListCriteriaAutomatic):
                factors.Add(FactorManager.GetFactor(FactorId.AreaOfOccupancy_B2Estimated));
                factors.Add(FactorManager.GetFactor(FactorId.ConservationDependent));
                factors.Add(FactorManager.GetFactor(FactorId.ContinuingDecline));
                factors.Add(FactorManager.GetFactor(FactorId.ContinuingDeclineBasedOn_Bbi));
                factors.Add(FactorManager.GetFactor(FactorId.ContinuingDeclineBasedOn_Bbii));
                factors.Add(FactorManager.GetFactor(FactorId.ContinuingDeclineBasedOn_Bbiii));
                factors.Add(FactorManager.GetFactor(FactorId.ContinuingDeclineBasedOn_Bbiv));
                factors.Add(FactorManager.GetFactor(FactorId.ContinuingDeclineBasedOn_Bbv));
                factors.Add(FactorManager.GetFactor(FactorId.ExtentOfOccurrence_B1Estimated));
                factors.Add(FactorManager.GetFactor(FactorId.ExtremeFluctuations));
                factors.Add(FactorManager.GetFactor(FactorId.ExtremeFluctuationsIn_Bci));
                factors.Add(FactorManager.GetFactor(FactorId.ExtremeFluctuationsIn_Bcii));
                factors.Add(FactorManager.GetFactor(FactorId.ExtremeFluctuationsIn_Bciii));
                factors.Add(FactorManager.GetFactor(FactorId.ExtremeFluctuationsIn_Bciv));
                factors.Add(FactorManager.GetFactor(FactorId.Grading));
                factors.Add(FactorManager.GetFactor(FactorId.MaxProportionLocalPopulation));
                factors.Add(FactorManager.GetFactor(FactorId.MaxSizeLocalPopulation));
                factors.Add(FactorManager.GetFactor(FactorId.NumberOfLocations));
                factors.Add(FactorManager.GetFactor(FactorId.PopulationSize_Total));
                factors.Add(FactorManager.GetFactor(FactorId.ProbabilityOfExtinction));
                factors.Add(FactorManager.GetFactor(FactorId.RedlistEvaluationProgressionStatus));
                factors.Add(FactorManager.GetFactor(FactorId.Reduction_A1));
                factors.Add(FactorManager.GetFactor(FactorId.Reduction_A2));
                factors.Add(FactorManager.GetFactor(FactorId.Reduction_A3));
                factors.Add(FactorManager.GetFactor(FactorId.Reduction_A4));
                factors.Add(FactorManager.GetFactor(FactorId.ReductionBasedOn_A1a));
                factors.Add(FactorManager.GetFactor(FactorId.ReductionBasedOn_A1b));
                factors.Add(FactorManager.GetFactor(FactorId.ReductionBasedOn_A1c));
                factors.Add(FactorManager.GetFactor(FactorId.ReductionBasedOn_A1d));
                factors.Add(FactorManager.GetFactor(FactorId.ReductionBasedOn_A1e));
                factors.Add(FactorManager.GetFactor(FactorId.ReductionBasedOn_A2a));
                factors.Add(FactorManager.GetFactor(FactorId.ReductionBasedOn_A2b));
                factors.Add(FactorManager.GetFactor(FactorId.ReductionBasedOn_A2c));
                factors.Add(FactorManager.GetFactor(FactorId.ReductionBasedOn_A2d));
                factors.Add(FactorManager.GetFactor(FactorId.ReductionBasedOn_A2e));
                factors.Add(FactorManager.GetFactor(FactorId.ReductionBasedOn_A3b));
                factors.Add(FactorManager.GetFactor(FactorId.ReductionBasedOn_A3c));
                factors.Add(FactorManager.GetFactor(FactorId.ReductionBasedOn_A3d));
                factors.Add(FactorManager.GetFactor(FactorId.ReductionBasedOn_A3e));
                factors.Add(FactorManager.GetFactor(FactorId.ReductionBasedOn_A4a));
                factors.Add(FactorManager.GetFactor(FactorId.ReductionBasedOn_A4b));
                factors.Add(FactorManager.GetFactor(FactorId.ReductionBasedOn_A4c));
                factors.Add(FactorManager.GetFactor(FactorId.ReductionBasedOn_A4d));
                factors.Add(FactorManager.GetFactor(FactorId.ReductionBasedOn_A4e));
                factors.Add(FactorManager.GetFactor(FactorId.SeverelyFragmented));
                factors.Add(FactorManager.GetFactor(FactorId.SwedishOccurrence));
                factors.Add(FactorManager.GetFactor(FactorId.VeryRestrictedArea_D2VU));
                if (Id == ((Int32)FactorId.RedListCriteriaDocumentationAutomatic))
                {
                    factors.Add(FactorManager.GetFactor(FactorId.RedListCriteriaDocumentationIntroduction));
                    factors.Add(FactorManager.GetFactor(FactorId.GlobalRedlistCategory));
                    factors.Add(FactorManager.GetFactor(FactorId.GenerationTime));
                    factors.Add(FactorManager.GetFactor(FactorId.LastEncounter));
                    factors.Add(FactorManager.GetFactor(FactorId.ImmigrationOccurs));
                }

                break;
            }

            return(factors);
        }