Author: raja
Date: 2005-04-29 02:29:56 -0400 (Fri, 29 Apr 2005)
New Revision: 43772
Modified:
trunk/mcs/class/corlib/System.Collections.Generic/ChangeLog
trunk/mcs/class/corlib/System.Collections.Generic/Dictionary.cs
Log:
Remove FIXME.
* Dictionary.cs (Slot<K,V>): Move to ...
(Dictionary<K,V>.Slot): ... here.
Modified: trunk/mcs/class/corlib/System.Collections.Generic/ChangeLog
===================================================================
--- trunk/mcs/class/corlib/System.Collections.Generic/ChangeLog 2005-04-29
06:23:35 UTC (rev 43771)
+++ trunk/mcs/class/corlib/System.Collections.Generic/ChangeLog 2005-04-29
06:29:56 UTC (rev 43772)
@@ -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
Modified: trunk/mcs/class/corlib/System.Collections.Generic/Dictionary.cs
===================================================================
--- trunk/mcs/class/corlib/System.Collections.Generic/Dictionary.cs
2005-04-29 06:23:35 UTC (rev 43771)
+++ trunk/mcs/class/corlib/System.Collections.Generic/Dictionary.cs
2005-04-29 06:29:56 UTC (rev 43772)
@@ -40,20 +40,6 @@
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 @@
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 @@
this.next = next;
}
}
-#endif
- Slot<K, V> [] _table;
+ Slot [] _table;
int _usedSlots;
float _loadFactor = DEFAULT_LOAD_FACTOR;
@@ -179,7 +162,7 @@
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 @@
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 @@
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 @@
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 @@
IDisposable, IDictionaryEnumerator, IEnumerator
{
Dictionary<K, V> _dictionary;
- Slot<K, V> _current;
+ Slot _current;
int _index;
int _validNodeVisited;
bool _isValid;
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches