dotgnu-pnet-commits
[Top][All Lists]
Advanced

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

[Dotgnu-pnet-commits] CVS: pnetlib/Generics DictionaryAdapter.cs,1.2,1.3


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnetlib/Generics DictionaryAdapter.cs,1.2,1.3 DictionaryWrapper.cs,1.2,1.3 Hashtable.cs,1.2,1.3 IDictionary.cs,1.2,1.3 IDictionaryIterator.cs,1.1,1.2 SynchronizedDictIterator.cs,1.1,1.2
Date: Mon, 24 Feb 2003 00:20:36 -0500

Update of /cvsroot/dotgnu-pnet/pnetlib/Generics
In directory subversions:/tmp/cvs-serv1916/Generics

Modified Files:
        DictionaryAdapter.cs DictionaryWrapper.cs Hashtable.cs 
        IDictionary.cs IDictionaryIterator.cs 
        SynchronizedDictIterator.cs 
Log Message:


Fix the inheritance of dictionaries so that they are collections
of entries, not values.


Index: DictionaryAdapter.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Generics/DictionaryAdapter.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** DictionaryAdapter.cs        24 Feb 2003 04:36:26 -0000      1.2
--- DictionaryAdapter.cs        24 Feb 2003 05:20:34 -0000      1.3
***************
*** 189,193 ****
                                while(iterator.MoveNext())
                                {
!                                       array.SetValue(iterator.Value, index++);
                                }
                        }
--- 189,193 ----
                                while(iterator.MoveNext())
                                {
!                                       array.SetValue(iterator.Current, 
index++);
                                }
                        }
***************
*** 215,223 ****
  
        // Implement the non-generic IEnumerable interface.
!       public System.Collections.IEnumerator
                                System.Collections.IEnumerable.GetEnumerator()
                        {
!                               return new EnumeratorAdapter<ValueT>
!                                       
(((ICollection<ValueT>)dict).GetIterator());
                        }
  
--- 215,223 ----
  
        // Implement the non-generic IEnumerable interface.
!       System.Collections.IEnumerator
                                System.Collections.IEnumerable.GetEnumerator()
                        {
!                               return new EnumeratorAdapter< 
DictionaryEntry<KeyT, ValueT> >
!                                       (dict.GetIterator());
                        }
  

Index: DictionaryWrapper.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Generics/DictionaryWrapper.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** DictionaryWrapper.cs        24 Feb 2003 04:36:26 -0000      1.2
--- DictionaryWrapper.cs        24 Feb 2003 05:20:34 -0000      1.3
***************
*** 105,110 ****
                        }
  
!       // Implement the ICollection<ValueT> interface.
!       public void CopyTo(ValueT[] array, int index)
                        {
                                dict.CopyTo(array, index);
--- 105,110 ----
                        }
  
!       // Implement the ICollection<DictionaryEntry<KeyT, ValueT>> interface.
!       public void CopyTo(DictionaryEntry<KeyT, ValueT>[] array, int index)
                        {
                                dict.CopyTo(array, index);
***************
*** 132,140 ****
                        }
  
!       // Implement the IIterable<ValueT> interface.
!       public IIterator<ValueT> IIterable<ValueT>.GetEnumerator()
                        {
!                               return new EnumeratorWrapper
!                                       
(((IIterable<ValueT>)dict).GetIterator());
                        }
  
--- 132,141 ----
                        }
  
!       // Implement the IIterable<DictionaryEntry<KeyT, ValueT>> interface.
!       IIterator< DictionaryEntry<KeyT, ValueT> >
!                               IIterable< DictionaryEntry<KeyT, ValueT> 
>.GetIterator()
                        {
!                               return new EnumeratorWrapper< 
DictionaryEntry<KeyT, ValueT> >
!                                       (dict.GetEnumerator());
                        }
  

Index: Hashtable.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Generics/Hashtable.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** Hashtable.cs        24 Feb 2003 04:36:26 -0000      1.2
--- Hashtable.cs        24 Feb 2003 05:20:34 -0000      1.3
***************
*** 28,33 ****
  using System;
  
! public class Hashtable<KeyT, ValueT>
!       : IDictionary<KeyT, ValueT>, ICollection<ValueT>, ICloneable
  {
        // Contents of a hash bucket.
--- 28,32 ----
  using System;
  
! public class Hashtable<KeyT, ValueT> : IDictionary<KeyT, ValueT>, ICloneable
  {
        // Contents of a hash bucket.
***************
*** 497,502 ****
                        }
  
!       // Implement the ICollection<ValueT> interface.
!       public virtual void CopyTo(ValueT[] array, int index)
                        {
                                if(array == null)
--- 496,502 ----
                        }
  
!       // Implement the ICollection< DictionaryEntry<KeyT, ValueT> > interface.
!       public virtual void CopyTo
!                               (DictionaryEntry<KeyT, ValueT>[] array, int 
index)
                        {
                                if(array == null)
***************
*** 515,525 ****
                                else
                                {
!                                       int posn;
!                                       for(posn = 0; posn < num; ++posn)
                                        {
!                                               if(table[posn].key != null)
!                                               {
!                                                       
array.SetValue(table[posn].value, index++);
!                                               }
                                        }
                                }
--- 515,523 ----
                                else
                                {
!                                       IDictionaryIterator<KeyT, ValueT> 
iterator;
!                                       iterator = GetIterator();
!                                       while(iterator.MoveNext())
                                        {
!                                               array[index++] = iterator.Entry;
                                        }
                                }
***************
*** 753,760 ****
                        }
  
!       // Implement the IIterable<ValueT> interface.
!       IIterator IIterable<ValueT>.GetIterator()
                        {
!                               return new HashtableIterator<KeyT, 
ValueT>(this);
                        }
  
--- 751,758 ----
                        }
  
!       // Implement the IIterable< DictionaryEntry<KeyT, ValueT> > interface.
!       IIterator IIterable< DictionaryEntry<KeyT, ValueT> >.GetIterator()
                        {
!                               return GetIterator();
                        }
  
***************
*** 904,908 ****
  
                // Implement the ICollection interface.
!               public override void CopyTo(ValueT[] array, int index)
                                {
                                        lock(SyncRoot)
--- 902,907 ----
  
                // Implement the ICollection interface.
!               public override void CopyTo
!                                       (DictionaryEntry<KeyT, ValueT>[] array, 
int index)
                                {
                                        lock(SyncRoot)
***************
*** 1031,1045 ****
                                }
        
-               // Implement the IIterable<ValueT> interface.
-               IIterator IIterable<ValueT>.GetIterator()
-                               {
-                                       lock(SyncRoot)
-                                       {
-                                               return new 
SynchronizedIterator<ValueT>
-                                                       (SyncRoot, 
((IIterable<ValueT>)table)
-                                                                               
        .GetIterator());
-                                       }
-                               }
- 
                // Determine if this hash table contains a specific key.
                public override bool ContainsKey(KeyT key)
--- 1030,1033 ----
***************
*** 1147,1155 ****
                                        --(table.num);
                                }
!               public ValueT Current
                                {
                                        get
                                        {
!                                               return Value;
                                        }
                                }
--- 1135,1143 ----
                                        --(table.num);
                                }
!               public DictionaryEntry<KeyT, ValueT> Current
                                {
                                        get
                                        {
!                                               return Entry;
                                        }
                                }

Index: IDictionary.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Generics/IDictionary.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** IDictionary.cs      24 Feb 2003 04:36:26 -0000      1.2
--- IDictionary.cs      24 Feb 2003 05:20:34 -0000      1.3
***************
*** 28,32 ****
  using System;
  
! public interface IDictionary<KeyT, ValueT> : ICollection<ValueT>
  {
  
--- 28,33 ----
  using System;
  
! public interface IDictionary<KeyT, ValueT>
!       : ICollection< DictionaryEntry<KeyT, ValueT> >
  {
  

Index: IDictionaryIterator.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Generics/IDictionaryIterator.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** IDictionaryIterator.cs      24 Feb 2003 04:36:26 -0000      1.1
--- IDictionaryIterator.cs      24 Feb 2003 05:20:34 -0000      1.2
***************
*** 28,32 ****
  using System;
  
! public interface IDictionaryIterator<KeyT, ValueT> : IIterator<ValueT>
  {
  
--- 28,33 ----
  using System;
  
! public interface IDictionaryIterator<KeyT, ValueT>
!       : IIterator< DictionaryEntry<KeyT, ValueT> >
  {
  

Index: SynchronizedDictIterator.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Generics/SynchronizedDictIterator.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** SynchronizedDictIterator.cs 24 Feb 2003 04:36:26 -0000      1.1
--- SynchronizedDictIterator.cs 24 Feb 2003 05:20:34 -0000      1.2
***************
*** 61,65 ****
                                }
                        }
!       ValueT IIterator<ValueT>.Current
                        {
                                get
--- 61,65 ----
                                }
                        }
!       public DictionaryEntry<KeyT, ValueT> Current
                        {
                                get
***************
*** 67,71 ****
                                        lock(syncRoot)
                                        {
!                                               return 
((IIterator<ValueT>)iterator).Current;
                                        }
                                }
--- 67,71 ----
                                        lock(syncRoot)
                                        {
!                                               return iterator.Current;
                                        }
                                }





reply via email to

[Prev in Thread] Current Thread [Next in Thread]