Beispiel #1
0
        /// <summary>
        /// Get a subset of this factor list by search string
        /// </summary>
        /// <param name="searchString">Search string</param>
        /// <param name="comparisonType">Type of string comparison</param>
        /// <returns>A factor list</returns>
        public FactorList GetFactorsBySearchString(String searchString, StringComparison comparisonType)
        {
            FactorList factors = new FactorList();
            var        subset  = from Factor factor in this
                                 where factor.Label.StartsWith(searchString, comparisonType)
                                 orderby factor.Label ascending
                                 select factor;

            factors.AddRange(subset.ToArray());
            return(factors);
        }
        /// <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>
 /// Private constructor. Makes a clone of a UserParameterSelection.
 /// </summary>
 /// <param name="userParameterSelection">UserParameterSelection to clone</param>
 private UserParameterSelection(UserParameterSelection userParameterSelection)
 {
     _factors = new FactorList(true);
     _factors.AddRange(userParameterSelection.Factors);
     _hosts = new TaxonList(true);
     _hosts.AddRange(userParameterSelection.Hosts);
     _individualCategories = new IndividualCategoryList(true);
     _individualCategories.AddRange(userParameterSelection.IndividualCategories);
     _periods = new PeriodList(true);
     _periods.AddRange(userParameterSelection.Periods);
     _references = new ReferenceList(true);
     _references.AddRange(userParameterSelection.References);
     _taxa = new TaxonList(true);
     _taxa.AddRange(userParameterSelection.Taxa);
 }
        /// <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);
        }