[longomatch/redesign2: 72/140] Make the DrawingsList inherit from SortedList



commit c941e08c59c5c3303d5bf01546426354d1078a9b
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Sun Feb 6 02:06:53 2011 +0100

    Make the DrawingsList inherit from SortedList

 LongoMatch/Store/DrawingsList.cs |   56 +++++--------------------------------
 LongoMatch/Store/Play.cs         |    2 +-
 2 files changed, 9 insertions(+), 49 deletions(-)
---
diff --git a/LongoMatch/Store/DrawingsList.cs b/LongoMatch/Store/DrawingsList.cs
index 9b8041d..e95a874 100644
--- a/LongoMatch/Store/DrawingsList.cs
+++ b/LongoMatch/Store/DrawingsList.cs
@@ -23,15 +23,10 @@ namespace LongoMatch.Store
 {
 
 
-	public class DrawingsList
+	public class DrawingsList: SortedList<int, Drawing>
 	{
 
-		private SortedList<int,Drawing> drawingsList;
-
-		public DrawingsList()
-		{
-			drawingsList = new SortedList<int,Drawing>();
-		}
+		public DrawingsList() {}
 		
 		/// <summary>
 		/// Adds a new drawing to the list
@@ -44,12 +39,13 @@ namespace LongoMatch.Store
 		/// </returns>
 		public bool Add(Drawing drawing) {
 			int renderTime = drawing.RenderTime;
-			if (!drawingsList.ContainsKey(renderTime)) {
-				drawingsList.Add(renderTime,drawing);
+			if (!ContainsKey(renderTime)) {
+				base.Add(renderTime,drawing);
 				return true;
 			}
 			else return false;
 		}
+		
 
 		/// <summary>
 		/// Removes a drawing from the list
@@ -61,33 +57,7 @@ namespace LongoMatch.Store
 		/// A <see cref="System.Boolean"/>: true if was removed correctly
 		/// </returns>
 		public bool Remove(Drawing drawing) {
-			int renderTime = drawing.RenderTime;
-			return drawingsList.Remove(renderTime);
-		}
-
-		/// <summary>
-		/// Clear the drawing list
-		/// </summary>
-		public void Clear() {
-			drawingsList.Clear();
-		}
-
-		/// <summary>
-		/// The count of drawings
-		/// </summary>
-		public int Count {
-			get {
-				return drawingsList.Count;
-			}
-		}
-
-		/// <summary>
-		/// A list with all the render times
-		/// </summary>
-		public IList<int> RenderTime {
-			get {
-				return drawingsList.Keys;
-			}
+			return base.Remove(drawing.RenderTime);
 		}
 
 		/// <summary>
@@ -100,7 +70,7 @@ namespace LongoMatch.Store
 		/// A <see cref="System.Int32"/> with the render time
 		/// </returns>
 		public int GetRenderTime(int index) {
-			return drawingsList.Keys[index];
+			return Keys[index];
 		}
 
 		/// <summary>
@@ -113,17 +83,7 @@ namespace LongoMatch.Store
 		/// A <see cref="Drawing"/> with the render time
 		/// </returns>
 		public Drawing GetRenderDrawing(int index) {
-			return drawingsList.Values[index];
+			return Values[index];
 		}
-
-		/// <summary>
-		/// A list with all the drawings ordered by render time
-		/// </summary>
-		public SortedList<int,Drawing> List {
-			get{
-				return drawingsList;
-			}
-		}
-
 	}
 }
diff --git a/LongoMatch/Store/Play.cs b/LongoMatch/Store/Play.cs
index 5760cca..1b41a2f 100644
--- a/LongoMatch/Store/Play.cs
+++ b/LongoMatch/Store/Play.cs
@@ -103,7 +103,7 @@ namespace LongoMatch.Store
 		public Drawing KeyFrameDrawing {
 			get{
 				if (Drawings.Count > 0)
-					return Drawings.List[0];
+					return Drawings[0];
 				else
 					return null;
 			}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]