diff options
Diffstat (limited to 'cs/src/Ice/Arrays.cs')
-rw-r--r-- | cs/src/Ice/Arrays.cs | 58 |
1 files changed, 0 insertions, 58 deletions
diff --git a/cs/src/Ice/Arrays.cs b/cs/src/Ice/Arrays.cs index ff25aa479a6..f737531878e 100644 --- a/cs/src/Ice/Arrays.cs +++ b/cs/src/Ice/Arrays.cs @@ -111,63 +111,5 @@ namespace IceUtilInternal return h; } - - public static void Sort(ref ArrayList array, IComparer comparator) - { - // - // This Sort method implements the merge sort algorithm - // which is a stable sort (unlike the Sort method of the - // System.Collections.ArrayList which is unstable). - // - Sort1(ref array, 0, array.Count, comparator); - } - - private static void Sort1(ref ArrayList array, int begin, int end, IComparer comparator) - { - int mid; - if(end - begin <= 1) - { - return; - } - - mid = (begin + end) / 2; - Sort1(ref array, begin, mid, comparator); - Sort1(ref array, mid, end, comparator); - Merge(ref array, begin, mid, end, comparator); - } - - private static void Merge(ref ArrayList array, int begin, int mid, int end, IComparer comparator) - { - int i = begin; - int j = mid; - int k = 0; - - object[] tmp = new object[end - begin]; - while(i < mid && j < end) - { - if(comparator.Compare(array[i], array[j]) <= 0) - { - tmp[k++] = array[i++]; - } - else - { - tmp[k++] = array[j++]; - } - } - - while(i < mid) - { - tmp[k++] = array[i++]; - } - while(j < end) - { - tmp[k++] = array[j++]; - } - for(i = 0; i < (end - begin); ++i) - { - array[begin + i] = tmp[i]; - } - } } - } |