当前位置: 首页>>代码示例>>C#>>正文


C# Util.Percentage类代码示例

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


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


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