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 IDictionaryIterator.cs,NONE


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnetlib/Generics IDictionaryIterator.cs,NONE,1.1 IListIterator.cs,NONE,1.1 ReadOnlyListIterator.cs,NONE,1.1 SynchronizedDictIterator.cs,NONE,1.1 SynchronizedListIterator.cs,NONE,1.1 Algorithm.cs,1.1,1.2 ArrayList.cs,1.2,1.3 ArrayQueue.cs,1.1,1.2 ArrayStack.cs,1.1,1.2 CollectionAdapter.cs,1.1,1.2 CollectionWrapper.cs,1.1,1.2 DictionaryAdapter.cs,1.1,1.2 DictionaryEnumeratorAdapter.cs,1.1,1.2 DictionaryEnumeratorWrapper.cs,1.1,1.2 DictionaryWrapper.cs,1.1,1.2 EnumerableAdapter.cs,1.1,1.2 EnumerableWrapper.cs,1.1,1.2 EnumeratorAdapter.cs,1.1,1.2 EnumeratorWrapper.cs,1.1,1.2 Generics.txt,1.2,1.3 Hashtable.cs,1.1,1.2 ICollection.cs,1.1,1.2 IDictionary.cs,1.1,1.2 IIterator.cs,1.1,1.2 IList.cs,1.1,1.2 IQueue.cs,1.1,1.2 IStack.cs,1.1,1.2 LinkedList.cs,1.1,1.2 ListAdapter.cs,1.1,1.2 ListWrapper.cs,1.1,1.2 ReadOnlyIterator.cs,1.1,1.2 ReverseIterator.cs,1.1,1.2 SynchronizedIterator.cs,1.1,1.2 IDictionaryEnumerator.cs,1.1,NONE IEnumerable.cs,1.1,NONE IEnumerator.cs,1.1,NONE SynchronizedDictEnumerator.cs,1.1,NONESynchronizedEnumerator.cs,1.1,NONE
Date: Sun, 23 Feb 2003 23:36:29 -0500

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

Modified Files:
        Algorithm.cs ArrayList.cs ArrayQueue.cs ArrayStack.cs 
        CollectionAdapter.cs CollectionWrapper.cs DictionaryAdapter.cs 
        DictionaryEnumeratorAdapter.cs DictionaryEnumeratorWrapper.cs 
        DictionaryWrapper.cs EnumerableAdapter.cs EnumerableWrapper.cs 
        EnumeratorAdapter.cs EnumeratorWrapper.cs Generics.txt 
        Hashtable.cs ICollection.cs IDictionary.cs IIterator.cs 
        IList.cs IQueue.cs IStack.cs LinkedList.cs ListAdapter.cs 
        ListWrapper.cs ReadOnlyIterator.cs ReverseIterator.cs 
        SynchronizedIterator.cs 
Added Files:
        IDictionaryIterator.cs IListIterator.cs 
        ReadOnlyListIterator.cs SynchronizedDictIterator.cs 
        SynchronizedListIterator.cs 
Removed Files:
        IDictionaryEnumerator.cs IEnumerable.cs IEnumerator.cs 
        SynchronizedDictEnumerator.cs SynchronizedEnumerator.cs 
Log Message:


Remove the dichotomy between enumerators and iterators and replace
it with just iterators.


--- NEW FILE ---
/*
 * IDictionaryIterator.cs - Generic dictionary iterators.
 *
 * Copyright (c) 2003  Southern Storm Software, Pty Ltd
 *
 * Permission is hereby granted, free of charge, to any person obtaining
 * a copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included
 * in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 * OTHER DEALINGS IN THE SOFTWARE.
 */

namespace Generics
{

using System;

public interface IDictionaryIterator<KeyT, ValueT> : IIterator<ValueT>
{

        DictionaryEntry<KeyT, ValueT> Entry { get; }
        KeyT Key { get; }
        ValueT Value { get; set; }

}; // interface IDictionaryIterator<KeyT, ValueT>

}; // namespace Generics

--- NEW FILE ---
/*
 * IListIterator.cs - Generic collection iterators for lists.
 *
 * Copyright (c) 2003  Southern Storm Software, Pty Ltd
 *
 * Permission is hereby granted, free of charge, to any person obtaining
 * a copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included
 * in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 * OTHER DEALINGS IN THE SOFTWARE.
 */

namespace Generics
{

using System;

public interface IListIterator : IIterator<T>
{

        // Move to the previous element in the current iteration.
        bool MovePrev();

        // Get the current list position.
        int Position { get; }

        // Get or set the value of the current element.
        new T Current { get; set; }

}; // interface IListIterator<T>

}; // namespace Generics

--- NEW FILE ---
/*
 * ReadOnlyListIterator.cs - Wrap a list iterator to make it read-only.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace Generics
{

using System;

internal 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>

}; // namespace Generics

--- NEW FILE ---
/*
 * SynchronizedDictIterator.cs - Wrap an iterator to synchronize it.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace Generics
{

using System;

internal sealed class SynchronizedDictIterator<KeyT, ValueT>
                : IDictionaryIterator<KeyT, ValueT>
{
        // Internal state.
        protected Object syncRoot;
        protected IDictionaryIterator<KeyT, ValueT> iterator;

        // Constructor.
        public SynchronizedDictIterator
                                (Object syncRoot, IDictionaryIterator<KeyT, 
ValueT> iterator)
                        {
                                this.syncRoot = syncRoot;
                                this.iterator = iterator;
                        }

        // Implement the IIterator<ValueT> interface.
        public bool MoveNext()
                        {
                                lock(syncRoot)
                                {
                                        return iterator.MoveNext();
                                }
                        }
        public void Reset()
                        {
                                lock(syncRoot)
                                {
                                        iterator.Reset();
                                }
                        }
        public void Remove()
                        {
                                lock(syncRoot)
                                {
                                        iterator.Remove();
                                }
                        }
        ValueT IIterator<ValueT>.Current
                        {
                                get
                                {
                                        lock(syncRoot)
                                        {
                                                return 
((IIterator<ValueT>)iterator).Current;
                                        }
                                }
                        }

        // Implement the IDictionaryIterator<KeyT, ValueT> interface.
        public DictionaryEntry<KeyT, ValueT> Entry
                        {
                                get
                                {
                                        lock(syncRoot)
                                        {
                                                return iterator.Entry;
                                        }
                                }
                        }
        public KeyT Key
                        {
                                get
                                {
                                        lock(syncRoot)
                                        {
                                                return iterator.Key;
                                        }
                                }
                        }
        public ValueT Value
                        {
                                get
                                {
                                        lock(syncRoot)
                                        {
                                                return iterator.Value;
                                        }
                                }
                                set
                                {
                                        lock(syncRoot)
                                        {
                                                iterator.Value = value;
                                        }
                                }
                        }

}; // class SynchronizedDictIterator<KeyT, ValueT>

}; // namespace Generics

--- NEW FILE ---
/*
 * SynchronizedListIterator.cs - Wrap a list iterator to synchronize it.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace Generics
{

using System;

internal sealed class SynchronizedListIterator<T> : IListIterator<T>
{
        // Internal state.
        protected Object       syncRoot;
        protected IListIterator<T> iterator;

        // Constructor.
        public SynchronizedListIterator(Object syncRoot, IListIterator<T> 
iterator)
                        {
                                this.syncRoot = syncRoot;
                                this.iterator = iterator;
                        }

        // Implement the IIterator<T> interface.
        public bool MoveNext()
                        {
                                lock(syncRoot)
                                {
                                        return iterator.MoveNext();
                                }
                        }
        public void Reset()
                        {
                                lock(syncRoot)
                                {
                                        iterator.Reset();
                                }
                        }
        public void Remove()
                        {
                                lock(syncRoot)
                                {
                                        iterator.Remove();
                                }
                        }
        T IIterator<T>.Current
                        {
                                get
                                {
                                        lock(syncRoot)
                                        {
                                                return 
((IIterator<T>)iterator).Current;
                                        }
                                }
                        }

        // Implement the IListIterator<T> interface.
        public bool MovePrev()
                        {
                                lock(syncRoot)
                                {
                                        return iterator.MovePrev();
                                }
                        }
        public int Position
                        {
                                get
                                {
                                        lock(syncRoot)
                                        {
                                                return iterator.Position;
                                        }
                                }
                        }
        public T Current
                        {
                                get
                                {
                                        lock(syncRoot)
                                        {
                                                return iterator.Current;
                                        }
                                }
                                set
                                {
                                        lock(syncRoot)
                                        {
                                                iterator.Current = value;
                                        }
                                }
                        }

}; // class SynchronizedListIterator<T>

}; // namespace Generics

Index: Algorithm.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Generics/Algorithm.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** Algorithm.cs        22 Feb 2003 02:56:20 -0000      1.1
--- Algorithm.cs        24 Feb 2003 04:36:25 -0000      1.2
***************
*** 157,162 ****
                        }
  
!       // Determine if the content of two enumerations are equal.
!       public static bool Equals<T>(IEnumerator<T> e1, IEnumerator<T> e2)
                        {
                                for(;;)
--- 157,162 ----
                        }
  
!       // Determine if the content of two iterations are equal.
!       public static bool Equals<T>(IIterator<T> e1, IIterator<T> e2)
                        {
                                for(;;)
***************
*** 176,180 ****
                                }
                        }
!       public static bool Equals<T>(IEnumerator<T> e1, IEnumerator<T> e2,
                                                                 IComparer<T> 
cmp)
                        {
--- 176,180 ----
                                }
                        }
!       public static bool Equals<T>(IIterator<T> e1, IIterator<T> e2,
                                                                 IComparer<T> 
cmp)
                        {
***************
*** 196,201 ****
                        }
  
!       // Determine if the content of two enumerations are not equal.
!       public static bool NotEquals<T>(IEnumerator<T> e1, IEnumerator<T> e2)
                        {
                                for(;;)
--- 196,201 ----
                        }
  
!       // Determine if the content of two iterations are not equal.
!       public static bool NotEquals<T>(IIterator<T> e1, IIterator<T> e2)
                        {
                                for(;;)
***************
*** 215,219 ****
                                }
                        }
!       public static bool NotEquals<T>(IEnumerator<T> e1, IEnumerator<T> e2,
                                                                    
IComparer<T> cmp)
                        {
--- 215,219 ----
                                }
                        }
!       public static bool NotEquals<T>(IIterator<T> e1, IIterator<T> e2,
                                                                    
IComparer<T> cmp)
                        {
***************
*** 238,247 ****
        public static bool Equals<T>(ICollection<T> c1, ICollection<T> c2)
                        {
!                               return Equals<T>(c1.GetEnumerator(), 
c2.GetEnumerator());
                        }
        public static bool Equals<T>(ICollection<T> c1, ICollection<T> c2,
                                                                 IComparer<T> 
cmp)
                        {
!                               return Equals<T>(c1.GetEnumerator(), 
c2.GetEnumerator(), cmp);
                        }
  
--- 238,247 ----
        public static bool Equals<T>(ICollection<T> c1, ICollection<T> c2)
                        {
!                               return Equals<T>(c1.GetIterator(), 
c2.GetIterator());
                        }
        public static bool Equals<T>(ICollection<T> c1, ICollection<T> c2,
                                                                 IComparer<T> 
cmp)
                        {
!                               return Equals<T>(c1.GetIterator(), 
c2.GetIterator(), cmp);
                        }
  
***************
*** 249,265 ****
        public static bool NotEquals<T>(ICollection<T> c1, ICollection<T> c2)
                        {
!                               return NotEquals<T>(c1.GetEnumerator(), 
c2.GetEnumerator());
                        }
        public static bool NotEquals<T>(ICollection<T> c1, ICollection<T> c2,
                                                                    
IComparer<T> cmp)
                        {
!                               return NotEquals<T>(c1.GetEnumerator(),
!                                                                       
c2.GetEnumerator(), cmp);
                        }
  
!       // Find a particular value in an enumeration, beginning with
!       // the next item.  The enumerator will be positioned on the
!       // found value, or the end of the enumeration.
!       public static bool Find<T>(IEnumerator<T> e, T value)
                        {
                                while(e.MoveNext())
--- 249,265 ----
        public static bool NotEquals<T>(ICollection<T> c1, ICollection<T> c2)
                        {
!                               return NotEquals<T>(c1.GetIterator(), 
c2.GetIterator());
                        }
        public static bool NotEquals<T>(ICollection<T> c1, ICollection<T> c2,
                                                                    
IComparer<T> cmp)
                        {
!                               return NotEquals<T>(c1.GetIterator(),
!                                                                       
c2.GetIterator(), cmp);
                        }
  
!       // Find a particular value in an iteration, beginning with
!       // the next item.  The iterator will be positioned on the
!       // found value, or the end of the iteration.
!       public static bool Find<T>(IIterator<T> e, T value)
                        {
                                while(e.MoveNext())
***************
*** 272,276 ****
                                return false;
                        }
!       public static bool Find<T>(IEnumerator<T> e, T value, IComparer<T> cmp)
                        {
                                while(e.MoveNext())
--- 272,276 ----
                                return false;
                        }
!       public static bool Find<T>(IIterator<T> e, T value, IComparer<T> cmp)
                        {
                                while(e.MoveNext())
***************
*** 284,290 ****
                        }
  
!       // Find the position within an enumeration that satisfies a
        // particular predicate condition.
!       public static bool Find<T>(IEnumerator<T> e, Predicate<T> pred)
                        {
                                while(e.MoveNext())
--- 284,290 ----
                        }
  
!       // Find the position within an iteration that satisfies a
        // particular predicate condition.
!       public static bool Find<T>(IIterator<T> e, Predicate<T> pred)
                        {
                                while(e.MoveNext())

Index: ArrayList.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Generics/ArrayList.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** ArrayList.cs        22 Feb 2003 03:54:04 -0000      1.2
--- ArrayList.cs        24 Feb 2003 04:36:25 -0000      1.3
***************
*** 28,38 ****
  using System;
  
! public class ArrayList<T>
!       : ICollection<T>, IEnumerable<T>, IList<T>, ICloneable, IIterable<T>
  {
        // Internal state.
        private int count;
        private T[] store;
-       private int generation;
  
        // Simple constructors.
--- 28,36 ----
  using System;
  
! public class ArrayList<T> : ICollection<T>, IList<T>, ICloneable
  {
        // Internal state.
        private int count;
        private T[] store;
  
        // Simple constructors.
***************
*** 41,45 ****
                                count = 0;
                                store = new T [16];
-                               generation = 0;
                        }
        public ArrayList(int capacity)
--- 39,42 ----
***************
*** 52,56 ****
                                count = 0;
                                store = new T [capacity];
-                               generation = 0;
                        }
  
--- 49,52 ----
***************
*** 58,62 ****
        public ArrayList(ICollection<T> c)
                        {
!                               IEnumerator<T> enumerator;
                                int index;
                                if(c == null)
--- 54,58 ----
        public ArrayList(ICollection<T> c)
                        {
!                               IIterator<T> iterator;
                                int index;
                                if(c == null)
***************
*** 66,75 ****
                                count = c.Count;
                                store = new T [count];
!                               enumerator = c.GetEnumerator();
!                               for(index = 0; enumerator.MoveNext(); ++index)
                                {
!                                       store[index] = enumerator.Current;
                                }
-                               generation = 0;
                        }
  
--- 62,70 ----
                                count = c.Count;
                                store = new T [count];
!                               iterator = c.GetIterator();
!                               for(index = 0; iterator.MoveNext(); ++index)
                                {
!                                       store[index] = iterator.Current;
                                }
                        }
  
***************
*** 132,136 ****
                                }
                                store[count] = value;
-                               ++generation;
                                return count++;
                        }
--- 127,130 ----
***************
*** 139,143 ****
                                Array.Clear(store, 0, count);
                                count = 0;
-                               ++generation;
                        }
        public virtual bool Contains(T item)
--- 133,136 ----
***************
*** 195,199 ****
                                store[index] = value;
                                ++count;
-                               ++generation;
                        }
        public virtual void Remove(T value)
--- 188,191 ----
***************
*** 203,207 ****
                                {
                                        Delete(1, index);
-                                       ++generation;
                                }
                        }
--- 195,198 ----
***************
*** 214,218 ****
                                }
                                Delete(1, index);
-                               ++generation;
                        }
        public virtual bool IsFixedSize
--- 205,208 ----
***************
*** 249,253 ****
                                        }
                                        store[index] = value;
-                                       ++generation;
                                }
                        }
--- 239,242 ----
***************
*** 257,261 ****
                        {
                                int cCount;
!                               IEnumerator<T> enumerator;
                                if(c == null)
                                {
--- 246,250 ----
                        {
                                int cCount;
!                               IIterator<T> iterator;
                                if(c == null)
                                {
***************
*** 267,276 ****
                                        Realloc(cCount, count);
                                }
!                               enumerator = c.GetEnumerator();
!                               while(enumerator.MoveNext())
                                {
!                                       store[count++] = enumerator.Current;
                                }
-                               ++generation;
                        }
  
--- 256,264 ----
                                        Realloc(cCount, count);
                                }
!                               iterator = c.GetIterator();
!                               while(iterator.MoveNext())
                                {
!                                       store[count++] = iterator.Current;
                                }
                        }
  
***************
*** 279,283 ****
                        {
                                int cCount;
!                               IEnumerator<T> enumerator;
                                if(c == null)
                                {
--- 267,271 ----
                        {
                                int cCount;
!                               IIterator<T> iterator;
                                if(c == null)
                                {
***************
*** 291,301 ****
                                cCount = c.Count;
                                Realloc(cCount, index);
!                               enumerator = c.GetEnumerator();
                                while(enumerator.MoveNext())
                                {
!                                       store[index++] = enumerator.Current;
                                }
                                count += cCount;
-                               ++generation;
                        }
  
--- 279,288 ----
                                cCount = c.Count;
                                Realloc(cCount, index);
!                               iterator = c.GetIterator();
                                while(enumerator.MoveNext())
                                {
!                                       store[index++] = iterator.Current;
                                }
                                count += cCount;
                        }
  
***************
*** 318,322 ****
                                }
                                Delete(count, index);
-                               ++generation;
                        }
  
--- 305,308 ----
***************
*** 412,416 ****
                                ArrayList<T> clone = new ArrayList<T>(count);
                                clone.count = count;
-                               clone.generation = generation;
                                Array.Copy(store, 0, clone.store, 0, count);
                                return clone;
--- 398,401 ----
***************
*** 627,631 ****
                        {
                                Array.Reverse(store, 0, count);
-                               ++generation;
                        }
        public virtual void Reverse(int index, int count)
--- 612,615 ----
***************
*** 646,650 ****
                                }
                                Array.Reverse(store, index, count);
-                               ++generation;
                        }
  
--- 630,633 ----
***************
*** 653,657 ****
                        {
                                int count;
!                               IEnumerator<T> enumerator;
                                if(c == null)
                                {
--- 636,640 ----
                        {
                                int count;
!                               IIterator<T> iterator;
                                if(c == null)
                                {
***************
*** 668,677 ****
                                        throw new 
ArgumentException(S._("Arg_InvalidArrayRange"));
                                }
!                               enumerator = c.GetEnumerator();
!                               while(enumerator.MoveNext())
                                {
!                                       store[index++] = enumerator.Current;
                                }
-                               ++generation;
                        }
  
--- 651,659 ----
                                        throw new 
ArgumentException(S._("Arg_InvalidArrayRange"));
                                }
!                               iterator = c.GetIterator();
!                               while(iterator.MoveNext())
                                {
!                                       store[index++] = iterator.Current;
                                }
                        }
  
***************
*** 779,783 ****
                                        store = new T[16];
                                }
-                               ++generation;
                        }
  
--- 761,764 ----
***************
*** 810,847 ****
                                                store = newStore;
                                        }
-                                       ++generation;
                                }
                        }
  
-       // Get an enumerator for this array list.
-       public virtual IEnumerator<T> GetEnumerator()
-                       {
-                               return new ArrayListEnumerator<T>(this, 0, 
Count);
-                       }
-       public virtual IEnumerator<T> GetEnumerator(int index, int count)
-                       {
-                               if(index < 0)
-                               {
-                                       throw new ArgumentOutOfRangeException
-                                               ("index", 
S._("ArgRange_Array"));
-                               }
-                               if(count < 0)
-                               {
-                                       throw new ArgumentOutOfRangeException
-                                               ("count", 
S._("ArgRange_Array"));
-                               }
-                               if((Count - index) < count)
-                               {
-                                       throw new 
ArgumentException(S._("Arg_InvalidArrayRange"));
-                               }
-                               return new ArrayListEnumerator<T>(this, index, 
index + count);
-                       }
- 
        // Get an iterator for this array list.
!       public virtual IIterator<T> GetIterator()
                        {
                                return new ArrayListIterator<T>(this, 0, Count);
                        }
!       public virtual IIterator<T> GetIterator(int index, int count)
                        {
                                if(index < 0)
--- 791,807 ----
                                                store = newStore;
                                        }
                                }
                        }
  
        // Get an iterator for this array list.
!       public virtual IListIterator<T> GetIterator()
                        {
                                return new ArrayListIterator<T>(this, 0, Count);
                        }
!       IIterator<T> IIterable<T>.GetIterator()
!                       {
!                               return GetIterator();
!                       }
!       public virtual IListIterator<T> GetIterator(int index, int count)
                        {
                                if(index < 0)
***************
*** 862,922 ****
                        }
  
-       // Array list enumerator class.
-       private class ArrayListEnumerator<T> : IEnumerator<T>
-       {
-               // Internal state.
-               private ArrayList<T> list;
-               private int start;
-               private int finish;
-               private int position;
-               private int generation;
- 
-               // Constructor.
-               public ArrayListEnumerator(ArrayList<T> list, int start, int 
finish)
-                               {
-                                       this.list = list;
-                                       this.start = start;
-                                       this.finish = finish;
-                                       position = start - 1;
-                                       generation = list.generation;
-                               }
- 
-               // Implement the IEnumerator<T> interface.
-               public bool MoveNext()
-                               {
-                                       if(generation != list.generation)
-                                       {
-                                               throw new 
InvalidOperationException
-                                                       
(S._("Invalid_CollectionModified"));
-                                       }
-                                       ++position;
-                                       return (position < finish);
-                               }
-               public void Reset()
-                               {
-                                       position = start - 1;
-                               }
-               public T Current
-                               {
-                                       get
-                                       {
-                                               if(generation != 
list.generation)
-                                               {
-                                                       throw new 
InvalidOperationException
-                                                               
(S._("Invalid_CollectionModified"));
-                                               }
-                                               else if(position < start || 
position >= finish)
-                                               {
-                                                       throw new 
InvalidOperationException
-                                                               
(S._("Invalid_BadEnumeratorPosition"));
-                                               }
-                                               return list[position];
-                                       }
-                               }
- 
-       }; // class ArrayListEnumerator<T>
- 
        // Array list iterator class.
!       private class ArrayListIterator<T> : IEnumerator<T>, IIterator<T>
        {
                // Internal state.
--- 822,827 ----
                        }
  
        // Array list iterator class.
!       private class ArrayListIterator<T> : IListIterator<T>
        {
                // Internal state.
***************
*** 925,928 ****
--- 830,834 ----
                private int finish;
                private int position;
+               private int removed;
                private bool reset;
  
***************
*** 934,941 ****
                                        this.finish = finish;
                                        position = start - 1;
                                        reset = true;
                                }
  
!               // Implement the IEnumerator<T> interface.
                public bool MoveNext()
                                {
--- 840,848 ----
                                        this.finish = finish;
                                        position = start - 1;
+                                       removed = -1;
                                        reset = true;
                                }
  
!               // Implement the IIterator<T> interface.
                public bool MoveNext()
                                {
***************
*** 943,950 ****
                                        {
                                                // Start at the beginning of 
the range.
!                                               position = start - 1;
                                                reset = false;
                                        }
!                                       ++position;
                                        return (position < finish);
                                }
--- 850,866 ----
                                        {
                                                // Start at the beginning of 
the range.
!                                               position = start;
                                                reset = false;
                                        }
!                                       else if(removed != -1)
!                                       {
!                                               // An item was removed, so 
re-visit this position.
!                                               position = removed;
!                                               removed = -1;
!                                       }
!                                       else
!                                       {
!                                               ++position;
!                                       }
                                        return (position < finish);
                                }
***************
*** 953,962 ****
                                        reset = true;
                                        position = start - 1;
                                }
!               T IEnumerator<T>.Current
                                {
                                        get
                                        {
!                                               if(position < start || position 
>= finish)
                                                {
                                                        throw new 
InvalidOperationException
--- 869,891 ----
                                        reset = true;
                                        position = start - 1;
+                                       removed = -1;
                                }
!               public void Remove()
!                               {
!                                       if(position < start || position >= 
finish || removed != -1)
!                                       {
!                                               throw new 
InvalidOperationException
!                                                       
(S._("Invalid_BadIteratorPosition"));
!                                       }
!                                       list.RemoveAt(position);
!                                       --finish;
!                                       removed = position;
!                               }
!               T IIterator<T>.Current
                                {
                                        get
                                        {
!                                               if(position < start || position 
>= finish ||
!                                                  removed != -1)
                                                {
                                                        throw new 
InvalidOperationException
***************
*** 967,971 ****
                                }
  
!               // Implement the IIterator<T> interface.
                public bool MovePrev()
                                {
--- 896,900 ----
                                }
  
!               // Implement the IListIterator<T> interface.
                public bool MovePrev()
                                {
***************
*** 973,987 ****
                                        {
                                                // Start at the end of the 
range.
!                                               position = finish;
                                                reset = false;
                                        }
!                                       --position;
                                        return (position >= start);
                                }
                public T Current
                                {
                                        get
                                        {
!                                               if(position < start || position 
>= finish)
                                                {
                                                        throw new 
InvalidOperationException
--- 902,939 ----
                                        {
                                                // Start at the end of the 
range.
!                                               position = finish - 1;
                                                reset = false;
                                        }
!                                       else if(removed != -1)
!                                       {
!                                               // An item was removed, so move 
to just before it.
!                                               position = removed - 1;
!                                               removed = -1;
!                                       }
!                                       else
!                                       {
!                                               --position;
!                                       }
                                        return (position >= start);
                                }
+               public int Position
+                               {
+                                       get
+                                       {
+                                               if(position < start || position 
>= finish ||
+                                                  removed != -1)
+                                               {
+                                                       throw new 
InvalidOperationException
+                                                               
(S._("Invalid_BadIteratorPosition"));
+                                               }
+                                               return position;
+                                       }
+                               }
                public T Current
                                {
                                        get
                                        {
!                                               if(position < start || position 
>= finish ||
!                                                  removed != -1)
                                                {
                                                        throw new 
InvalidOperationException
***************
*** 992,996 ****
                                        set
                                        {
!                                               if(position < start || position 
>= finish)
                                                {
                                                        throw new 
InvalidOperationException
--- 944,949 ----
                                        set
                                        {
!                                               if(position < start || position 
>= finish ||
!                                                  removed != -1)
                                                {
                                                        throw new 
InvalidOperationException
***************
*** 1101,1108 ****
                                                throw new 
ArgumentNullException("c");
                                        }
!                                       IEnumerator<T> enumerator = 
c.GetEnumerator();
!                                       while(enumerator.MoveNext())
                                        {
!                                               list.Add(enumerator.Current);
                                        }
                                }
--- 1054,1061 ----
                                                throw new 
ArgumentNullException("c");
                                        }
!                                       IIterator<T> iterator = c.GetIterator();
!                                       while(iterator.MoveNext())
                                        {
!                                               list.Add(iterator.Current);
                                        }
                                }
***************
*** 1113,1120 ****
                                                throw new 
ArgumentNullException("c");
                                        }
!                                       IEnumerator<T> enumerator = 
c.GetEnumerator();
!                                       while(enumerator.MoveNext())
                                        {
!                                               list.Insert(index++, 
enumerator.Current);
                                        }
                                }
--- 1066,1073 ----
                                                throw new 
ArgumentNullException("c");
                                        }
!                                       IIterator<T> enumerator = 
c.GetIterator();
!                                       while(iterator.MoveNext())
                                        {
!                                               list.Insert(index++, 
iterator.Current);
                                        }
                                }
***************
*** 1143,1150 ****
                                                throw new 
ArgumentNullException("c");
                                        }
!                                       IEnumerator<T> enumerator = 
c.GetEnumerator();
!                                       while(enumerator.MoveNext())
                                        {
!                                               list[index++] = 
enumerator.Current;
                                        }
                                }
--- 1096,1103 ----
                                                throw new 
ArgumentNullException("c");
                                        }
!                                       IIterator<T> enumerator = 
c.GetIterator();
!                                       while(iterator.MoveNext())
                                        {
!                                               list[index++] = 
iterator.Current;
                                        }
                                }
***************
*** 1457,1476 ****
                                }
  
-               // Get an enumerator for this array list.
-               public override IEnumerator<T> GetEnumerator()
-                               {
-                                       return list.GetEnumerator();
-                               }
-               public override IEnumerator<T> GetEnumerator(int index, int 
count)
-                               {
-                                       return list.GetEnumerator(index, count);
-                               }
- 
                // Get an iterator for this array list.
!               public override IIterator<T> GetIterator()
                                {
                                        return list.GetIterator();
                                }
!               public override IIterator<T> GetIterator(int index, int count)
                                {
                                        return list.GetIterator(index, count);
--- 1410,1419 ----
                                }
  
                // Get an iterator for this array list.
!               public override IListIterator<T> GetIterator()
                                {
                                        return list.GetIterator();
                                }
!               public override IListIterator<T> GetIterator(int index, int 
count)
                                {
                                        return list.GetIterator(index, count);
***************
*** 1502,1505 ****
--- 1445,1449 ----
                                : base(list)
                                {
+                                       // Nothing to do here.
                                }
  
***************
*** 1622,1636 ****
                                        this.index = index;
                                        this.count = count;
-                                       generation = list.generation;
-                               }
- 
-               // Determine if the underlying array list has been changed.
-               private void UnderlyingCheck()
-                               {
-                                       if(generation != list.generation)
-                                       {
-                                               throw new 
InvalidOperationException
-                                                       
(S._("Invalid_UnderlyingModified"));
-                                       }
                                }
  
--- 1566,1569 ----
***************
*** 1638,1665 ****
                public override int Add(T value)
                                {
-                                       UnderlyingCheck();
                                        list.Insert(index + count, value);
-                                       generation = list.generation;
                                        return index + count;
                                }
                public override void Clear()
                                {
-                                       UnderlyingCheck();
                                        list.Clear();
-                                       generation = list.generation;
                                }
                public override bool Contains(T item)
                                {
-                                       UnderlyingCheck();
                                        return (list.IndexOf(item) != -1);
                                }
                public override int IndexOf(T value)
                                {
-                                       UnderlyingCheck();
                                        return list.IndexOf(value, index, 
count);
                                }
                public override void Insert(int index, T value)
                                {
-                                       UnderlyingCheck();
                                        if(index < 0 || index >= count)
                                        {
--- 1571,1591 ----
***************
*** 1668,1676 ****
                                        }
                                        list.Insert(index + this.index, value);
-                                       generation = list.generation;
                                }
                public override void Remove(T value)
                                {
-                                       UnderlyingCheck();
                                        int ind = list.IndexOf(value, index, 
count);
                                        if(ind != -1)
--- 1594,1600 ----
***************
*** 1678,1688 ****
                                                list.RemoveAt(ind);
                                        }
-                                       generation = list.generation;
                                }
                public override void RemoveAt(int index)
                                {
-                                       UnderlyingCheck();
                                        list.RemoveAt(index + this.index);
-                                       generation = list.generation;
                                }
                public override bool IsFixedSize
--- 1602,1609 ----
***************
*** 1704,1708 ****
                                        get
                                        {
-                                               UnderlyingCheck();
                                                if(index < 0 || index >= count)
                                                {
--- 1625,1628 ----
***************
*** 1714,1718 ****
                                        set
                                        {
-                                               UnderlyingCheck();
                                                if(index < 0 || index >= count)
                                                {
--- 1634,1637 ----
***************
*** 1721,1725 ****
                                                }
                                                list[index + this.index] = 
value;
-                                               generation = list.generation;
                                        }
                                }
--- 1640,1643 ----
***************
*** 1728,1752 ****
                public override void AddRange(ICollection<T> c)
                                {
-                                       UnderlyingCheck();
                                        list.InsertRange(index + count, c);
-                                       generation = list.generation;
                                }
                public override void InsertRange(int index, ICollection<T> c)
                                {
-                                       UnderlyingCheck();
                                        list.InsertRange(index + this.index, c);
-                                       generation = list.generation;
                                }
                public override void RemoveRange(int index, int count)
                                {
-                                       UnderlyingCheck();
                                        list.RemoveRange(index + this.index, 
count);
-                                       generation = list.generation;
                                }
                public override void SetRange(int index, ICollection<T> c)
                                {
-                                       UnderlyingCheck();
                                        list.SetRange(index + this.index, c);
-                                       generation = list.generation;
                                }
  
--- 1646,1662 ----
***************
*** 1761,1765 ****
                public override int BinarySearch(T value)
                                {
-                                       UnderlyingCheck();
                                        return list.BinarySearch
                                                (index, count, value, 
(IComparer<T>)null);
--- 1671,1674 ----
***************
*** 1767,1771 ****
                public override int BinarySearch(T value, IComparer<T> comparer)
                                {
-                                       UnderlyingCheck();
                                        return list.BinarySearch(index, count, 
value, comparer);
                                }
--- 1676,1679 ----
***************
*** 1773,1777 ****
                                                                             T 
value, IComparer<T> comparer)
                                {
-                                       UnderlyingCheck();
                                        return list.BinarySearch(index + 
this.index, count,
                                                                                
         value, comparer);
--- 1681,1684 ----
***************
*** 1779,1803 ****
                public override int IndexOf(T value, int startIndex)
                                {
-                                       UnderlyingCheck();
                                        return list.IndexOf(value, startIndex);
                                }
                public override int IndexOf(T value, int startIndex, int count)
                                {
-                                       UnderlyingCheck();
                                        return list.IndexOf(value, startIndex, 
count);
                                }
                public override int LastIndexOf(T value)
                                {
-                                       UnderlyingCheck();
                                        return list.LastIndexOf(value);
                                }
                public override int LastIndexOf(T value, int startIndex)
                                {
-                                       UnderlyingCheck();
                                        return list.LastIndexOf(value, 
startIndex);
                                }
                public override int LastIndexOf(T value, int startIndex, int 
count)
                                {
-                                       UnderlyingCheck();
                                        return list.LastIndexOf(value, 
startIndex, count);
                                }
--- 1686,1705 ----
***************
*** 1812,1816 ****
                                        get
                                        {
-                                               UnderlyingCheck();
                                                return count;
                                        }
--- 1714,1717 ----
***************
*** 1895,1908 ****
                                }
  
-               // Get an enumerator for this array list.
-               public override IEnumerator<T> GetEnumerator()
-                               {
-                                       return list.GetEnumerator();
-                               }
-               public override IEnumerator<T> GetEnumerator(int index, int 
count)
-                               {
-                                       return list.GetEnumerator(index, count);
-                               }
- 
                // Get an iterator for this array list.
                public override IIterator<T> GetIterator()
--- 1796,1799 ----
***************
*** 1940,1943 ****
--- 1831,1835 ----
                                : base(list)
                                {
+                                       // Nothing to do here.
                                }
  
***************
*** 2052,2062 ****
  
                // Get an iterator for this array list.
!               public override IIterator<T> GetIterator()
                                {
!                                       return new 
ReadOnlyIterator<T>(list.GetIterator());
                                }
!               public override IIterator<T> GetIterator(int index, int count)
                                {
!                                       return new ReadOnlyIterator<T>
                                                (list.GetIterator(index, 
count));
                                }
--- 1944,1954 ----
  
                // Get an iterator for this array list.
!               public override IListIterator<T> GetIterator()
                                {
!                                       return new 
ReadOnlyListIterator<T>(list.GetIterator());
                                }
!               public override IListIterator<T> GetIterator(int index, int 
count)
                                {
!                                       return new ReadOnlyListIterator<T>
                                                (list.GetIterator(index, 
count));
                                }
***************
*** 2403,2426 ****
                                }
  
-               // Get an enumerator for this array list.
-               public override IEnumerator<T> GetEnumerator()
-                               {
-                                       lock(SyncRoot)
-                                       {
-                                               return new 
SynchronizedEnumerator<T>
-                                                       (SyncRoot, 
list.GetEnumerator());
-                                       }
-                               }
-               public override IEnumerator<T> GetEnumerator(int index, int 
count)
-                               {
-                                       lock(SyncRoot)
-                                       {
-                                               return new 
SynchronizedEnumerator<T>
-                                                       (SyncRoot, 
list.GetEnumerator(index, count));
-                                       }
-                               }
- 
                // Get an iterator for this array list.
!               public override IIterator<T> GetIterator()
                                {
                                        lock(SyncRoot)
--- 2295,2300 ----
                                }
  
                // Get an iterator for this array list.
!               public override IListIterator<T> GetIterator()
                                {
                                        lock(SyncRoot)
***************
*** 2430,2434 ****
                                        }
                                }
!               public override IIterator<T> GetIterator(int index, int count)
                                {
                                        lock(SyncRoot)
--- 2304,2308 ----
                                        }
                                }
!               public override IListIterator<T> GetIterator(int index, int 
count)
                                {
                                        lock(SyncRoot)

Index: ArrayQueue.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Generics/ArrayQueue.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** ArrayQueue.cs       22 Feb 2003 05:15:31 -0000      1.1
--- ArrayQueue.cs       24 Feb 2003 04:36:25 -0000      1.2
***************
*** 28,32 ****
  using System;
  
! public class ArrayQueue<T> : IQueue<T>
  {
        // Internal state.
--- 28,32 ----
  using System;
  
! public class ArrayQueue<T> : IQueue<T>, ICloneable
  {
        // Internal state.
***************
*** 34,38 ****
        private int   add, remove, size;
        private float growFactor;
-       private int   generation;
  
        // The default capacity for queues.
--- 34,37 ----
***************
*** 47,51 ****
                                size = 0;
                                growFactor = 2.0f;
-                               generation = 0;
                        }
        public ArrayQueue(int capacity)
--- 46,49 ----
***************
*** 61,65 ****
                                size = 0;
                                growFactor = 2.0f;
-                               generation = 0;
                        }
        public ArrayQueue(int capacity, float growFactor)
--- 59,62 ----
***************
*** 80,84 ****
                                size = 0;
                                this.growFactor = growFactor;
-                               generation = 0;
                        }
        public ArrayQueue(ICollection<T> col)
--- 77,80 ----
***************
*** 94,98 ****
                                size = items.Length;
                                growFactor = 2.0f;
-                               generation = 0;
                        }
  
--- 90,93 ----
***************
*** 158,167 ****
                        }
  
-       // Implement the IEnumerable<T> interface.
-       public virtual IEnumerator<T> GetEnumerator()
-                       {
-                               return new QueueEnumerator<T>(this);
-                       }
- 
        // Implement the IIterable<T> interface.
        public virtual IIterable<T> GetIterator()
--- 153,156 ----
***************
*** 185,189 ****
                                remove = 0;
                                size = 0;
-                               ++generation;
                        }
  
--- 174,177 ----
***************
*** 262,266 ****
                                        ++size;
                                }
-                               ++generation;
                        }
        public virtual T Dequeue()
--- 250,253 ----
***************
*** 271,275 ****
                                        remove = (remove + 1) % items.Length;
                                        --size;
-                                       ++generation;
                                        return value;
                                }
--- 258,261 ----
***************
*** 381,391 ****
                                }
  
!               // Implement the IEnumerable<T> interface.
!               public override IEnumerator<T> GetEnumerator()
                                {
                                        lock(SyncRoot)
                                        {
!                                               return new 
SynchronizedEnumerator<T>
!                                                       (SyncRoot, 
queue.GetEnumerator());
                                        }
                                }
--- 367,377 ----
                                }
  
!               // Implement the IIterable<T> interface.
!               public override IIterator<T> GetIterator()
                                {
                                        lock(SyncRoot)
                                        {
!                                               return new 
SynchronizedIterator<T>
!                                                       (SyncRoot, 
queue.GetIterator());
                                        }
                                }
***************
*** 448,474 ****
  
        // Private class for implementing queue enumeration.
!       private class QueueEnumerator<T> : IEnumerator<T>
        {
                // Internal state.
                private ArrayQueue<T> queue;
-               private int generation;
                private int position;
  
                // Constructor.
!               public QueueEnumerator(ArrayQueue<T> queue)
                                {
                                        this.queue = queue;
-                                       generation = queue.generation;
                                        position   = -1;
                                }
  
!               // Implement the IEnumerator<T> interface.
                public bool MoveNext()
                                {
-                                       if(generation != queue.generation)
-                                       {
-                                               throw new 
InvalidOperationException
-                                                       
(S._("Invalid_CollectionModified"));
-                                       }
                                        ++position;
                                        if(position < queue.size)
--- 434,453 ----
  
        // Private class for implementing queue enumeration.
!       private class QueueIterator<T> : IIterator<T>
        {
                // Internal state.
                private ArrayQueue<T> queue;
                private int position;
  
                // Constructor.
!               public QueueIterator(ArrayQueue<T> queue)
                                {
                                        this.queue = queue;
                                        position   = -1;
                                }
  
!               // Implement the IIterator<T> interface.
                public bool MoveNext()
                                {
                                        ++position;
                                        if(position < queue.size)
***************
*** 481,548 ****
                public void Reset()
                                {
-                                       if(generation != queue.generation)
-                                       {
-                                               throw new 
InvalidOperationException
-                                                       
(S._("Invalid_CollectionModified"));
-                                       }
-                                       position = -1;
-                               }
-               public T Current
-                               {
-                                       get
-                                       {
-                                               if(generation != 
queue.generation)
-                                               {
-                                                       throw new 
InvalidOperationException
-                                                               
(S._("Invalid_CollectionModified"));
-                                               }
-                                               if(position < 0 || position >= 
queue.size)
-                                               {
-                                                       throw new 
InvalidOperationException
-                                                               
(S._("Invalid_BadEnumeratorPosition"));
-                                               }
-                                               return queue.items
-                                                       [(queue.remove + 
position) % queue.size];
-                                       }
-                               }
- 
-       }; // class QueueEnumerator<T>
- 
-       // Private class for implementing queue iteration.
-       private class QueueIterator<T> : IIterator<T>
-       {
-               // Internal state.
-               private ArrayQueue<T> queue;
-               private int position;
-               private bool reset;
- 
-               // Constructor.
-               public QueueIterator(ArrayQueue<T> queue)
-                               {
-                                       this.queue = queue;
                                        position = -1;
-                                       reset = true;
                                }
! 
!               // Implement the IEnumerator<T> interface.
!               public bool MoveNext()
!                               {
!                                       if(reset)
!                                       {
!                                               position = 0;
!                                               reset = false;
!                                       }
!                                       else
!                                       {
!                                               ++position;
!                                       }
!                                       return (position < queue.size);
!                               }
!               public void Reset()
                                {
!                                       position = -1;
!                                       reset = true;
                                }
!               T IEnumerator<T>.Current
                                {
                                        get
--- 460,470 ----
                public void Reset()
                                {
                                        position = -1;
                                }
!               public void Remove()
                                {
!                                       throw new 
InvalidOperationException(S._("NotSupp_Remove"));
                                }
!               public T Current
                                {
                                        get
***************
*** 555,596 ****
                                                return queue.items
                                                        [(queue.remove + 
position) % queue.size];
-                                       }
-                               }
- 
-               // Implement the IIterator<T> interface.
-               public bool MovePrev()
-                               {
-                                       if(reset)
-                                       {
-                                               position = queue.size - 1;
-                                               reset = false;
-                                       }
-                                       else
-                                       {
-                                               --position;
-                                       }
-                                       return (position >= 0);
-                               }
-               public T Current
-                               {
-                                       get
-                                       {
-                                               if(position < 0 || position >= 
queue.size)
-                                               {
-                                                       throw new 
InvalidIteratorPosition
-                                                               
(S._("Invalid_BadEnumeratorPosition"));
-                                               }
-                                               return queue.items
-                                                       [(queue.remove + 
position) % queue.size];
-                                       }
-                                       set
-                                       {
-                                               if(position < 0 || position >= 
queue.size)
-                                               {
-                                                       throw new 
InvalidOperationException
-                                                               
(S._("Invalid_BadIteratorPosition"));
-                                               }
-                                               queue.items[(queue.remove + 
position) % queue.size]
-                                                       = value;
                                        }
                                }
--- 477,480 ----

Index: ArrayStack.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Generics/ArrayStack.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** ArrayStack.cs       22 Feb 2003 04:16:56 -0000      1.1
--- ArrayStack.cs       24 Feb 2003 04:36:26 -0000      1.2
***************
*** 33,37 ****
        private T[] items;
        private int size;
-       private int generation;
  
        // The default capacity for stacks.
--- 33,36 ----
***************
*** 46,50 ****
                                items = new T [DefaultCapacity];
                                size = 0;
-                               generation = 0;
                        }
        public ArrayStack(int initialCapacity)
--- 45,48 ----
***************
*** 57,61 ****
                                items = new T [initialCapacity];
                                size = 0;
-                               generation = 0;
                        }
        public ArrayStack(ICollection<T> col)
--- 55,58 ----
***************
*** 68,72 ****
                                col.CopyTo(items, 0);
                                size = items.Length;
-                               generation = 0;
                        }
  
--- 65,68 ----
***************
*** 122,131 ****
                        }
  
-       // Implement the IEnumerable<T> interface.
-       public virtual IEnumerator<T> GetEnumerator()
-                       {
-                               return new StackEnumerator<T>(this);
-                       }
- 
        // Implement the IIterable<T> interface.
        public virtual IIterator<T> GetIterator()
--- 118,121 ----
***************
*** 147,151 ****
                        {
                                size = 0;
-                               ++generation;
                        }
  
--- 137,140 ----
***************
*** 204,208 ****
                                        items[size++] = value;
                                }
-                               ++generation;
                        }
        public virtual T Pop()
--- 193,196 ----
***************
*** 210,214 ****
                                if(size > 0)
                                {
-                                       ++generation;
                                        return items[--size];
                                }
--- 198,201 ----
***************
*** 311,324 ****
                                }
  
-               // Implement the IEnumerable<T> interface.
-               public override IEnumerator<T> GetEnumerator()
-                               {
-                                       lock(SyncRoot)
-                                       {
-                                               return new 
SynchronizedEnumerator<T>
-                                                       (SyncRoot, 
stack.GetEnumerator());
-                                       }
-                               }
- 
                // Implement the IIterable<T> interface.
                public override IIterator<T> GetIterator()
--- 298,301 ----
***************
*** 387,414 ****
        }; // class SynchronizedStack<T>
  
!       // Private class for implementing stack enumeration.
!       private class StackEnumerator<T> : IEnumerator<T>
        {
                // Internal state.
                private ArrayStack<T> stack;
-               private int generation;
                private int position;
  
                // Constructor.
!               public StackEnumerator(ArrayStack<T> stack)
                                {
                                        this.stack = stack;
-                                       generation = stack.generation;
                                        position   = -1;
                                }
  
!               // Implement the IEnumerator<T> interface.
                public bool MoveNext()
                                {
-                                       if(generation != stack.generation)
-                                       {
-                                               throw new 
InvalidOperationException
-                                                       
(S._("Invalid_CollectionModified"));
-                                       }
                                        ++position;
                                        if(position < stack.size)
--- 364,384 ----
        }; // class SynchronizedStack<T>
  
!       // Private class for implementing stack iteration.
!       private class StackIterator<T> : IIterator<T>
        {
                // Internal state.
                private ArrayStack<T> stack;
                private int position;
  
                // Constructor.
!               public StackIterator(ArrayStack<T> stack)
                                {
                                        this.stack = stack;
                                        position   = -1;
                                }
  
!               // Implement the IIterator<T> interface.
                public bool MoveNext()
                                {
                                        ++position;
                                        if(position < stack.size)
***************
*** 421,512 ****
                public void Reset()
                                {
-                                       if(generation != stack.generation)
-                                       {
-                                               throw new 
InvalidOperationException
-                                                       
(S._("Invalid_CollectionModified"));
-                                       }
                                        position = -1;
                                }
!               public T Current
                                {
!                                       get
!                                       {
!                                               if(generation != 
stack.generation)
!                                               {
!                                                       throw new 
InvalidOperationException
!                                                               
(S._("Invalid_CollectionModified"));
!                                               }
!                                               if(position < 0 || position >= 
stack.size)
!                                               {
!                                                       throw new 
InvalidOperationException
!                                                               
(S._("Invalid_BadEnumeratorPosition"));
!                                               }
!                                               return stack.items[stack.size - 
position - 1];
!                                       }
!                               }
! 
!       }; // class StackEnumerator<T>
! 
!       // Private class for implementing stack iteration.
!       private class StackIterator<T> : IIterator<T>
!       {
!               // Internal state.
!               private ArrayStack<T> stack;
!               private int position;
!               private bool reset;
! 
!               // Constructor.
!               public StackIterator(ArrayStack<T> stack)
!                               {
!                                       this.stack = stack;
!                                       position = -1;
!                                       reset = true;
!                               }
! 
!               // Implement the IEnumerator<T> interface.
!               public bool MoveNext()
!                               {
!                                       if(reset)
!                                       {
!                                               position = 0;
!                                               reset = false;
!                                       }
!                                       else
!                                       {
!                                               ++position;
!                                       }
!                                       return (position < stack.size);
!                               }
!               public void Reset()
!                               {
!                                       position = -1;
!                                       reset = true;
!                               }
!               T IEnumerator<T>.Current
!                               {
!                                       get
!                                       {
!                                               if(position < 0 || position >= 
stack.size)
!                                               {
!                                                       throw new 
InvalidOperationException
!                                                               
(S._("Invalid_BadEnumeratorPosition"));
!                                               }
!                                               return stack.items[stack.size - 
position - 1];
!                                       }
!                               }
! 
!               // Implement the IIterator<T> interface.
!               public bool MovePrev()
!                               {
!                                       if(reset)
!                                       {
!                                               position = stack.size - 1;
!                                               reset = false;
!                                       }
!                                       else
!                                       {
!                                               --position;
!                                       }
!                                       return (position >= 0);
                                }
                public T Current
--- 391,399 ----
                public void Reset()
                                {
                                        position = -1;
                                }
!               public void Remove()
                                {
!                                       throw new 
InvalidOperationException(S._("NotSupp_Remove"));
                                }
                public T Current
***************
*** 520,532 ****
                                                }
                                                return stack.items[stack.size - 
position - 1];
-                                       }
-                                       set
-                                       {
-                                               if(position < 0 || position >= 
stack.size)
-                                               {
-                                                       throw new 
InvalidOperationException
-                                                               
(S._("Invalid_BadIteratorPosition"));
-                                               }
-                                               stack.items[stack.size - 
position - 1] = value;
                                        }
                                }
--- 407,410 ----

Index: CollectionAdapter.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Generics/CollectionAdapter.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** CollectionAdapter.cs        22 Feb 2003 02:56:20 -0000      1.1
--- CollectionAdapter.cs        24 Feb 2003 04:36:26 -0000      1.2
***************
*** 48,55 ****
        public void CopyTo(Array array, int index)
                        {
!                               IEnumerator<T> e = coll.GetEnumerator();
!                               while(e.MoveNext())
                                {
!                                       array.SetValue(e.Current, index++);
                                }
                        }
--- 48,55 ----
        public void CopyTo(Array array, int index)
                        {
!                               IIterator<T> iterator = coll.GetIterator();
!                               while(iterator.MoveNext())
                                {
!                                       array.SetValue(iterator.Current, 
index++);
                                }
                        }
***************
*** 79,83 ****
        public System.Collections.IEnumerator GetEnumerator()
                        {
!                               return new 
EnumeratorAdapter<T>(coll.GetEnumerator());
                        }
  
--- 79,83 ----
        public System.Collections.IEnumerator GetEnumerator()
                        {
!                               return new 
EnumeratorAdapter<T>(coll.GetIterator());
                        }
  

Index: CollectionWrapper.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Generics/CollectionWrapper.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** CollectionWrapper.cs        22 Feb 2003 02:56:20 -0000      1.1
--- CollectionWrapper.cs        24 Feb 2003 04:36:26 -0000      1.2
***************
*** 70,75 ****
                        }
  
!       // Implement the IEnumerable<T> interface.
!       public IEnumerator<T> GetEnumerator()
                        {
                                return new 
EnumeratorWrapper(coll.GetEnumerator());
--- 70,75 ----
                        }
  
!       // Implement the IIterable<T> interface.
!       public IIterator<T> GetIterator()
                        {
                                return new 
EnumeratorWrapper(coll.GetEnumerator());

Index: DictionaryAdapter.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Generics/DictionaryAdapter.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** DictionaryAdapter.cs        22 Feb 2003 02:56:20 -0000      1.1
--- DictionaryAdapter.cs        24 Feb 2003 04:36:26 -0000      1.2
***************
*** 101,105 ****
        public IDictionaryEnumerator GetEnumerator()
                        {
!                               return new 
DictionaryEnumeratorAdapter(dict.GetEnumerator());
                        }
        public void Remove(Object key)
--- 101,105 ----
        public IDictionaryEnumerator GetEnumerator()
                        {
!                               return new 
DictionaryEnumeratorAdapter(dict.GetIterator());
                        }
        public void Remove(Object key)
***************
*** 186,193 ****
        public void CopyTo(Array array, int index)
                        {
!                               IDictionaryEnumerator<KeyT, ValueT> e = 
dict.GetEnumerator();
!                               while(e.MoveNext())
                                {
!                                       array.SetValue(e.Value, index++);
                                }
                        }
--- 186,193 ----
        public void CopyTo(Array array, int index)
                        {
!                               IDictionaryIterator<KeyT, ValueT> iterator = 
dict.GetIterator();
!                               while(iterator.MoveNext())
                                {
!                                       array.SetValue(iterator.Value, index++);
                                }
                        }
***************
*** 219,223 ****
                        {
                                return new EnumeratorAdapter<ValueT>
!                                       
(((ICollection<ValueT>)dict).GetEnumerator());
                        }
  
--- 219,223 ----
                        {
                                return new EnumeratorAdapter<ValueT>
!                                       
(((ICollection<ValueT>)dict).GetIterator());
                        }
  

Index: DictionaryEnumeratorAdapter.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Generics/DictionaryEnumeratorAdapter.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** DictionaryEnumeratorAdapter.cs      22 Feb 2003 02:56:20 -0000      1.1
--- DictionaryEnumeratorAdapter.cs      24 Feb 2003 04:36:26 -0000      1.2
***************
*** 34,41 ****
  
        // Internal state.
!       private IDictionaryEnumerator<KeyT, ValueT> e;
  
        // Constructor.
!       public DictionaryEnumeratorAdapter(IDictionaryEnumerator<KeyT, ValueT> 
e)
                        {
                                if(e == null)
--- 34,41 ----
  
        // Internal state.
!       private IDictionaryIterator<KeyT, ValueT> e;
  
        // Constructor.
!       public DictionaryEnumeratorAdapter(IDictionaryIterator<KeyT, ValueT> e)
                        {
                                if(e == null)

Index: DictionaryEnumeratorWrapper.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Generics/DictionaryEnumeratorWrapper.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** DictionaryEnumeratorWrapper.cs      22 Feb 2003 02:56:20 -0000      1.1
--- DictionaryEnumeratorWrapper.cs      24 Feb 2003 04:36:26 -0000      1.2
***************
*** 30,34 ****
  
  public sealed class DictionaryEnumeratorWrapper<KeyT, ValueT>
!       : IDictionaryEnumerator<KeyT, ValueT>
  {
  
--- 30,34 ----
  
  public sealed class DictionaryEnumeratorWrapper<KeyT, ValueT>
!       : IDictionaryIterator<KeyT, ValueT>
  {
  
***************
*** 47,51 ****
                        }
  
!       // Implement the IEnumerator<ValueT> interface.
        public bool MoveNext()
                        {
--- 47,51 ----
                        }
  
!       // Implement the IIterator<ValueT> interface.
        public bool MoveNext()
                        {
***************
*** 56,59 ****
--- 56,63 ----
                                e.Reset();
                        }
+       public void Remove()
+                       {
+                               throw new 
InvalidOperationException(S._("NotSupp_Remove"));
+                       }
        public ValueT Current
                        {
***************
*** 66,70 ****
                        }
  
!       // Implement the IDictionaryEnumerator<T> interface.
        public DictionaryEntry<KeyT, ValueT> Entry
                        {
--- 70,74 ----
                        }
  
!       // Implement the IDictionaryIterator<KeyT, ValueT> interface.
        public DictionaryEntry<KeyT, ValueT> Entry
                        {

Index: DictionaryWrapper.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Generics/DictionaryWrapper.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** DictionaryWrapper.cs        22 Feb 2003 02:56:20 -0000      1.1
--- DictionaryWrapper.cs        24 Feb 2003 04:36:26 -0000      1.2
***************
*** 56,60 ****
                                return dict.Contains(key);
                        }
!       public IDictionaryEnumerator<KeyT, ValueT> GetEnumerator()
                        {
                                return new DictionaryEnumeratorWrapper<KeyT, 
ValueT>
--- 56,60 ----
                                return dict.Contains(key);
                        }
!       public IDictionaryIterator<KeyT, ValueT> GetIterator()
                        {
                                return new DictionaryEnumeratorWrapper<KeyT, 
ValueT>
***************
*** 132,140 ****
                        }
  
!       // Implement the IEnumerable<ValueT> interface.
!       public IEnumerator<ValueT> IEnumerable<ValueT>.GetEnumerator()
                        {
                                return new EnumeratorWrapper
!                                       
(((IEnumerable<ValueT>)dict).GetEnumerator());
                        }
  
--- 132,140 ----
                        }
  
!       // Implement the IIterable<ValueT> interface.
!       public IIterator<ValueT> IIterable<ValueT>.GetEnumerator()
                        {
                                return new EnumeratorWrapper
!                                       
(((IIterable<ValueT>)dict).GetIterator());
                        }
  

Index: EnumerableAdapter.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Generics/EnumerableAdapter.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** EnumerableAdapter.cs        22 Feb 2003 02:56:20 -0000      1.1
--- EnumerableAdapter.cs        24 Feb 2003 04:36:26 -0000      1.2
***************
*** 32,39 ****
  
        // Internal state.
!       private IEnumerable<T> e;
  
        // Constructor.
!       public EnumerableAdapter(IEnumerable<T> e)
                        {
                                if(e == null)
--- 32,39 ----
  
        // Internal state.
!       private IIterable<T> e;
  
        // Constructor.
!       public EnumerableAdapter(IIterable<T> e)
                        {
                                if(e == null)
***************
*** 47,51 ****
        public IEnumerator GetEnumerator()
                        {
!                               return new 
EnumeratorAdapter<T>(e.GetEnumerator());
                        }
  
--- 47,51 ----
        public IEnumerator GetEnumerator()
                        {
!                               return new 
EnumeratorAdapter<T>(e.GetIterator());
                        }
  

Index: EnumerableWrapper.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Generics/EnumerableWrapper.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** EnumerableWrapper.cs        22 Feb 2003 02:56:20 -0000      1.1
--- EnumerableWrapper.cs        24 Feb 2003 04:36:26 -0000      1.2
***************
*** 29,33 ****
  using System;
  
! public sealed class EnumerableWrapper<T> : IEnumerable<T>
  {
  
--- 29,33 ----
  using System;
  
! public sealed class EnumerableWrapper<T> : IIterable<T>
  {
  
***************
*** 45,50 ****
                        }
  
!       // Implement the IEnumerable<T> interface.
!       public IEnumerator<T> GetEnumerator()
                        {
                                return new 
EnumeratorWrapper<T>(e.GetEnumerator());
--- 45,50 ----
                        }
  
!       // Implement the IIterable<T> interface.
!       public IIterator<T> GetIterator()
                        {
                                return new 
EnumeratorWrapper<T>(e.GetEnumerator());

Index: EnumeratorAdapter.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Generics/EnumeratorAdapter.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** EnumeratorAdapter.cs        22 Feb 2003 02:56:20 -0000      1.1
--- EnumeratorAdapter.cs        24 Feb 2003 04:36:26 -0000      1.2
***************
*** 32,39 ****
  
        // Internal state.
!       private IEnumerator<T> e;
  
        // Constructor.
!       public EnumeratorAdapter(IEnumerator<T> e)
                        {
                                if(e == null)
--- 32,39 ----
  
        // Internal state.
!       private IIterator<T> e;
  
        // Constructor.
!       public EnumeratorAdapter(IIterator<T> e)
                        {
                                if(e == null)

Index: EnumeratorWrapper.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Generics/EnumeratorWrapper.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** EnumeratorWrapper.cs        22 Feb 2003 02:56:20 -0000      1.1
--- EnumeratorWrapper.cs        24 Feb 2003 04:36:26 -0000      1.2
***************
*** 29,33 ****
  using System;
  
! public sealed class EnumeratorWrapper<T> : IEnumerator<T>
  {
  
--- 29,33 ----
  using System;
  
! public sealed class EnumeratorWrapper<T> : IIterator<T>
  {
  
***************
*** 45,49 ****
                        }
  
!       // Implement the IEnumerator<T> interface.
        public bool MoveNext()
                        {
--- 45,49 ----
                        }
  
!       // Implement the IIterator<T> interface.
        public bool MoveNext()
                        {
***************
*** 53,56 ****
--- 53,60 ----
                        {
                                e.Reset();
+                       }
+       public void Remove()
+                       {
+                               throw new 
InvalidOperationException(S._("NotSupp_Remove"));
                        }
        public T Current

Index: Generics.txt
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Generics/Generics.txt,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** Generics.txt        22 Feb 2003 03:54:04 -0000      1.2
--- Generics.txt        24 Feb 2003 04:36:26 -0000      1.3
***************
*** 38,42 ****
  Invalid_UnderlyingModified=The underlying collection has been modified
  Invalid_ValueType=Invalid type for collection value
- Invalid_Enumerator=Enumerator does not belong to the specified collection
  NotSupp_FixedSizeCollection=Operation not supported on fixed sized objects
  NotSupp_ReadOnly=Operation not supported on read-only objects
--- 38,42 ----
  Invalid_UnderlyingModified=The underlying collection has been modified
  Invalid_ValueType=Invalid type for collection value
  NotSupp_FixedSizeCollection=Operation not supported on fixed sized objects
  NotSupp_ReadOnly=Operation not supported on read-only objects
+ NotSupp_Remove=Cannot remove from the specified collection

Index: Hashtable.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Generics/Hashtable.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** Hashtable.cs        22 Feb 2003 02:56:20 -0000      1.1
--- Hashtable.cs        24 Feb 2003 04:36:26 -0000      1.2
***************
*** 29,34 ****
  
  public class Hashtable<KeyT, ValueT>
!       : IDictionary<KeyT, ValueT>, ICollection<ValueT>,
!         IEnumerable<ValueT>, ICloneable
  {
        // Contents of a hash bucket.
--- 29,33 ----
  
  public class Hashtable<KeyT, ValueT>
!       : IDictionary<KeyT, ValueT>, ICollection<ValueT>, ICloneable
  {
        // Contents of a hash bucket.
***************
*** 49,53 ****
        private float loadFactor;
        private HashBucket<KeyT, ValueT>[] table;
-       private int generation;
  
        // Table of the first 400 prime numbers.
--- 48,51 ----
***************
*** 110,114 ****
                                }
                                table = null;
-                               generation = 0;
                        }
        public Hashtable(int capacity)
--- 108,111 ----
***************
*** 141,145 ****
                                        table = null;
                                }
-                               generation = 0;
                        }
        public Hashtable(IHashCodeProvider<KeyT> hcp, IComparer<KeyT> comparer)
--- 138,141 ----
***************
*** 160,164 ****
                                }
                                table = null;
-                               generation = 0;
                        }
        public Hashtable(int capacity, IHashCodeProvider<KeyT> hcp,
--- 156,159 ----
***************
*** 192,196 ****
                                        table = null;
                                }
-                               generation = 0;
                        }
        public Hashtable(IDictionary<KeyT, ValueT> d)
--- 187,190 ----
***************
*** 222,226 ****
                                        table = null;
                                }
-                               generation = 0;
                                AddDictionaryContents(d);
                        }
--- 216,219 ----
***************
*** 254,258 ****
                                        table = null;
                                }
-                               generation = 0;
                                AddDictionaryContents(d);
                        }
--- 247,250 ----
***************
*** 280,284 ****
                                                table = null;
                                        }
-                                       generation = 0;
                                }
                                else
--- 272,275 ----
***************
*** 312,316 ****
                                                table = null;
                                        }
-                                       generation = 0;
                                }
                                else
--- 303,306 ----
***************
*** 342,346 ****
                                                table = null;
                                        }
-                                       generation = 0;
                                        AddDictionaryContents(d);
                                }
--- 332,335 ----
***************
*** 374,378 ****
                                                table = null;
                                        }
-                                       generation = 0;
                                        AddDictionaryContents(d);
                                }
--- 363,366 ----
***************
*** 387,395 ****
        private void AddDictionaryContents(IDictionary<KeyT, ValueT> d)
                        {
!                               IDictionaryEnumerator<KeyT, ValueT> enumerator =
!                                               d.GetEnumerator();
!                               while(enumerator.MoveNext())
                                {
!                                       Add(enumerator.Key, enumerator.Value);
                                }
                        }
--- 375,382 ----
        private void AddDictionaryContents(IDictionary<KeyT, ValueT> d)
                        {
!                               IDictionaryIterator<KeyT, ValueT> iterator = 
d.GetIterator();
!                               while(iterator.MoveNext())
                                {
!                                       Add(iterator.Key, iterator.Value);
                                }
                        }
***************
*** 495,501 ****
                                // Add the new entry to the hash table.
                                AddDirect(key, value);
- 
-                               // Update the generation count.
-                               ++generation;
                        }
  
--- 482,485 ----
***************
*** 592,596 ****
                                                        table[hash].value = 
value;
                                                        ++num;
-                                                       ++generation;
                                                }
                                                return;
--- 576,579 ----
***************
*** 619,625 ****
                                return ContainsKey(key);
                        }
!       public virtual IDictionaryEnumerator<KeyT, ValueT> GetEnumerator()
                        {
!                               return new HashtableEnum<KeyT, ValueT>(this);
                        }
        public virtual void Remove(KeyT key)
--- 602,608 ----
                                return ContainsKey(key);
                        }
!       public virtual IDictionaryIterator<KeyT, ValueT> GetIterator()
                        {
!                               return new HashtableIterator<KeyT, 
ValueT>(this);
                        }
        public virtual void Remove(KeyT key)
***************
*** 640,647 ****
                                        else if(KeyEquals(table[hash].key, key))
                                        {
!                                               table[hash].key = null;
!                                               table[hash].value = null;
                                                --num;
-                                               ++generation;
                                                break;
                                        }
--- 623,628 ----
                                        else if(KeyEquals(table[hash].key, key))
                                        {
!                                               table[hash].hasEntry = false;
                                                --num;
                                                break;
                                        }
***************
*** 720,724 ****
                                                                
table[hash].value = value;
                                                                ++num;
-                                                               ++generation;
                                                        }
                                                        return;
--- 701,704 ----
***************
*** 729,733 ****
                                                        // so replace its value.
                                                        table[hash].value = 
value;
-                                                       ++generation;
                                                        return;
                                                }
--- 709,712 ----
***************
*** 774,781 ****
                        }
  
!       // Implement the IEnumerable<ValueT> interface.
!       IEnumerator IEnumerable<ValueT>.GetEnumerator()
                        {
!                               return new HashtableEnum<KeyT, ValueT>(this);
                        }
  
--- 753,760 ----
                        }
  
!       // Implement the IIterable<ValueT> interface.
!       IIterator IIterable<ValueT>.GetIterator()
                        {
!                               return new HashtableIterator<KeyT, 
ValueT>(this);
                        }
  
***************
*** 899,907 ****
        //
        // Note: We lock every operation on the underlying hash table,
!       // even if it is a read or enumerator operation.  This is because
        // we cannot guarantee correct behaviour in symmetric multi-processing
        // environments if we only lock write operations.
        private sealed class SynchronizedHashtable<KeyT, ValueT>
!                       : Hashtable<KeyT, ValueT>, IEnumerable<ValueT>
        {
                // Internal state.
--- 878,886 ----
        //
        // Note: We lock every operation on the underlying hash table,
!       // even if it is a read or iterator operation.  This is because
        // we cannot guarantee correct behaviour in symmetric multi-processing
        // environments if we only lock write operations.
        private sealed class SynchronizedHashtable<KeyT, ValueT>
!                       : Hashtable<KeyT, ValueT>
        {
                // Internal state.
***************
*** 979,988 ****
                                        }
                                }
!               public override IDictionaryEnumerator<KeyT, ValueT> 
GetEnumerator()
                                {
                                        lock(SyncRoot)
                                        {
!                                               return new 
SynchronizedDictEnumerator<KeyT, ValueT>
!                                                       (SyncRoot, 
table.GetEnumerator());
                                        }
                                }
--- 958,967 ----
                                        }
                                }
!               public override IDictionaryIterator<KeyT, ValueT> GetIterator()
                                {
                                        lock(SyncRoot)
                                        {
!                                               return new 
SynchronizedDictIterator<KeyT, ValueT>
!                                                       (SyncRoot, 
table.GetIterator());
                                        }
                                }
***************
*** 1052,1063 ****
                                }
        
!               // Implement the IEnumerable<ValueT> interface.
!               IEnumerator IEnumerable<ValueT>.GetEnumerator()
                                {
                                        lock(SyncRoot)
                                        {
!                                               return new 
SynchronizedEnumerator<ValueT>
!                                                       (SyncRoot, 
((IEnumerable<ValueT>)table)
!                                                                               
        .GetEnumerator());
                                        }
                                }
--- 1031,1042 ----
                                }
        
!               // Implement the IIterable<ValueT> interface.
!               IIterator IIterable<ValueT>.GetIterator()
                                {
                                        lock(SyncRoot)
                                        {
!                                               return new 
SynchronizedIterator<ValueT>
!                                                       (SyncRoot, 
((IIterable<ValueT>)table)
!                                                                               
        .GetIterator());
                                        }
                                }
***************
*** 1125,1153 ****
        }; // SynchronizedHashtable<KeyT, ValueT>
  
!       // Hashtable collection and dictionary enumerator.
!       private class HashtableEnum<KeyT, ValueT>
!               : IDictionaryEnumerator<KeyT, ValueT>
        {
                // Internal state.
                protected Hashtable<KeyT, ValueT> table;
-               protected int       generation;
                protected int           posn;
  
                // Constructor.
!               public HashtableEnum(Hashtable<KeyT, ValueT> table)
                                {
                                        this.table = table;
-                                       generation = table.generation;
                                        posn = -1;
                                }
  
!               // Implement the IEnumerator<ValueT> interface.
                public bool MoveNext()
                                {
-                                       if(table.generation != generation)
-                                       {
-                                               throw new 
InvalidOperationException
-                                                       
(S._("Invalid_CollectionModified"));
-                                       }
                                        while(++posn < table.capacity)
                                        {
--- 1104,1125 ----
        }; // SynchronizedHashtable<KeyT, ValueT>
  
!       // Hashtable collection and dictionary iterator.
!       private class HashtableIterator<KeyT, ValueT>
!               : IDictionaryIterator<KeyT, ValueT>
        {
                // Internal state.
                protected Hashtable<KeyT, ValueT> table;
                protected int           posn;
  
                // Constructor.
!               public HashtableIterator(Hashtable<KeyT, ValueT> table)
                                {
                                        this.table = table;
                                        posn = -1;
                                }
  
!               // Implement the IIterator<ValueT> interface.
                public bool MoveNext()
                                {
                                        while(++posn < table.capacity)
                                        {
***************
*** 1162,1171 ****
                public void Reset()
                                {
!                                       if(table.generation != generation)
                                        {
                                                throw new 
InvalidOperationException
!                                                       
(S._("Invalid_CollectionModified"));
                                        }
!                                       posn = -1;
                                }
                public ValueT Current
--- 1134,1149 ----
                public void Reset()
                                {
!                                       posn = -1;
!                               }
!               public void Remove()
!                               {
!                                       if(posn < 0 || posn >= table.capacity ||
!                                          !(table.table[posn].hasEntry))
                                        {
                                                throw new 
InvalidOperationException
!                                                       
(S._("Invalid_BadIteratorPosition"));
                                        }
!                                       table.table[posn].hasEntry = false;
!                                       --(table.num);
                                }
                public ValueT Current
***************
*** 1177,1194 ****
                                }
  
!               // Implement the IDictionaryEnumerator<KeyT, ValueT> interface.
                public DictionaryEntry<KeyT, ValueT> Entry
                                {
                                        get
                                        {
!                                               if(table.generation != 
generation)
                                                {
                                                        throw new 
InvalidOperationException
!                                                               
(S._("Invalid_CollectionModified"));
!                                               }
!                                               if(posn < 0 || posn >= 
table.capacity)
!                                               {
!                                                       throw new 
InvalidOperationException
!                                                               
(S._("Invalid_BadEnumeratorPosition"));
                                                }
                                                return new 
DictionaryEntry<KeyT, ValueT>
--- 1155,1168 ----
                                }
  
!               // Implement the IDictionaryIterator<KeyT, ValueT> interface.
                public DictionaryEntry<KeyT, ValueT> Entry
                                {
                                        get
                                        {
!                                               if(posn < 0 || posn >= 
table.capacity ||
!                                              !(table.table[posn].hasEntry))
                                                {
                                                        throw new 
InvalidOperationException
!                                                               
(S._("Invalid_BadIteratorPosition"));
                                                }
                                                return new 
DictionaryEntry<KeyT, ValueT>
***************
*** 1201,1213 ****
                                        get
                                        {
!                                               if(table.generation != 
generation)
                                                {
                                                        throw new 
InvalidOperationException
!                                                               
(S._("Invalid_CollectionModified"));
!                                               }
!                                               if(posn < 0 || posn >= 
table.capacity)
!                                               {
!                                                       throw new 
InvalidOperationException
!                                                               
(S._("Invalid_BadEnumeratorPosition"));
                                                }
                                                return table.table[posn].key;
--- 1175,1183 ----
                                        get
                                        {
!                                               if(posn < 0 || posn >= 
table.capacity ||
!                                              !(table.table[posn].hasEntry))
                                                {
                                                        throw new 
InvalidOperationException
!                                                               
(S._("Invalid_BadIteratorPosition"));
                                                }
                                                return table.table[posn].key;
***************
*** 1218,1236 ****
                                        get
                                        {
!                                               if(table.generation != 
generation)
                                                {
                                                        throw new 
InvalidOperationException
!                                                               
(S._("Invalid_CollectionModified"));
                                                }
!                                               if(posn < 0 || posn >= 
table.capacity)
                                                {
                                                        throw new 
InvalidOperationException
!                                                               
(S._("Invalid_BadEnumeratorPosition"));
                                                }
!                                               return table.table[posn].value;
                                        }
                                }
  
!       }; // HashtableEnum<KeyT, ValueT>
  
  }; // class Hashtable<KeyT, ValueT>
--- 1188,1212 ----
                                        get
                                        {
!                                               if(posn < 0 || posn >= 
table.capacity ||
!                                              !(table.table[posn].hasEntry))
                                                {
                                                        throw new 
InvalidOperationException
!                                                               
(S._("Invalid_BadIteratorPosition"));
                                                }
!                                               return table.table[posn].value;
!                                       }
!                                       set
!                                       {
!                                               if(posn < 0 || posn >= 
table.capacity ||
!                                              !(table.table[posn].hasEntry))
                                                {
                                                        throw new 
InvalidOperationException
!                                                               
(S._("Invalid_BadIteratorPosition"));
                                                }
!                                               table.table[posn].value = value;
                                        }
                                }
  
!       }; // HashtableIterator<KeyT, ValueT>
  
  }; // class Hashtable<KeyT, ValueT>

Index: ICollection.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Generics/ICollection.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** ICollection.cs      22 Feb 2003 02:56:20 -0000      1.1
--- ICollection.cs      24 Feb 2003 04:36:26 -0000      1.2
***************
*** 28,32 ****
  using System;
  
! public interface ICollection<T> : IEnumerable<T>
  {
  
--- 28,32 ----
  using System;
  
! public interface ICollection<T> : IIterable<T>
  {
  

Index: IDictionary.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Generics/IDictionary.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** IDictionary.cs      22 Feb 2003 02:56:20 -0000      1.1
--- IDictionary.cs      24 Feb 2003 04:36:26 -0000      1.2
***************
*** 28,33 ****
  using System;
  
! public interface IDictionary<KeyT, ValueT>
!       : IEnumerable<ValueT>, ICollection<ValueT>
  {
  
--- 28,32 ----
  using System;
  
! public interface IDictionary<KeyT, ValueT> : ICollection<ValueT>
  {
  
***************
*** 35,39 ****
        void Clear();
        bool Contains(KeyT key);
!       new IDictionaryEnumerator<KeyT, ValueT> GetEnumerator();
        void Remove(KeyT key);
        bool IsFixedSize { get; }
--- 34,38 ----
        void Clear();
        bool Contains(KeyT key);
!       new IDictionaryIterator<KeyT, ValueT> GetIterator();
        void Remove(KeyT key);
        bool IsFixedSize { get; }

Index: IIterator.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Generics/IIterator.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** IIterator.cs        22 Feb 2003 02:56:20 -0000      1.1
--- IIterator.cs        24 Feb 2003 04:36:26 -0000      1.2
***************
*** 28,39 ****
  using System;
  
! // Iterators are similar to enumerators, except that they are writable,
! // and it is possible to move both forwards and backwards.
! 
! public interface IIterator<T> : IEnumerator<T>
  {
  
!       bool MovePrev();
!       new T Current { get; set; }
  
  }; // interface IIterator<T>
--- 28,46 ----
  using System;
  
! public interface IIterator<T>
  {
  
!       // Move to the next element in the current iteration.
!       bool MoveNext();
! 
!       // Reset the iterator back to its starting position.
!       void Reset();
! 
!       // Remove the current element (InvalidOperationException if not 
supported).
!       // The iterator is invalid until the next call to "MoveNext".
!       void Remove();
! 
!       // Get the value of the current element.
!       T Current { get; }
  
  }; // interface IIterator<T>

Index: IList.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Generics/IList.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** IList.cs    22 Feb 2003 02:56:20 -0000      1.1
--- IList.cs    24 Feb 2003 04:36:26 -0000      1.2
***************
*** 28,32 ****
  using System;
  
! public interface IList<T> : ICollection<T>, IEnumerable<T>, IIterable<T>
  {
  
--- 28,32 ----
  using System;
  
! public interface IList<T> : ICollection<T>
  {
  
***************
*** 34,37 ****
--- 34,38 ----
        void Clear();
        bool Contains(T value);
+       new IListIterator<T> GetIterator();
        int  IndexOf(T value);
        void Insert(int index, T value);

Index: IQueue.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Generics/IQueue.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** IQueue.cs   22 Feb 2003 05:15:31 -0000      1.1
--- IQueue.cs   24 Feb 2003 04:36:26 -0000      1.2
***************
*** 28,32 ****
  using System;
  
! public interface IQueue<T> : ICollection<T>, IEnumerable<T>, IIterable<T>
  {
        void Enqueue(T value);
--- 28,32 ----
  using System;
  
! public interface IQueue<T> : ICollection<T>
  {
        void Enqueue(T value);

Index: IStack.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Generics/IStack.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** IStack.cs   22 Feb 2003 04:16:56 -0000      1.1
--- IStack.cs   24 Feb 2003 04:36:26 -0000      1.2
***************
*** 28,32 ****
  using System;
  
! public interface IStack<T> : ICollection<T>, IEnumerable<T>, IIterable<T>
  {
        void Push(T value);
--- 28,32 ----
  using System;
  
! public interface IStack<T> : ICollection<T>
  {
        void Push(T value);

Index: LinkedList.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Generics/LinkedList.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** LinkedList.cs       22 Feb 2003 03:54:04 -0000      1.1
--- LinkedList.cs       24 Feb 2003 04:36:26 -0000      1.2
***************
*** 28,33 ****
  using System;
  
! public class LinkedList<T>
!       : ICollection<T>, IList<T>, IEnumerable<T>, IIterable<T>, ICloneable
  {
        // Structure of a list node.
--- 28,32 ----
  using System;
  
! public class LinkedList<T> : ICollection<T>, IList<T>, IIterable<T>, 
ICloneable
  {
        // Structure of a list node.
***************
*** 133,140 ****
        public virtual void CopyTo(T[] array, int index)
                        {
!                               IEnumerator<T> e = GetEnumerator();
!                               while(e.MoveNext())
                                {
!                                       array[index++] = e.Current;
                                }
                        }
--- 132,139 ----
        public virtual void CopyTo(T[] array, int index)
                        {
!                               IIterator<T> iterator = GetIterator();
!                               while(iterator.MoveNext())
                                {
!                                       array[index++] = iterator.Current;
                                }
                        }
***************
*** 214,217 ****
--- 213,220 ----
                                }
                        }
+       public virtual IListIterator<T> GetIterator()
+                       {
+                               return new ListIterator<T>(this);
+                       }
        public virtual int IndexOf(T value)
                        {
***************
*** 340,353 ****
                        }
  
-       // Implement the IEnumerable<T> interface.
-       public virtual IEnumerator<T> GetEnumerator()
-                       {
-                               return new ListEnumerator<T>(this);
-                       }
- 
        // Implement the IIterable<T> interface.
!       public virtual IIterator<T> GetIterator()
                        {
!                               return new ListEnumerator<T>(this);
                        }
  
--- 343,350 ----
                        }
  
        // Implement the IIterable<T> interface.
!       IIterator<T> IIterator<T>.GetIterator()
                        {
!                               return GetIterator();
                        }
  
***************
*** 356,360 ****
                        {
                                LinkedList<T> clone = new LinkedList<T>();
!                               IEnumerator<T> e = GetEnumerator();
                                while(e.MoveNext())
                                {
--- 353,357 ----
                        {
                                LinkedList<T> clone = new LinkedList<T>();
!                               IIterator<T> e = GetIterator();
                                while(e.MoveNext())
                                {
***************
*** 454,534 ****
                        }
  
-       // Validate that an enumerator belongs to this list and is not reset.
-       private ListEnumerator<T> ValidateEnumerator
-                                       (IEnumerator<T> e, bool resetOk)
-                       {
-                               if(e == null)
-                               {
-                                       throw new ArgumentNullException("e");
-                               }
-                               ListEnumerator<T> le = (e as ListEnumerator<T>);
-                               if(le == null || le.list != this ||
-                                  (!resetOk && (le.reset || le.posn == null)))
-                               {
-                                       throw new InvalidOperationException
-                                               (S._("Invalid_Enumerator"));
-                               }
-                               return le;
-                       }
- 
-       // Insert a data item just before the current position
-       // that is expressed by an enumerator.  If the enumerator
-       // position is invalid, then this will insert at the
-       // front of the list.
-       public virtual void InsertBefore(IEnumerator<T> e, T data)
-                       {
-                               ListEnumerator<T> le = ValidateEnumerator(e, 
true);
-                               if(le != null)
-                               {
-                                       InsertBefore(le.posn, data);
-                               }
-                               else
-                               {
-                                       AddFirst(data);
-                               }
-                       }
- 
-       // Insert a data item just after the current position
-       // that is expressed by an enumerator.  If the enumerator
-       // position is invalid, then this will insert at the
-       // end of the list.
-       public virtual void InsertAfter(IEnumerator<T> e, T data)
-                       {
-                               ListEnumerator<T> le = ValidateEnumerator(e, 
true);
-                               if(le != null && le.posn.next != null)
-                               {
-                                       InsertBefore(le.posn.next, data);
-                               }
-                               else
-                               {
-                                       AddLast(data);
-                               }
-                       }
- 
-       // Remove the item at the current position that is expressed
-       // by an enumerator.  The enumerator's position will be updated
-       // to point at the next item in the list.  Returns false if
-       // there is no next item.
-       public virtual bool Remove(IEnumerator<T> e)
-                       {
-                               ListEnumerator<T> le = ValidateEnumerator(e, 
false);
-                               Node<T> node = le.posn;
-                               le.posn = node.next;
-                               Remove(node);
-                               return (le.posn != null);
-                       }
- 
-       // Remove the item at the current position and move the
-       // enumerator to the previous item instead of the next.
-       // Returns false if there is no previous item.
-       public virtual bool RemoveAndMoveToPrev(IEnumerator<T> e)
-                       {
-                               ListEnumerator<T> le = ValidateEnumerator(e, 
false);
-                               Node<T> node = le.posn;
-                               le.posn = node.prev;
-                               Remove(node);
-                               return (le.posn != null);
-                       }
- 
        // Wrap a list to make it synchronized.
        public static LinkedList<T> Synchronized<T>(LinkedList<T> list)
--- 451,454 ----
***************
*** 551,571 ****
                        }
  
!       // Enumerator and iterator class for lists.
!       private class ListEnumerator<T> : IEnumerator<T>, IIterator<T>
        {
                // Internal state, accessible to "LinkedList<T>".
                public LinkedList<T> list;
                public Node<T> posn;
                public bool    reset;
  
                // Constructor.
!               public ListEnumerator(LinkedList<T> list)
                                {
                                        this.list = list;
                                        this.posn = null;
                                        this.reset = true;
                                }
  
!               // Implement the IEnumerator<T> interface.
                public bool MoveNext()
                                {
--- 471,495 ----
                        }
  
!       // Iterator class for lists.
!       private class ListIterator<T> : IListIterator<T>
        {
                // Internal state, accessible to "LinkedList<T>".
                public LinkedList<T> list;
                public Node<T> posn;
+               public int     index;
                public bool    reset;
+               public bool    removed;
  
                // Constructor.
!               public ListIterator(LinkedList<T> list)
                                {
                                        this.list = list;
                                        this.posn = null;
+                                       this.index = -1;
                                        this.reset = true;
+                                       this.removed = false;
                                }
  
!               // Implement the IIterator<T> interface.
                public bool MoveNext()
                                {
***************
*** 573,576 ****
--- 497,501 ----
                                        {
                                                posn = list.first;
+                                               index = 0;
                                                reset = false;
                                        }
***************
*** 578,582 ****
--- 503,512 ----
                                        {
                                                posn = posn.next;
+                                               if(!removed)
+                                               {
+                                                       ++index;
+                                               }
                                        }
+                                       removed = false;
                                        return (posn != null);
                                }
***************
*** 584,597 ****
                                {
                                        posn = null;
                                        reset = true;
                                }
!               T IEnumerator<T>.Current
                                {
                                        get
                                        {
!                                               if(posn == null)
                                                {
                                                        throw new 
InvalidOperationException
!                                                               
(S._("Invalid_BadEnumeratorPosition"));
                                                }
                                                return posn.data;
--- 514,539 ----
                                {
                                        posn = null;
+                                       index = -1;
                                        reset = true;
+                                       removed = false;
                                }
!               public void Remove()
!                               {
!                                       if(posn == null || removed)
!                                       {
!                                               throw new 
InvalidOperationException
!                                                       
(S._("Invalid_BadIteratorPosition"));
!                                       }
!                                       list.Remove(posn);
!                                       removed = true;
!                               }
!               T IIterator<T>.Current
                                {
                                        get
                                        {
!                                               if(posn == null || removed)
                                                {
                                                        throw new 
InvalidOperationException
!                                                               
(S._("Invalid_BadIteratorPosition"));
                                                }
                                                return posn.data;
***************
*** 599,603 ****
                                }
  
!               // Implement the IIterator<T> interface.
                public bool MovePrev()
                                {
--- 541,545 ----
                                }
  
!               // Implement the IListIterator<T> interface.
                public bool MovePrev()
                                {
***************
*** 605,608 ****
--- 547,551 ----
                                        {
                                                posn = list.last;
+                                               index = list.count - 1;
                                                reset = false;
                                        }
***************
*** 610,621 ****
                                        {
                                                posn = posn.prev;
                                        }
                                        return (posn != null);
                                }
                public T Current
                                {
                                        get
                                        {
!                                               if(posn == null)
                                                {
                                                        throw new 
InvalidOperationException
--- 553,577 ----
                                        {
                                                posn = posn.prev;
+                                               --index;
                                        }
                                        return (posn != null);
                                }
+               public int Position
+                               {
+                                       get
+                                       {
+                                               if(posn == null || removed)
+                                               {
+                                                       throw new 
InvalidOperationException
+                                                               
(S._("Invalid_BadIteratorPosition"));
+                                               }
+                                               return index;
+                                       }
+                               }
                public T Current
                                {
                                        get
                                        {
!                                               if(posn == null || removed)
                                                {
                                                        throw new 
InvalidOperationException
***************
*** 626,630 ****
                                        set
                                        {
!                                               if(posn == null)
                                                {
                                                        throw new 
InvalidOperationException
--- 582,586 ----
                                        set
                                        {
!                                               if(posn == null || removed)
                                                {
                                                        throw new 
InvalidOperationException
***************
*** 635,639 ****
                                }
  
!       }; // class ListEnumerator<T>
  
        // Wrapper class for synchronized lists.
--- 591,595 ----
                                }
  
!       }; // class ListIterator<T>
  
        // Wrapper class for synchronized lists.
***************
*** 702,705 ****
--- 658,669 ----
                                        }
                                }
+               public override IListIterator<T> GetIterator()
+                               {
+                                       lock(SyncRoot)
+                                       {
+                                               return new 
SynchronizedListIterator
+                                                       (list.GetIterator());
+                                       }
+                               }
                public override int IndexOf(T value)
                                {
***************
*** 767,786 ****
                                        }
                                }
-               public override IEnumerator<T> GetEnumerator()
-                               {
-                                       lock(SyncRoot)
-                                       {
-                                               return new 
SynchronizedEnumerator<T>
-                                                       (list.GetEnumerator());
-                                       }
-                               }
-               public override IIterator<T> GetIterator()
-                               {
-                                       lock(SyncRoot)
-                                       {
-                                               return new 
SynchronizedIterator<T>
-                                                       (list.GetIterator());
-                                       }
-                               }
                public override Object Clone()
                                {
--- 731,734 ----
***************
*** 819,850 ****
                                        }
                                }
-               public override void InsertBefore(IEnumerator<T> e, T data)
-                               {
-                                       lock(SyncRoot)
-                                       {
-                                               list.InsertBefore(e, data);
-                                       }
-                               }
-               public override void InsertAfter(IEnumerator<T> e, T data)
-                               {
-                                       lock(SyncRoot)
-                                       {
-                                               list.InsertAfter(e, data);
-                                       }
-                               }
-               public override bool Remove(IEnumerator<T> e)
-                               {
-                                       lock(SyncRoot)
-                                       {
-                                               return list.Remove(e);
-                                       }
-                               }
-               public override bool RemoveAndMoveToPrev(IEnumerator<T> e)
-                               {
-                                       lock(SyncRoot)
-                                       {
-                                               return 
list.RemoveAndMoveToPrev(e);
-                                       }
-                               }
  
        }; // class SynchronizedList<T>
--- 767,770 ----
***************
*** 902,905 ****
--- 822,829 ----
                                        return list.Contains(value);
                                }
+               public override IListIterator<T> GetIterator()
+                               {
+                                       return new 
ReadOnlyListIterator(list.GetIterator());
+                               }
                public override int IndexOf(T value)
                                {
***************
*** 947,958 ****
                                        }
                                }
-               public override IEnumerator<T> GetEnumerator()
-                               {
-                                       return list.GetEnumerator();
-                               }
-               public override IIterator<T> GetIterator()
-                               {
-                                       return new 
ReadOnlyIterator<T>(list.GetIterator());
-                               }
                public override Object Clone()
                                {
--- 871,874 ----
***************
*** 979,1002 ****
                                }
                public override T RemoveFirst()
-                               {
-                                       throw new InvalidOperationException
-                                               (S._("NotSupp_ReadOnly"));
-                               }
-               public override void InsertBefore(IEnumerator<T> e, T data)
-                               {
-                                       throw new InvalidOperationException
-                                               (S._("NotSupp_ReadOnly"));
-                               }
-               public override void InsertAfter(IEnumerator<T> e, T data)
-                               {
-                                       throw new InvalidOperationException
-                                               (S._("NotSupp_ReadOnly"));
-                               }
-               public override bool Remove(IEnumerator<T> e)
-                               {
-                                       throw new InvalidOperationException
-                                               (S._("NotSupp_ReadOnly"));
-                               }
-               public override bool RemoveAndMoveToPrev(IEnumerator<T> e)
                                {
                                        throw new InvalidOperationException
--- 895,898 ----

Index: ListAdapter.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Generics/ListAdapter.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** ListAdapter.cs      22 Feb 2003 02:56:20 -0000      1.1
--- ListAdapter.cs      24 Feb 2003 04:36:26 -0000      1.2
***************
*** 155,162 ****
        public void CopyTo(Array array, int index)
                        {
!                               IEnumerator<T> e = list.GetEnumerator();
!                               while(e.MoveNext())
                                {
!                                       array.SetValue(e.Current, index++);
                                }
                        }
--- 155,162 ----
        public void CopyTo(Array array, int index)
                        {
!                               IIterator<T> iterator = list.GetIterator();
!                               while(iterator.MoveNext())
                                {
!                                       array.SetValue(iterator.Current, 
index++);
                                }
                        }
***************
*** 186,190 ****
        public System.Collections.IEnumerator GetEnumerator()
                        {
!                               return new 
EnumeratorAdapter<T>(list.GetEnumerator());
                        }
  
--- 186,190 ----
        public System.Collections.IEnumerator GetEnumerator()
                        {
!                               return new 
EnumeratorAdapter<T>(list.GetIterator());
                        }
  

Index: ListWrapper.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Generics/ListWrapper.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** ListWrapper.cs      22 Feb 2003 02:56:20 -0000      1.1
--- ListWrapper.cs      24 Feb 2003 04:36:26 -0000      1.2
***************
*** 28,33 ****
  using System;
  
! public sealed class ListWrapper<T>
!       : IList<T>, ICollection<T>, IEnumerable<T>, IIterable<T>
  {
  
--- 28,32 ----
  using System;
  
! public sealed class ListWrapper<T> : IList<T>, ICollection<T>
  {
  
***************
*** 58,61 ****
--- 57,64 ----
                                return list.Contains(value);
                        }
+       public IListIterator<T> GetIterator()
+                       {
+                               return new ListIterator<T>(list);
+                       }
        public int IndexOf(T value)
                        {
***************
*** 127,138 ****
                        }
  
-       // Implement the IEnumerable<T> interface.
-       public IEnumerator<T> GetEnumerator()
-                       {
-                               return new 
EnumeratorWrapper<T>(list.GetEnumerator());
-                       }
- 
        // Implement the IIterable<T> interface.
!       public IIterator<T> GetIterator()
                        {
                                return new ListIterator<T>(list);
--- 130,135 ----
                        }
  
        // Implement the IIterable<T> interface.
!       IIterator<T> IIterable<T>.GetIterator()
                        {
                                return new ListIterator<T>(list);
***************
*** 140,148 ****
  
        // Private list iterator implementation.
!       private sealed class ListIterator<T> : IEnumerator<T>, IIterator<T>
        {
                // Internal state.
                private IList list;
                private int posn;
                private bool reset;
  
--- 137,146 ----
  
        // Private list iterator implementation.
!       private sealed class ListIterator<T> : IListIterator<T>
        {
                // Internal state.
                private IList list;
                private int posn;
+               private int removed;
                private bool reset;
  
***************
*** 152,159 ****
                                        this.list = list;
                                        posn = -1;
                                        reset = true;
                                }
  
!               // Implement the IEnumerator<T> interface.
                public bool MoveNext()
                                {
--- 150,158 ----
                                        this.list = list;
                                        posn = -1;
+                                       removed = -1;
                                        reset = true;
                                }
  
!               // Implement the IIterator<T> interface.
                public bool MoveNext()
                                {
***************
*** 161,168 ****
                                        {
                                                // Start at the beginning of 
the list.
!                                               posn = -1;
                                                reset = false;
                                        }
!                                       ++posn;
                                        return (posn < list.Count);
                                }
--- 160,176 ----
                                        {
                                                // Start at the beginning of 
the list.
!                                               posn = 0;
                                                reset = false;
                                        }
!                                       else if(removed != -1)
!                                       {
!                                               // An item was removed, so 
re-visit this position.
!                                               position = removed;
!                                               removed = -1;
!                                       }
!                                       else
!                                       {
!                                               ++posn;
!                                       }
                                        return (posn < list.Count);
                                }
***************
*** 170,180 ****
                                {
                                        posn = -1;
                                        reset = true;
                                }
!               T IEnumertor<T>.Current
                                {
                                        get
                                        {
!                                               if(posn >= 0 && posn < 
list.Count)
                                                {
                                                        return (T)(list[posn]);
--- 178,202 ----
                                {
                                        posn = -1;
+                                       removed = -1;
                                        reset = true;
                                }
!               public void Remove()
!                               {
!                                       if(posn >= 0 && posn < list.Count)
!                                       {
!                                               list.RemoveAt(posn);
!                                               removed = posn;
!                                       }
!                                       else
!                                       {
!                                               throw new 
InvalidOperationException
!                                                       
(S._("Invalid_BadIteratorPosition"));
!                                       }
!                               }
!               T IIterator<T>.Current
                                {
                                        get
                                        {
!                                               if(posn >= 0 && posn < 
list.Count && removed == -1)
                                                {
                                                        return (T)(list[posn]);
***************
*** 188,192 ****
                                }
  
!               // Implement the IIterator<T> interface.
                public bool MovePrev()
                                {
--- 210,214 ----
                                }
  
!               // Implement the IListIterator<T> interface.
                public bool MovePrev()
                                {
***************
*** 194,208 ****
                                        {
                                                // Start at the end of the list.
!                                               posn = list.Count;
                                                reset = false;
                                        }
!                                       --posn;
                                        return (posn >= 0);
                                }
                public T Current
                                {
                                        get
                                        {
!                                               if(posn >= 0 && posn < 
list.Count)
                                                {
                                                        return (T)(list[posn]);
--- 216,254 ----
                                        {
                                                // Start at the end of the list.
!                                               posn = list.Count - 1;
                                                reset = false;
                                        }
!                                       else if(removed != -1)
!                                       {
!                                               // An item was removed, so move 
to just before it.
!                                               position = removed - 1;
!                                               removed = -1;
!                                       }
!                                       else
!                                       {
!                                               --posn;
!                                       }
                                        return (posn >= 0);
                                }
+               public int Position
+                               {
+                                       get
+                                       {
+                                               if(posn >= 0 && posn < 
list.Count && removed == -1)
+                                               {
+                                                       return posn;
+                                               }
+                                               else
+                                               {
+                                                       throw new 
InvalidOperationException
+                                                               
(S._("Invalid_BadIteratorPosition"));
+                                               }
+                                       }
+                               }
                public T Current
                                {
                                        get
                                        {
!                                               if(posn >= 0 && posn < 
list.Count && removed == -1)
                                                {
                                                        return (T)(list[posn]);
***************
*** 216,220 ****
                                        set
                                        {
!                                               if(posn >= 0 && posn < 
list.Count)
                                                {
                                                        list[posn] = value;
--- 262,266 ----
                                        set
                                        {
!                                               if(posn >= 0 && posn < 
list.Count && removed == -1)
                                                {
                                                        list[posn] = value;

Index: ReadOnlyIterator.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Generics/ReadOnlyIterator.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** ReadOnlyIterator.cs 22 Feb 2003 03:54:04 -0000      1.1
--- ReadOnlyIterator.cs 24 Feb 2003 04:36:26 -0000      1.2
***************
*** 24,28 ****
  using System;
  
! internal sealed class ReadOnlyIterator<T> : IEnumerator<T>, IIterator<T>
  {
        // Internal state.
--- 24,28 ----
  using System;
  
! internal sealed class ReadOnlyIterator<T> : IIterator<T>
  {
        // Internal state.
***************
*** 35,39 ****
                        }
  
!       // Implement the IEnumerator<T> interface.
        public bool MoveNext()
                        {
--- 35,39 ----
                        }
  
!       // Implement the IIterator<T> interface.
        public bool MoveNext()
                        {
***************
*** 44,59 ****
                                iterator.Reset();
                        }
!       T IEnumerator<T>.Current
!                       {
!                               get
!                               {
!                                       return 
((IEnumerator<T>)iterator).Current;
!                               }
!                       }
! 
!       // Implement the IIterator<T> interface.
!       public bool MovePrev()
                        {
!                               return iterator.MovePrev();
                        }
        public T Current
--- 44,50 ----
                                iterator.Reset();
                        }
!       public void Remove()
                        {
!                               throw new 
InvalidOperationException(S._("NotSupp_ReadOnly"));
                        }
        public T Current
***************
*** 62,70 ****
                                {
                                        return iterator.Current;
-                               }
-                               set
-                               {
-                                       throw new InvalidOperationException
-                                               (S._("NotSupp_ReadOnly"));
                                }
                        }
--- 53,56 ----

Index: ReverseIterator.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Generics/ReverseIterator.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** ReverseIterator.cs  22 Feb 2003 02:56:20 -0000      1.1
--- ReverseIterator.cs  24 Feb 2003 04:36:26 -0000      1.2
***************
*** 24,70 ****
  using System;
  
! public sealed class ReverseIterator<T> : IEnumerator<T>, IIterator<T>
  {
        // Internal state.
!       protected IIterator<T> iterator;
  
        // Constructor.
!       public ReverseIterator(IIterator<T> iterator)
                        {
                                this.iterator = iterator;
                        }
  
!       // Implement the IEnumerator<T> interface.
        public bool MoveNext()
                        {
!                               lock(syncRoot)
!                               {
!                                       return iterator.MovePrev();
!                               }
                        }
        public void Reset()
                        {
!                               lock(syncRoot)
!                               {
!                                       iterator.Reset();
!                               }
                        }
!       T IEnumerator<T>.Current
                        {
                                get
                                {
!                                       lock(syncRoot)
!                                       {
!                                               return 
((IEnumerator<T>)iterator).Current;
!                                       }
                                }
                        }
  
!       // Implement the IIterator<T> interface.
        public bool MovePrev()
                        {
!                               lock(syncRoot)
                                {
!                                       return iterator.MoveNext();
                                }
                        }
--- 24,69 ----
  using System;
  
! public sealed class ReverseIterator<T> : IListIterator<T>
  {
        // Internal state.
!       protected IListIterator<T> iterator;
  
        // Constructor.
!       public ReverseIterator(IListIterator<T> iterator)
                        {
                                this.iterator = iterator;
                        }
  
!       // Implement the IIterator<T> interface.
        public bool MoveNext()
                        {
!                               return iterator.MovePrev();
                        }
        public void Reset()
                        {
!                               iterator.Reset();
                        }
!       public void Remove()
!                       {
!                               iterator.Remove();
!                       }
!       T IIterator<T>.Current
                        {
                                get
                                {
!                                       return ((IIterator<T>)iterator).Current;
                                }
                        }
  
!       // Implement the IListIterator<T> interface.
        public bool MovePrev()
                        {
!                               return iterator.MoveNext();
!                       }
!       public int Position
!                       {
!                               get
                                {
!                                       return iterator.Position;
                                }
                        }
***************
*** 73,87 ****
                                get
                                {
!                                       lock(syncRoot)
!                                       {
!                                               return iterator.Current;
!                                       }
                                }
                                set
                                {
!                                       lock(syncRoot)
!                                       {
!                                               iterator.Current = value;
!                                       }
                                }
                        }
--- 72,80 ----
                                get
                                {
!                                       return iterator.Current;
                                }
                                set
                                {
!                                       iterator.Current = value;
                                }
                        }

Index: SynchronizedIterator.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Generics/SynchronizedIterator.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** SynchronizedIterator.cs     22 Feb 2003 02:56:20 -0000      1.1
--- SynchronizedIterator.cs     24 Feb 2003 04:36:26 -0000      1.2
***************
*** 24,28 ****
  using System;
  
! internal sealed class SynchronizedIterator<T> : IEnumerator<T>, IIterator<T>
  {
        // Internal state.
--- 24,28 ----
  using System;
  
! internal sealed class SynchronizedIterator<T> : IIterator<T>
  {
        // Internal state.
***************
*** 37,41 ****
                        }
  
!       // Implement the IEnumerator<T> interface.
        public bool MoveNext()
                        {
--- 37,41 ----
                        }
  
!       // Implement the IIterator<T> interface.
        public bool MoveNext()
                        {
***************
*** 52,72 ****
                                }
                        }
!       T IEnumerator<T>.Current
!                       {
!                               get
!                               {
!                                       lock(syncRoot)
!                                       {
!                                               return 
((IEnumerator<T>)iterator).Current;
!                                       }
!                               }
!                       }
! 
!       // Implement the IIterator<T> interface.
!       public bool MovePrev()
                        {
                                lock(syncRoot)
                                {
!                                       return iterator.MovePrev();
                                }
                        }
--- 52,60 ----
                                }
                        }
!       public void Remove()
                        {
                                lock(syncRoot)
                                {
!                                       iterator.Remove();
                                }
                        }
***************
*** 78,88 ****
                                        {
                                                return iterator.Current;
-                                       }
-                               }
-                               set
-                               {
-                                       lock(syncRoot)
-                                       {
-                                               iterator.Current = value;
                                        }
                                }
--- 66,69 ----

--- IDictionaryEnumerator.cs DELETED ---

--- IEnumerable.cs DELETED ---

--- IEnumerator.cs DELETED ---

--- SynchronizedDictEnumerator.cs DELETED ---

--- SynchronizedEnumerator.cs DELETED ---





reply via email to

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