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

C# Util.Percentage类代码示例

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

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



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

示例1: DoubleCtor

 public void DoubleCtor()
 {
     Percentage percentage = new Percentage(0.567);
     Assert.AreEqual(0.567, percentage.Value);
     Assert.AreEqual(0.567, (double) percentage);
     Assert.AreEqual("56.7%", percentage.ToString());
 }
开发者ID:LANDIS-II-Foundation,项目名称:Core-Utilities-Library,代码行数:7,代码来源:Percentage_Test.cs


示例2: AgeOrRangeWasRead

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

        public static void AgeOrRangeWasRead(AgeRange ageRange,
                                             Percentage percentage)
        {
            ageOrRangeWasRead = true;
            //  Have we started reading ages and ranges for another species?
            //  If so, then first clear the old values from the previous
            //  species.
            if (ageSelectors[HarvestSpeciesDataset.MostRecentlyFetchedSpecies.Index] == null)
            {
                ages.Clear();
                ranges.Clear();
                percentages.Clear();
            }
            if (ageRange.Start == ageRange.End)
                ages.Add(ageRange.Start);
            else
                ranges.Add(ageRange);
            if (percentage != null)
                percentages[ageRange.Start] = percentage;

            if (HarvestSpeciesDataset.MostRecentlyFetchedSpecies != null)
                ageSelectors[HarvestSpeciesDataset.MostRecentlyFetchedSpecies.Index] = new SpecificAgesCohortSelector(ages, ranges, percentages);

            currentSpecies = HarvestSpeciesDataset.MostRecentlyFetchedSpecies;

        }
开发者ID:LANDIS-II-Foundation,项目名称:Extensions-Disturbance,代码行数:28,代码来源:InputParametersParser.cs


示例3: DefaultCtor

 public void DefaultCtor()
 {
     Percentage percentage = new Percentage();
     Assert.AreEqual(0.0, percentage.Value);
     Assert.AreEqual(0.0, (double) percentage);
     Assert.AreEqual("0%", percentage.ToString());
 }
开发者ID:LANDIS-II-Foundation,项目名称:Core-Utilities-Library,代码行数:7,代码来源:Percentage_Test.cs


示例4: AgeOrRangeWasRead

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

        public static void AgeOrRangeWasRead(AgeRange ageRange,
                                             Percentage percentage)
        {
            ageOrRangeWasRead = true;
            //  Have we started reading ages and ranges for another species?
            //  If so, then first clear the old values from the previous
            //  species.
            bool clearOldValues = (HarvestSpeciesDataset.MostRecentlyFetchedSpecies != null) &&
                                  (ageSelectors[HarvestSpeciesDataset.MostRecentlyFetchedSpecies.Index] == null);
            if (clearOldValues)
            {
                ages.Clear();
                ranges.Clear();
                percentages.Clear();
            }
            if (ageRange.Start == ageRange.End)
                ages.Add(ageRange.Start);
            else
                ranges.Add(ageRange);
            if (percentage != null)
                percentages[ageRange.Start] = percentage;

            if (Landis.Extension.BaseHarvest.InputParametersParser.AllSpeciesNameWasRead)
                ageSelectorForAllSpecies = new SpecificAgesCohortSelector(ages, ranges, percentages);
            if (HarvestSpeciesDataset.MostRecentlyFetchedSpecies != null)
                ageSelectors[HarvestSpeciesDataset.MostRecentlyFetchedSpecies.Index] = new SpecificAgesCohortSelector(ages, ranges, percentages);

            currentSpecies = HarvestSpeciesDataset.MostRecentlyFetchedSpecies;

        }
开发者ID:pjbitterman,项目名称:Extensions-Disturbance,代码行数:32,代码来源:InputParametersParser.cs


示例5: Percentage

        //---------------------------------------------------------------------
        static Percentage()
        {
            Util.Type.SetDescription<Percentage>("percentage");
            InputValues.Register<Percentage>(Percentage.Parse);

             MinValue = new Percentage(MinValueAsDouble);
             MaxValue = new Percentage(MaxValueAsDouble);
        }
开发者ID:LANDIS-II-Foundation,项目名称:Core-Utilities-Library,代码行数:9,代码来源:Percentage.cs


示例6: AgeOrRangeWasRead

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

        public void AgeOrRangeWasRead(AgeRange   ageRange,
                                      Percentage percentage)
        {
            Assert.AreEqual(expectedRange, ageRange);
            if (expectedPercentage == null)
                Assert.IsNull(percentage);
            else
                Assert.AreEqual((double) expectedPercentage, (double) percentage);
            eventHandlerCalled = true;
        }
开发者ID:pjbitterman,项目名称:Extensions-Disturbance,代码行数:12,代码来源:PartialThinning_Test.cs


示例7: ReduceInput

        //---------------------------------------------------------------------
        private static float ReduceInput(float     poolInput,
                                          Percentage reductionPercentage,
                                          ActiveSite site)
        {
            float reduction = (poolInput * (float) reductionPercentage);

            SiteVars.SourceSink[site].Carbon        += (double) reduction * 0.47;
            //SiteVars.FireEfflux[site]               += (double) reduction * 0.47;

            return (poolInput - reduction);
        }
开发者ID:LANDIS-II-Foundation,项目名称:Extensions-Succession,代码行数:12,代码来源:Events.cs


示例8: ReadAgeOrRange_RangePercentage

 public void ReadAgeOrRange_RangePercentage()
 {
     StringReader reader = new StringReader("30-75(10%)");
     int index;
     eventHandlerCalled = false;
     expectedRange = new AgeRange(30, 75);
     expectedPercentage = Percentage.Parse("10%");
     InputValue<AgeRange> ageRange = PartialThinning.ReadAgeOrRange(reader, out index);
     Assert.IsTrue(eventHandlerCalled);
     Assert.AreEqual(0, index);
     Assert.AreEqual(-1, reader.Peek());
 }
开发者ID:pjbitterman,项目名称:Extensions-Disturbance,代码行数:12,代码来源:PartialThinning_Test.cs


示例9: ReadAgeOrRange_AgeWhitespacePercentage

 public void ReadAgeOrRange_AgeWhitespacePercentage()
 {
     StringReader reader = new StringReader("66 ( 50% )\t");
     int index;
     eventHandlerCalled = false;
     expectedRange = new AgeRange(66, 66);
     expectedPercentage = Percentage.Parse("50%");
     InputValue<AgeRange> ageRange = PartialThinning.ReadAgeOrRange(reader, out index);
     Assert.IsTrue(eventHandlerCalled);
     Assert.AreEqual(0, index);
     Assert.AreEqual('\t', reader.Peek());
 }
开发者ID:pjbitterman,项目名称:Extensions-Disturbance,代码行数:12,代码来源:PartialThinning_Test.cs


示例10: ReadAgeOrRange_RangeWhitespacePercentage

 public void ReadAgeOrRange_RangeWhitespacePercentage()
 {
     StringReader reader = new StringReader(" 1-100 (22.2%)Hi");
     int index;
     eventHandlerCalled = false;
     expectedRange = new AgeRange(1, 100);
     expectedPercentage = Percentage.Parse("22.2%");
     InputValue<AgeRange> ageRange = PartialThinning.ReadAgeOrRange(reader, out index);
     Assert.IsTrue(eventHandlerCalled);
     Assert.AreEqual(1, index);
     Assert.AreEqual('H', reader.Peek());
 }
开发者ID:pjbitterman,项目名称:Extensions-Disturbance,代码行数:12,代码来源:PartialThinning_Test.cs


示例11: Selects

 //---------------------------------------------------------------------
 /// <summary>
 /// Selects which cohorts are harvested.
 /// </summary>
 /// <returns>
 /// true if the given cohort is to be harvested.  The cohort's biomass
 /// should be reduced by the percentage returned in the second
 /// parameter.
 /// </returns>
 public bool Selects(ICohort cohort, out Percentage percentage)
 {
     ushort ageToLookUp = 0;
         AgeRange? containingRange;
         if (agesAndRanges.Contains(cohort.Age, out containingRange))
         {
             if (! containingRange.HasValue)
                 ageToLookUp = cohort.Age;
             else {
                 ageToLookUp = containingRange.Value.Start;
             }
             if (! percentages.TryGetValue(ageToLookUp, out percentage))
                 percentage = defaultPercentage;
             return true;
         }
         percentage = null;
         return false;
 }
开发者ID:LANDIS-II-Foundation,项目名称:Library-Biomass-Harvest,代码行数:27,代码来源:SpecificAgesCohortSelector.cs


示例12: AppliedPrescription

        //---------------------------------------------------------------------
        public AppliedPrescription(Prescription prescription,
            Percentage   percentageToHarvest,
            int          beginTime,
            int          endTime)
        {
            //set prescription
            this.prescription = prescription;

            //set stand ranking method
            this.standSpreadSiteSelector = prescription.SiteSelectionMethod as StandSpreading;

            //set harvest percentage
            this.percentageToHarvest = percentageToHarvest;

            //set begin time and end time
            this.beginTime = beginTime;
            this.endTime = endTime;
        }
开发者ID:LANDIS-II-Foundation,项目名称:Library-Site-Harvest,代码行数:19,代码来源:AppliedPrescription.cs


示例13: AppliedRepeatHarvest

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

        public AppliedRepeatHarvest(RepeatHarvest  repeatHarvest,
                                    Percentage     percentageToHarvest,
                                    int            beginTime,
                                    int            endTime)
            : base(repeatHarvest,
                   percentageToHarvest,
                   beginTime,
                   endTime)
        {
            this.repeatHarvest = repeatHarvest;
            if (repeatHarvest is SingleRepeatHarvest) {
                isMultipleRepeatHarvest = false;
                setAside = SetAsideForSingleHarvest;
            }
            else {
                isMultipleRepeatHarvest = true;
                setAside = SetAsideForMultipleHarvests;
            }
            this.reservedStands = new Queue<ReservedStand>();
        }
开发者ID:LANDIS-II-Foundation,项目名称:Extensions-Disturbance,代码行数:22,代码来源:AppliedRepeatHarvest.cs


示例14: ReadAgeOrRange_Multiple

        public void ReadAgeOrRange_Multiple()
        {
            StringReader reader = new StringReader(" 1-40 (50%)  50(65%)\t 65-70  71-107 ( 15% )  109");
            int index;                            //0123456789_123456789_^123456789_123456789_12345678

            eventHandlerCalled = false;
            expectedRange = new AgeRange(1, 40);
            expectedPercentage = Percentage.Parse("50%");
            InputValue<AgeRange> ageRange = PartialThinning.ReadAgeOrRange(reader, out index);
            Assert.IsTrue(eventHandlerCalled);
            Assert.AreEqual(1, index);
            Assert.AreEqual(' ', reader.Peek());

            eventHandlerCalled = false;
            expectedRange = new AgeRange(50, 50);
            expectedPercentage = Percentage.Parse("65%");
            ageRange = PartialThinning.ReadAgeOrRange(reader, out index);
            Assert.IsTrue(eventHandlerCalled);
            Assert.AreEqual(13, index);
            Assert.AreEqual('\t', reader.Peek());

            eventHandlerCalled = false;
            expectedRange = new AgeRange(65, 70);
            expectedPercentage = null;
            ageRange = PartialThinning.ReadAgeOrRange(reader, out index);
            Assert.IsTrue(eventHandlerCalled);
            Assert.AreEqual(22, index);
            Assert.AreEqual('7', reader.Peek());

            eventHandlerCalled = false;
            expectedRange = new AgeRange(71, 107);
            expectedPercentage = Percentage.Parse("15%");
            ageRange = PartialThinning.ReadAgeOrRange(reader, out index);
            Assert.IsTrue(eventHandlerCalled);
            Assert.AreEqual(29, index);
            Assert.AreEqual(' ', reader.Peek());

            eventHandlerCalled = false;
            expectedRange = new AgeRange(109, 109);
            expectedPercentage = null;
            ageRange = PartialThinning.ReadAgeOrRange(reader, out index);
            Assert.IsTrue(eventHandlerCalled);
            Assert.AreEqual(45, index);
            Assert.AreEqual(-1, reader.Peek());
        }
开发者ID:pjbitterman,项目名称:Extensions-Disturbance,代码行数:45,代码来源:PartialThinning_Test.cs


示例15: ReduceInput

 //---------------------------------------------------------------------
 private static ushort ReduceInput(ushort     poolInput,
     Percentage reductionPercentage)
 {
     ushort reduction = (ushort) (poolInput * reductionPercentage);
     return (ushort) (poolInput - reduction);
 }
开发者ID:YongLuo007,项目名称:Extensions-Succession,代码行数:7,代码来源:Events.cs


示例16: ValidatePercentage

 //---------------------------------------------------------------------
 private void ValidatePercentage(Percentage percentage)
 {
     if (percentage < 0.0 || percentage > 1.0)
         throw new InputValueException(percentage.ToString(),
                                       "Value must be between 0% and 100%");
 }
开发者ID:LANDIS-II-Foundation,项目名称:Extensions-Succession,代码行数:7,代码来源:PoolPercentages.cs


示例17: ReduceInput

 //---------------------------------------------------------------------
 private static int ReduceInput(int     poolInput,
                                   Percentage reductionPercentage)
 {
     int reduction = (int) (poolInput * reductionPercentage);
     return (int) (poolInput - reduction);
 }
开发者ID:LANDIS-II-Foundation,项目名称:Extensions-Succession,代码行数:7,代码来源:Events.cs


示例18: Check50Percent

 //---------------------------------------------------------------------
 private void Check50Percent(Percentage percentage)
 {
     Assert.AreEqual(0.50, percentage.Value);
     Assert.AreEqual("50%", percentage.ToString());
     Assert.AreEqual("50%", string.Format("{0}", percentage));
     Assert.AreEqual("50%", string.Format("{0:%}", percentage));
     Assert.AreEqual("50.0%", string.Format("{0:#.0%}", percentage));
     Assert.AreEqual(".500", string.Format("{0:#.##0}", percentage));
     Assert.AreEqual(".5", string.Format("{0:#.###}", percentage));
     Assert.AreEqual("0.50", string.Format("{0:0.#0}", percentage));
 }
开发者ID:LANDIS-II-Foundation,项目名称:Core-Utilities-Library,代码行数:12,代码来源:Percentage_Test.cs


示例19: CtorArg_TooBig

 public void CtorArg_TooBig()
 {
     Percentage percentage = new Percentage(double.MaxValue);
 }
开发者ID:LANDIS-II-Foundation,项目名称:Core-Utilities-Library,代码行数:4,代码来源:Percentage_Test.cs


示例20: PoolPercentages

 //---------------------------------------------------------------------
 /// <summary>
 /// Initializes a new instance.
 /// </summary>
 public PoolPercentages(Percentage woody,
                        Percentage nonWoody)
 {
     this.woody = woody;
     this.nonWoody = nonWoody;
 }
开发者ID:LANDIS-II-Foundation,项目名称:Extensions-Succession,代码行数:10,代码来源:PoolPercentages.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Util.StringReader类代码示例发布时间:2022-05-24
下一篇:
C# MetaMetadataNS.MetaMetadataCompositeField类代码示例发布时间: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