# HG changeset patch # User IBBoard # Date 1256673537 0 # Node ID 0e64a120785fc8bb1f6d5477e8726b6aa5d01bd4 # Parent c6ed77f263a63d2e9bd16464d4a2991712b5dc5b Re #24: Create Limit objects * Add "Percentage" property to IPercentageLimit limits so that we can get the percentage without making the protected Limit property public for all limits diff -r c6ed77f263a6 -r 0e64a120785f Limits/IPercentageLimit.cs --- a/Limits/IPercentageLimit.cs Sat Oct 24 19:49:47 2009 +0000 +++ b/Limits/IPercentageLimit.cs Tue Oct 27 19:58:57 2009 +0000 @@ -11,5 +11,6 @@ /// public interface IPercentageLimit : ILimit { + double Percentage { get; } } } diff -r c6ed77f263a6 -r 0e64a120785f Limits/SimpleRoundedPercentageLimit.cs --- a/Limits/SimpleRoundedPercentageLimit.cs Sat Oct 24 19:49:47 2009 +0000 +++ b/Limits/SimpleRoundedPercentageLimit.cs Tue Oct 27 19:58:57 2009 +0000 @@ -14,11 +14,24 @@ { private bool roundUp; + public SimpleRoundedPercentageLimit (double percentageLimit) : this(percentageLimit, true) + { + } + public SimpleRoundedPercentageLimit (double percentageLimit, bool roundFractionUp) : base(percentageLimit) { roundUp = roundFractionUp; } + public double Percentage + { + get + { + return Limit; + } + } + + /// /// Gets the limited number, based on the percentage limit that this Limit represents and the rounding direction ///