Bläddra i källkod

Remove FIXME.
* Dictionary.cs (Slot<K,V>): Move to ...
(Dictionary<K,V>.Slot): ... here.

svn path=/trunk/mcs/; revision=43772

Raja R Harinath 21 år sedan
förälder
incheckning
e02fef704d

+ 6 - 0
mcs/class/corlib/System.Collections.Generic/ChangeLog

@@ -1,3 +1,9 @@
+2005-04-29  Raja R Harinath  <[email protected]>
+
+	Remove FIXME.
+	* Dictionary.cs (Slot<K,V>): Move to ...
+	(Dictionary<K,V>.Slot): ... here.
+
 2005-04-28  Martin Baulig  <[email protected]>
 
 	* Dictionary.cs, Queue.cs, Stack.cs, List.cs, Comparer.cs: Don't

+ 10 - 27
mcs/class/corlib/System.Collections.Generic/Dictionary.cs

@@ -40,20 +40,6 @@ using System.Runtime.Serialization;
 
 namespace System.Collections.Generic {
 
-	// FIXME: This should be an unparametrized nested class of Dictionary<K,V>
-	[Serializable]
-	internal class Slot<K, V> {
-		public K Key;
-		public V Value;
-		public Slot<K, V> next;
-		public Slot (K Key, V Value, Slot<K, V> next)
-		{
-			this.Key = Key;
-			this.Value = Value;
-			this.next = next;
-		}
-	}
-
 	[Serializable, CLSCompliant (false)]
 	public class Dictionary<K, V> : IDictionary<K, V>,
 		//ICollection<KeyValuePair<K, V>>,
@@ -67,8 +53,6 @@ namespace System.Collections.Generic {
 		const int INITIAL_SIZE = 10;
 		const float DEFAULT_LOAD_FACTOR = (90f / 100);
 
-#if false
-		// FIXME: compiler bug prevents this from being used.
 		[Serializable]
 		internal class Slot {
 			public K Key;
@@ -81,9 +65,8 @@ namespace System.Collections.Generic {
 				this.next = next;
 			}
 		}
-#endif
 	
-		Slot<K, V> [] _table;
+		Slot [] _table;
 	
 		int _usedSlots;
 		float _loadFactor = DEFAULT_LOAD_FACTOR;
@@ -179,7 +162,7 @@ namespace System.Collections.Generic {
 			if (capacity < 0)
 				throw new ArgumentOutOfRangeException ("capacity");
 			this._hcp = hcp;
-			_table = new Slot<K, V> [capacity];
+			_table = new Slot [capacity];
 			_loadFactor = loadFactor;
 			_threshold = (uint) (capacity * _loadFactor);
 			if (_threshold == 0 && capacity > 0)
@@ -224,14 +207,14 @@ namespace System.Collections.Generic {
 			if (_threshold == 0 && newSize > 0)
 				_threshold = 1;
 		
-			Slot<K, V> nextslot = null;
-			Slot<K, V> [] oldTable = _table;
+			Slot nextslot = null;
+			Slot [] oldTable = _table;
 			
-			_table = new Slot<K, V> [newSize];
+			_table = new Slot [newSize];
 
 			int index;
 			for (int i = 0; i < oldTable.Length; i++) {
-				for (Slot<K, V> slot = oldTable [i]; slot != null; slot = nextslot) {
+				for (Slot slot = oldTable [i]; slot != null; slot = nextslot) {
 					nextslot = slot.next;
 
 					index = DoHash (slot.Key);
@@ -271,7 +254,7 @@ namespace System.Collections.Generic {
 				index = DoHash (key);
 			}
 
-			_table [index] = new Slot<K, V> (key, value, _table [index]);
+			_table [index] = new Slot (key, value, _table [index]);
 			++_usedSlots;
 		}
 	
@@ -340,8 +323,8 @@ namespace System.Collections.Generic {
 			if (key == null)
 				throw new ArgumentNullException ("key");
 			int index = DoHash (key);
-			Slot<K, V> slot = _table [index];
-			Slot<K, V> prev = null;
+			Slot slot = _table [index];
+			Slot prev = null;
 
 			while (slot != null && !slot.Key.Equals (key)) {
 				prev = slot;
@@ -494,7 +477,7 @@ namespace System.Collections.Generic {
 			IDisposable, IDictionaryEnumerator, IEnumerator
 		{
 			Dictionary<K, V> _dictionary;
-			Slot<K, V> _current;
+			Slot _current;
 			int _index;
 			int _validNodeVisited;
 			bool _isValid;