• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# ISpeciesCohorts类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ISpeciesCohorts的典型用法代码示例。如果您正苦于以下问题:C# ISpeciesCohorts类的具体用法?C# ISpeciesCohorts怎么用?C# ISpeciesCohorts使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ISpeciesCohorts类属于命名空间,在下文中一共展示了ISpeciesCohorts类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: AllExceptYoungest

        //---------------------------------------------------------------------

        public void AllExceptYoungest(ISpeciesCohorts         cohorts,
                                      ISpeciesCohortBoolArray isDamaged)
        {
            //  Youngest is the last cohort (at index Count - 1)
            for (int i = 0; i < (isDamaged.Count - 1); i++)
                isDamaged[i] = true;
        }
开发者ID:LANDIS-II-Foundation,项目名称:Libraries,代码行数:9,代码来源:MockSpeciesCohortsDisturbance.cs


示例2: All

        //---------------------------------------------------------------------

        /// <summary>
        /// Selects all of a species' cohorts for harvesting.
        /// </summary>
        public static void All(ISpeciesCohorts         cohorts,
                               ISpeciesCohortBoolArray isHarvested)
        {
            //loop through all cohorts and mark as harvested
            for (int i = 0; i < isHarvested.Count; i++)
                isHarvested[i] = true;
        }
开发者ID:pjbitterman,项目名称:Extensions-Disturbance,代码行数:12,代码来源:SelectCohorts.cs


示例3: OldestOfSelectedSpecies

        //---------------------------------------------------------------------

        public void OldestOfSelectedSpecies(ISpeciesCohorts         cohorts,
                                            ISpeciesCohortBoolArray isDamaged)
        {
            if (cohorts.Species == SelectedSpecies)
                //  Oldest is first cohort
                isDamaged[0] = true;
        }
开发者ID:LANDIS-II-Foundation,项目名称:Libraries,代码行数:9,代码来源:MockSpeciesCohortsDisturbance.cs


示例4: AllExceptOldest

        //---------------------------------------------------------------------

        /// <summary>
        /// Selects all of a species' cohorts for harvesting except the oldest.
        /// </summary>
        public static void AllExceptOldest(ISpeciesCohorts         cohorts,
                                           ISpeciesCohortBoolArray isHarvested)
        {
            //  Oldest is first (so start at i = 1 instead of i = 0)
            for (int i = 1; i < isHarvested.Count; i++)
                isHarvested[i] = true;
        }
开发者ID:pjbitterman,项目名称:Extensions-Disturbance,代码行数:12,代码来源:SelectCohorts.cs


示例5: Harvest

        //---------------------------------------------------------------------

    	/// <summary>
    	/// Selects which of a species' cohorts are harvested.
    	/// </summary>
    	public void Harvest(ISpeciesCohorts         cohorts,
                            ISpeciesCohortBoolArray isHarvested)
    	{
    	    SelectCohorts.Method selectionMethod;
    	    if (selectionMethods.TryGetValue(cohorts.Species, out selectionMethod))
    	        selectionMethod(cohorts, isHarvested);
    	}
开发者ID:pjbitterman,项目名称:Extensions-Disturbance,代码行数:12,代码来源:MultiSpeciesCohortSelector.cs


示例6: MarkCohortsForDeath

        //---------------------------------------------------------------------

        #region ISpeciesCohortsDisturbance members

        /// <summary>
        /// Mark which cohorts for a species are to be cut (harvested).
        /// </summary>
        public void MarkCohortsForDeath(ISpeciesCohorts cohorts,
                                        ISpeciesCohortBoolArray isKilled)
        {
            CohortSelector.Harvest(cohorts, isKilled);

            int numKilled = 0;
            for (int i = 0; i < isKilled.Count; i++)
            {
                if (isKilled[i])
                {
                    cohortCounts.IncrementCount(cohorts.Species);
                    numKilled++;
                }
            }

            if (isDebugEnabled)
            {
                if (numKilled > 0)
                {
                    string ageList = "";
                    int i = 0;
                    foreach (ICohort cohort in cohorts)
                    {
                        if (isKilled[i])
                            ageList += string.Format(" {0}", cohort.Age);
                        i++;
                    }
                    log.DebugFormat("      Cut {0} :{1}", cohorts.Species.Name, ageList);
                }
            }
        }
开发者ID:LANDIS-II-Foundation,项目名称:Libraries,代码行数:38,代码来源:WholeCohortCutter.cs


示例7: AllOfSelectedSpecies

        //---------------------------------------------------------------------

        public void AllOfSelectedSpecies(ISpeciesCohorts         cohorts,
                                         ISpeciesCohortBoolArray isDamaged)
        {
            if (cohorts.Species == SelectedSpecies) {
                for (int i = 0; i < isDamaged.Count; i++)
                    isDamaged[i] = true;
            }
        }
开发者ID:LANDIS-II-Foundation,项目名称:Libraries,代码行数:10,代码来源:MockSpeciesCohortsDisturbance.cs


示例8: ComputeBiomass

 ////---------------------------------------------------------------------
 //public static string MakeSpeciesMapName(string species)
 //{
 //    return SpeciesMapNames.ReplaceTemplateVars(speciesMapNameTemplate,
 //                                               species,
 //                                               ModelCore.CurrentTime);
 //}
 //--------------------------------------------------------------
 public static double ComputeBiomass(ISpeciesCohorts cohorts)
 {
     double total = 0.0;
     if (cohorts != null)
         foreach (ICohort cohort in cohorts)
             total += (double) (cohort.LeafBiomass + cohort.WoodBiomass);
     return total;
 }
开发者ID:LANDIS-II-Foundation,项目名称:Extensions-Output,代码行数:16,代码来源:PlugIn.cs


示例9: ComputeBiomass

 public static int ComputeBiomass(ISpeciesCohorts cohorts)
 {
     int total = 0;
     if (cohorts != null)
         foreach (ICohort cohort in cohorts)
             total += cohort.Biomass;
     return total;
 }
开发者ID:LANDIS-II-Foundation,项目名称:Libraries,代码行数:8,代码来源:Util.cs


示例10: AllExceptYoungest

        //---------------------------------------------------------------------

        /// <summary>
        /// Selects all of a species' cohorts for harvesting except the
        /// youngest.
        /// </summary>
        public static void AllExceptYoungest(ISpeciesCohorts         cohorts,
                                             ISpeciesCohortBoolArray isHarvested)
        {
            //  Youngest is last.
            int youngestIndex = isHarvested.Count - 1;
            for (int i = 0; i < youngestIndex; i++)
                isHarvested[i] = true;
        }
开发者ID:pjbitterman,项目名称:Extensions-Disturbance,代码行数:14,代码来源:SelectCohorts.cs


示例11: GetMaxAge

		/// <summary>
		/// Gets the maximum age among a species' cohorts.
		/// </summary>
		/// <returns>
		/// The age of the oldest cohort or 0 if there are no cohorts.
		/// </returns>
		public static ushort GetMaxAge(ISpeciesCohorts<ICohort> cohorts)
		{
			if (cohorts == null)
				return 0;
			ushort max = 0;
			foreach (ushort age in cohorts.Ages)
				if (age > max)
					max = age;
			return max;
		}
开发者ID:LANDIS-II-Foundation,项目名称:Libraries,代码行数:16,代码来源:Util.cs


示例12: SelectCohorts

 //---------------------------------------------------------------------
 /// <summary>
 /// Selects which of a species' cohorts are harvested.
 /// </summary>
 public void SelectCohorts(ISpeciesCohorts         cohorts,
     ISpeciesCohortBoolArray isHarvested)
 {
     int i = 0;
     foreach (ICohort cohort in cohorts) {
         AgeRange? notUsed;
         if (agesAndRanges.Contains(cohort.Age, out notUsed))
             isHarvested[i] = true;
         i++;
     }
 }
开发者ID:LANDIS-II-Foundation,项目名称:Library-Site-Harvest,代码行数:15,代码来源:SpecificAgesCohortSelector.cs


示例13: SpeciesCohorts

        //---------------------------------------------------------------------

        /// <summary>
        /// Initializes a new instance by copying a set of species cohorts.
        /// </summary>
        public SpeciesCohorts(ISpeciesCohorts cohorts)
        {
            this.species = cohorts.Species;
            this.ages = new List<ushort>(cohorts.Count);
            this.isMaturePresent = false;
            foreach (ICohort cohort in cohorts) {
                ushort age = cohort.Age;
                this.ages.Add(age);
                if (age >= species.Maturity)
                    this.isMaturePresent = true;
            }
        }
开发者ID:LANDIS-II-Foundation,项目名称:Libraries,代码行数:17,代码来源:SpeciesCohorts.cs


示例14: GetMaxAge

 /// <summary>
 /// Gets the maximum age among a species' cohorts.
 /// </summary>
 /// <returns>
 /// The age of the oldest cohort or 0 if there are no cohorts.
 /// </returns>
 public static ushort GetMaxAge(ISpeciesCohorts cohorts)
 {
     if (cohorts == null)
         return 0;
     ushort max = 0;
     foreach (ICohort cohort in cohorts) {
         //  First cohort is the oldest
         max = cohort.Age;
         break;
     }
     return max;
 }
开发者ID:LANDIS-II-Foundation,项目名称:Libraries,代码行数:18,代码来源:Util.cs


示例15: SelectCohorts

        //---------------------------------------------------------------------

        /// <summary>
        /// Selects which of a species' cohorts are harvested.
        /// </summary>
        public void SelectCohorts(ISpeciesCohorts         cohorts,
                                  ISpeciesCohortBoolArray isHarvested)
        {
            int i = 0;
            foreach (ICohort cohort in cohorts) {
                if (ages.Contains(cohort.Age))
                    isHarvested[i] = true;
                else {
                    foreach (AgeRange range in ranges) {
                        if (range.Contains(cohort.Age)) {
                            isHarvested[i] = true;
                            break;
                        }
                    }
                }
                i++;
            }
        }
开发者ID:LANDIS-II-Foundation,项目名称:Extensions-Disturbance,代码行数:23,代码来源:SpecificAgesCohortSelector.cs


示例16: GetStdDevAge

 public static ushort GetStdDevAge(ISpeciesCohorts speciesCohorts)
 {
     if (speciesCohorts == null)
         return 0;
     ushort std_dev = (ushort)System.Math.Round(System.Math.Sqrt(GetVarAge(speciesCohorts)),0);
     return std_dev;
 }
开发者ID:LANDIS-II-Foundation,项目名称:Extensions-Output,代码行数:7,代码来源:Utils.cs


示例17: GetMinAge

 public static ushort GetMinAge(ISpeciesCohorts speciesCohorts)
 {
     if (speciesCohorts == null)
         return 0;
     ushort min = 65535;//maxof ushort
     foreach (ICohort cohort in speciesCohorts)
     {
         if(cohort.Age<min)
             min = cohort.Age;
     }
     return min;
 }
开发者ID:LANDIS-II-Foundation,项目名称:Extensions-Output,代码行数:12,代码来源:Utils.cs


示例18: GetMedianAge

        public static ushort GetMedianAge(ISpeciesCohorts speciesCohorts)
        {
            if (speciesCohorts == null)
                return 0;
            ushort median = 0;
            double dbl_median = 0.0;

            List<ushort> cohort_ages = new List<ushort>();
            foreach (ICohort cohort in speciesCohorts)
            {
                cohort_ages.Add(cohort.Age);
            }
            int count = cohort_ages.Count;
            if (count == 0)
            {
                return 0;
            }

            else if (count == 1)
            {
                return cohort_ages[0];
            }

            cohort_ages.Sort();//sorts in ascending order

            if (count % 2 == 0)
            {
                dbl_median = (cohort_ages[count / 2] + cohort_ages[(count / 2) - 1]) / 2.0;
                median = (ushort)dbl_median;
            }
            else
            {
                median = cohort_ages[count / 2];
            }
            return median;
        }
开发者ID:LANDIS-II-Foundation,项目名称:Extensions-Output,代码行数:36,代码来源:Utils.cs


示例19: GetAvgAge

        public static ushort GetAvgAge(ISpeciesCohorts speciesCohorts)
        {
            if (speciesCohorts == null)
                return 0;
            ushort avg = 0;
            uint sum = 0;
            ushort count = 0;

            foreach (ICohort cohort in speciesCohorts)
            {
                sum += cohort.Age;
                count++;
            }

            if (count == 0)
            {
                return 0;
            }

            avg = (ushort)(sum / count);
            return avg;
        }
开发者ID:LANDIS-II-Foundation,项目名称:Extensions-Output,代码行数:22,代码来源:Utils.cs


示例20: Harvest

        //---------------------------------------------------------------------

    	/// <summary>
    	/// Selects which of a species' cohorts are harvested.
    	/// </summary>
    	public void Harvest(ISpeciesCohorts         cohorts,
                            ISpeciesCohortBoolArray isHarvested)
    	{
    	    for (int i = 0; i < isHarvested.Count; i++)
    	        isHarvested[i] = true;
    	}
开发者ID:pjbitterman,项目名称:Extensions-Disturbance,代码行数:11,代码来源:Clearcut.cs



注:本文中的ISpeciesCohorts类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ISpecification类代码示例发布时间:2022-05-24
下一篇:
C# ISpeciesCohortBoolArray类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap