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 FixedSizeCollection.cs,1.1,1


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnetlib/Generics FixedSizeCollection.cs,1.1,1.2 FixedSizeDictionary.cs,1.1,1.2 FixedSizeList.cs,1.1,1.2 ReadOnlyCollection.cs,1.2,1.3 ReadOnlyDictionary.cs,1.2,1.3 ReadOnlyList.cs,1.2,1.3 FixedSizeDictIterator.cs,1.1,NONE FixedSizeIterator.cs,1.1,NONE FixedSizeListIterator.cs,1.1,NONE ReadOnlyDictIterator.cs,1.2,NONE ReadOnlyIterator.cs,1.3,NONE ReadOnlyListIterator.cs,1.2,NONE
Date: Mon, 24 Feb 2003 02:56:32 -0500

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

Modified Files:
        FixedSizeCollection.cs FixedSizeDictionary.cs FixedSizeList.cs 
        ReadOnlyCollection.cs ReadOnlyDictionary.cs ReadOnlyList.cs 
Removed Files:
        FixedSizeDictIterator.cs FixedSizeIterator.cs 
        FixedSizeListIterator.cs ReadOnlyDictIterator.cs 
        ReadOnlyIterator.cs ReadOnlyListIterator.cs 
Log Message:


Move the fixed-size and read-only iterator wrappers inside
their respective collection classes and make them nested,
because they are only used from those collection classes.


Index: FixedSizeCollection.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Generics/FixedSizeCollection.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** FixedSizeCollection.cs      24 Feb 2003 07:21:00 -0000      1.1
--- FixedSizeCollection.cs      24 Feb 2003 07:56:27 -0000      1.2
***************
*** 91,94 ****
--- 91,130 ----
                        }
  
+       // Fixed-size collection iterator.
+       private sealed class FixedSizeIterator<T> : IIterator<T>
+       {
+               // Internal state.
+               protected IIterator<T> iterator;
+ 
+               // Constructor.
+               public FixedSizeIterator(IIterator<T> iterator)
+                               {
+                                       this.iterator = iterator;
+                               }
+ 
+               // Implement the IIterator<T> interface.
+               public bool MoveNext()
+                               {
+                                       return iterator.MoveNext();
+                               }
+               public void Reset()
+                               {
+                                       iterator.Reset();
+                               }
+               public void Remove()
+                               {
+                                       throw new InvalidOperationException
+                                               
(S._("NotSupp_FixedSizeCollection"));
+                               }
+               public T Current
+                               {
+                                       get
+                                       {
+                                               return iterator.Current;
+                                       }
+                               }
+ 
+       }; // class FixedSizeIterator<T>
+ 
  }; // class FixedSizeCollection<T>
  

Index: FixedSizeDictionary.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Generics/FixedSizeDictionary.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** FixedSizeDictionary.cs      24 Feb 2003 07:21:00 -0000      1.1
--- FixedSizeDictionary.cs      24 Feb 2003 07:56:27 -0000      1.2
***************
*** 121,124 ****
--- 121,188 ----
                        }
  
+       // Fixed-size dictionary iterator.
+       private sealed class FixedSizeDictIterator<KeyT, ValueT>
+               : IDictionaryIterator<KeyT, ValueT>
+       {
+               // Internal state.
+               protected IDictionaryIterator<KeyT, ValueT> iterator;
+ 
+               // Constructor.
+               public FixedSizeDictIterator(IDictionaryIterator<KeyT, ValueT> 
iterator)
+                               {
+                                       this.iterator = iterator;
+                               }
+ 
+               // Implement the IIterator<DictionaryEntry<KeyT, ValueT>> 
interface.
+               public bool MoveNext()
+                               {
+                                       return iterator.MoveNext();
+                               }
+               public void Reset()
+                               {
+                                       iterator.Reset();
+                               }
+               public void Remove()
+                               {
+                                       throw new InvalidOperationException
+                                               
(S._("NotSupp_FixedSizeCollection"));
+                               }
+               public DictionaryEntry<KeyT, ValueT> Current
+                               {
+                                       get
+                                       {
+                                               return iterator.Current;
+                                       }
+                               }
+ 
+               // Implement the IDictionaryIterator<KeyT, ValueT> interface.
+               public DictionaryEntry<KeyT, ValueT> Entry
+                               {
+                                       get
+                                       {
+                                               return iterator.Entry;
+                                       }
+                               }
+               public KeyT Key
+                               {
+                                       get
+                                       {
+                                               return iterator.Key;
+                                       }
+                               }
+               public ValueT Value
+                               {
+                                       get
+                                       {
+                                               return iterator.Value;
+                                       }
+                                       set
+                                       {
+                                               iterator.Value = value;
+                                       }
+                               }
+ 
+       }; // class FixedSizeDictIterator<KeyT, ValueT>
+ 
  }; // class FixedSizeDictionary<KeyT, ValueT>
  

Index: FixedSizeList.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Generics/FixedSizeList.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** FixedSizeList.cs    24 Feb 2003 07:21:00 -0000      1.1
--- FixedSizeList.cs    24 Feb 2003 07:56:27 -0000      1.2
***************
*** 118,121 ****
--- 118,181 ----
                        }
  
+       // Fixed-size list iterator.
+       private sealed class FixedSizeListIterator<T> : IListIterator<T>
+       {
+               // Internal state.
+               protected IListIterator<T> iterator;
+ 
+               // Constructor.
+               public FixedSizeListIterator(IListIterator<T> iterator)
+                               {
+                                       this.iterator = iterator;
+                               }
+ 
+               // Implement the IIterator<T> interface.
+               public bool MoveNext()
+                               {
+                                       return iterator.MoveNext();
+                               }
+               public void Reset()
+                               {
+                                       iterator.Reset();
+                               }
+               public void Remove()
+                               {
+                                       throw new InvalidOperationException
+                                               
(S._("NotSupp_FixedSizeCollection"));
+                               }
+               T IIterator<T>.Current
+                               {
+                                       get
+                                       {
+                                               return 
((IIterator<T>)iterator).Current;
+                                       }
+                               }
+ 
+               // Implement the IListIterator<T> interface.
+               public bool MovePrev()
+                               {
+                                       return iterator.MovePrev();
+                               }
+               public int Position
+                               {
+                                       get
+                                       {
+                                               return iterator.Position;
+                                       }
+                               }
+               public T Current
+                               {
+                                       get
+                                       {
+                                               return iterator.Current;
+                                       }
+                                       set
+                                       {
+                                               iterator.Current = value;
+                                       }
+                               }
+ 
+       }; // class FixedSizeListIterator<T>
+ 
  }; // class FixedSizeList<T>
  

Index: ReadOnlyCollection.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Generics/ReadOnlyCollection.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** ReadOnlyCollection.cs       24 Feb 2003 07:21:00 -0000      1.2
--- ReadOnlyCollection.cs       24 Feb 2003 07:56:27 -0000      1.3
***************
*** 91,94 ****
--- 91,130 ----
                        }
  
+       // Iterator class for read-only collections.
+       private sealed class ReadOnlyIterator<T> : IIterator<T>
+       {
+               // Internal state.
+               protected IIterator<T> iterator;
+ 
+               // Constructor.
+               public ReadOnlyIterator(IIterator<T> iterator)
+                               {
+                                       this.iterator = iterator;
+                               }
+ 
+               // Implement the IIterator<T> interface.
+               public bool MoveNext()
+                               {
+                                       return iterator.MoveNext();
+                               }
+               public void Reset()
+                               {
+                                       iterator.Reset();
+                               }
+               public void Remove()
+                               {
+                                       throw new InvalidOperationException
+                                               (S._("NotSupp_ReadOnly"));
+                               }
+               public T Current
+                               {
+                                       get
+                                       {
+                                               return iterator.Current;
+                                       }
+                               }
+ 
+       }; // class ReadOnlyIterator<T>
+ 
  }; // class ReadOnlyCollection<T>
  

Index: ReadOnlyDictionary.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Generics/ReadOnlyDictionary.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** ReadOnlyDictionary.cs       24 Feb 2003 07:21:00 -0000      1.2
--- ReadOnlyDictionary.cs       24 Feb 2003 07:56:27 -0000      1.3
***************
*** 119,122 ****
--- 119,187 ----
                        }
  
+       // Read-only iterator class for dicionaries.
+       private sealed class ReadOnlyDictIterator<KeyT, ValueT>
+               : IDictionaryIterator<KeyT, ValueT>
+       {
+               // Internal state.
+               protected IDictionaryIterator<KeyT, ValueT> iterator;
+ 
+               // Constructor.
+               public ReadOnlyDictIterator(IDictionaryIterator<KeyT, ValueT> 
iterator)
+                               {
+                                       this.iterator = iterator;
+                               }
+ 
+               // Implement the IIterator<DictionaryEntry<KeyT, ValueT>> 
interface.
+               public bool MoveNext()
+                               {
+                                       return iterator.MoveNext();
+                               }
+               public void Reset()
+                               {
+                                       iterator.Reset();
+                               }
+               public void Remove()
+                               {
+                                       throw new InvalidOperationException
+                                               (S._("NotSupp_ReadOnly"));
+                               }
+               public DictionaryEntry<KeyT, ValueT> Current
+                               {
+                                       get
+                                       {
+                                               return iterator.Current;
+                                       }
+                               }
+ 
+               // Implement the IDictionaryIterator<KeyT, ValueT> interface.
+               public DictionaryEntry<KeyT, ValueT> Entry
+                               {
+                                       get
+                                       {
+                                               return iterator.Entry;
+                                       }
+                               }
+               public KeyT Key
+                               {
+                                       get
+                                       {
+                                               return iterator.Key;
+                                       }
+                               }
+               public ValueT Value
+                               {
+                                       get
+                                       {
+                                               return iterator.Value;
+                                       }
+                                       set
+                                       {
+                                               throw new 
InvalidOperationException
+                                                       
(S._("NotSupp_ReadOnly"));
+                                       }
+                               }
+ 
+       }; // class ReadOnlyDictIterator<KeyT, ValueT>
+ 
  }; // class ReadOnlyDictionary<KeyT, ValueT>
  

Index: ReadOnlyList.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Generics/ReadOnlyList.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** ReadOnlyList.cs     24 Feb 2003 07:21:00 -0000      1.2
--- ReadOnlyList.cs     24 Feb 2003 07:56:27 -0000      1.3
***************
*** 114,117 ****
--- 114,178 ----
                        }
  
+       // Read-only list iterator class.
+       private sealed class ReadOnlyListIterator<T> : IListIterator<T>
+       {
+               // Internal state.
+               protected IListIterator<T> iterator;
+ 
+               // Constructor.
+               public ReadOnlyListIterator(IListIterator<T> iterator)
+                               {
+                                       this.iterator = iterator;
+                               }
+ 
+               // Implement the IIterator<T> interface.
+               public bool MoveNext()
+                               {
+                                       return iterator.MoveNext();
+                               }
+               public void Reset()
+                               {
+                                       iterator.Reset();
+                               }
+               public void Remove()
+                               {
+                                       throw new InvalidOperationException
+                                               (S._("NotSupp_ReadOnly"));
+                               }
+               T IIterator<T>.Current
+                               {
+                                       get
+                                       {
+                                               return 
((IIterator<T>)iterator).Current;
+                                       }
+                               }
+ 
+               // Implement the IListIterator<T> interface.
+               public bool MovePrev()
+                               {
+                                       return iterator.MovePrev();
+                               }
+               public int Position
+                               {
+                                       get
+                                       {
+                                               return iterator.Position;
+                                       }
+                               }
+               public T Current
+                               {
+                                       get
+                                       {
+                                               return iterator.Current;
+                                       }
+                                       set
+                                       {
+                                               throw new 
InvalidOperationException
+                                                       
(S._("NotSupp_ReadOnly"));
+                                       }
+                               }
+ 
+       }; // class ReadOnlyListIterator<T>
+ 
  }; // class ReadOnlyList<T>
  

--- FixedSizeDictIterator.cs DELETED ---

--- FixedSizeIterator.cs DELETED ---

--- FixedSizeListIterator.cs DELETED ---

--- ReadOnlyDictIterator.cs DELETED ---

--- ReadOnlyIterator.cs DELETED ---

--- ReadOnlyListIterator.cs DELETED ---





reply via email to

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