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

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

[Dotgnu-pnet-commits] CVS: pnetlib/runtime/System/Collections ArrayList


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnetlib/runtime/System/Collections ArrayList.cs,1.9,1.10
Date: Mon, 16 Dec 2002 18:31:05 -0500

Update of /cvsroot/dotgnu-pnet/pnetlib/runtime/System/Collections
In directory subversions:/tmp/cvs-serv30777/runtime/System/Collections

Modified Files:
        ArrayList.cs 
Log Message:


Temporarily replace quicksort with a dumb sort, so that we have something
that works, until such time that we can figure out what is wrong with the
partitioning code.


Index: ArrayList.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/runtime/System/Collections/ArrayList.cs,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** ArrayList.cs        15 Dec 2002 03:19:44 -0000      1.9
--- ArrayList.cs        16 Dec 2002 23:31:03 -0000      1.10
***************
*** 657,660 ****
--- 657,687 ----
        public void InnerSort(int lower, int upper, IComparer comparer)
                        {
+                               // Temporary hack - use a dumb sort until I can 
figure
+                               // out what is wrong with the Quicksort code -- 
Rhys.
+                               int i, j, cmp;
+                               Object valuei;
+                               Object valuej;
+                               for(i = lower; i < upper; ++i)
+                               {
+                                       for(j = i + 1; j <= upper; ++j)
+                                       {
+                                               valuei = this[i];
+                                               valuej = this[j];
+                                               if(comparer != null)
+                                               {
+                                                       cmp = 
comparer.Compare(valuei, valuej);
+                                               }
+                                               else
+                                               {
+                                                       cmp = 
((IComparable)valuei).CompareTo(valuej);
+                                               }
+                                               if(cmp > 0)
+                                               {
+                                                       this[i] = valuej;
+                                                       this[j] = valuei;
+                                               }
+                                       }
+                               }
+ #if false
                                int i, j, cmp;
                                Object testKey;
***************
*** 687,691 ****
                                        for(;;)
                                        {
!                                               do
                                                {
                                                        ++i;
--- 714,718 ----
                                        for(;;)
                                        {
!                                               for(;;)
                                                {
                                                        ++i;
***************
*** 699,705 ****
                                                                cmp = 
((IComparable)valuei).CompareTo(testKey);
                                                        }
                                                }
!                                               while(cmp < 0);
!                                               do
                                                {
                                                        --j;
--- 726,735 ----
                                                                cmp = 
((IComparable)valuei).CompareTo(testKey);
                                                        }
+                                                       if(cmp >= 0 || i == 
upper)
+                                                       {
+                                                               break;
+                                                       }
                                                }
!                                               for(;;)
                                                {
                                                        --j;
***************
*** 713,718 ****
                                                                cmp = 
((IComparable)valuej).CompareTo(testKey);
                                                        }
                                                }
-                                               while(cmp > 0);
                                                if(i >= j)
                                                {
--- 743,751 ----
                                                                cmp = 
((IComparable)valuej).CompareTo(testKey);
                                                        }
+                                                       if(cmp <= 0 || j == 
lower)
+                                                       {
+                                                               break;
+                                                       }
                                                }
                                                if(i >= j)
                                                {
***************
*** 731,734 ****
--- 764,768 ----
                                        InnerSort(i + 1, upper, comparer);
                                }
+ #endif
                        }
  




reply via email to

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