Merge pull request #899 from UCIS/patch-4
[mono.git] / mcs / class / System / System.Collections.Generic / Stack.cs
index 7c231edc294e503997209834235847d014b4c66b..4a693549b5f6c8636fd2824a3590b6bbf22d17b8 100644 (file)
@@ -53,12 +53,12 @@ namespace System.Collections.Generic
                {
                }
                
-               public Stack (int count)
+               public Stack (int capacity)
                {
-                       if (count < 0)
-                               throw new ArgumentOutOfRangeException ("count");
+                       if (capacity < 0)
+                               throw new ArgumentOutOfRangeException ("capacity");
 
-                       _array = new T [count];
+                       _array = new T [capacity];
                }
                
                public Stack (IEnumerable <T> collection)
@@ -87,22 +87,22 @@ namespace System.Collections.Generic
                        _version ++;
                }
                
-               public bool Contains (T t)
+               public bool Contains (T item)
                {               
-                       return _array != null && Array.IndexOf (_array, t, 0, _size) != -1;
+                       return _array != null && Array.IndexOf (_array, item, 0, _size) != -1;
                }
                
-               public void CopyTo (T [] dest, int idx)
+               public void CopyTo (T [] array, int arrayIndex)
                {
-                       if (dest == null)
-                               throw new ArgumentNullException ("dest");
-                       if (idx < 0)
+                       if (array == null)
+                               throw new ArgumentNullException ("array");
+                       if (arrayIndex < 0)
                                throw new ArgumentOutOfRangeException ("idx");
                        
                        // this gets copied in the order that it is poped
                        if (_array != null) {
-                               Array.Copy (_array, 0, dest, idx, _size);
-                               Array.Reverse (dest, idx, _size);
+                               Array.Copy (_array, 0, array, arrayIndex, _size);
+                               Array.Reverse (array, arrayIndex, _size);
                        }
                }
                
@@ -126,14 +126,14 @@ namespace System.Collections.Generic
                        return popped;
                }
 
-               public void Push (T t)
+               public void Push (T item)
                {
                        if (_array == null || _size == _array.Length)
                                Array.Resize <T> (ref _array, _size == 0 ? INITIAL_SIZE : 2 * _size);
                        
                        _version ++;
                        
-                       _array [_size++] = t;
+                       _array [_size++] = item;
                }
                
                public T [] ToArray ()
@@ -166,7 +166,7 @@ namespace System.Collections.Generic
                {
                        try {
                                if (_array != null) {
-                                       _array.CopyTo (dest, idx);
+                                       Array.Copy (_array, 0, dest, idx, _size);
                                        Array.Reverse (dest, idx, _size);
                                }
                        } catch (ArrayTypeMismatchException) {
@@ -213,7 +213,7 @@ namespace System.Collections.Generic
                        // broken.
                        public void Dispose ()
                        {
-                               idx = NOT_STARTED;
+                               idx = FINISHED;
                        }
                        
                        public bool MoveNext ()