changeset 60:0e64a120785f

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
author IBBoard <dev@ibboard.co.uk>
date Tue, 27 Oct 2009 19:58:57 +0000
parents c6ed77f263a6
children 972cc51adeeb
files Limits/IPercentageLimit.cs Limits/SimpleRoundedPercentageLimit.cs
diffstat 2 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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 @@
 	/// </summary>
 	public interface IPercentageLimit : ILimit
 	{
+		double Percentage { get; }
 	}
 }
--- 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;
+			}
+		}
+
+		
 		/// <summary>
 		/// Gets the limited number, based on the percentage limit that this <code>Limit</code> represents and the rounding direction
 		/// </summary>