ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/main/java/util/TimSort.java
(Generate patch)

Comparing jsr166/src/main/java/util/TimSort.java (file contents):
Revision 1.3 by jsr166, Tue Sep 1 22:23:10 2009 UTC vs.
Revision 1.5 by jsr166, Sun Nov 21 08:15:12 2010 UTC

# Line 230 | Line 230 | class TimSort<T> {
230       * @param lo the index of the first element in the range to be sorted
231       * @param hi the index after the last element in the range to be sorted
232       * @param start the index of the first element in the range that is
233 <     *        not already known to be sorted (@code lo <= start <= hi}
233 >     *        not already known to be sorted ({@code lo <= start <= hi})
234       * @param c comparator to used for the sort
235       */
236      @SuppressWarnings("fallthrough")
# Line 269 | Line 269 | class TimSort<T> {
269               */
270              int n = start - left;  // The number of elements to move
271              // Switch is just an optimization for arraycopy in default case
272 <            switch(n) {
272 >            switch (n) {
273                  case 2:  a[left + 2] = a[left + 1];
274                  case 1:  a[left + 1] = a[left];
275                           break;
# Line 299 | Line 299 | class TimSort<T> {
299       * @param a the array in which a run is to be counted and possibly reversed
300       * @param lo index of the first element in the run
301       * @param hi index after the last element that may be contained in the run.
302 <              It is required that @code{lo < hi}.
302 >              It is required that {@code lo < hi}.
303       * @param c the comparator to used for the sort
304       * @return  the length of the run beginning at the specified position in
305       *          the specified array
# Line 313 | Line 313 | class TimSort<T> {
313  
314          // Find end of run, and reverse range if descending
315          if (c.compare(a[runHi++], a[lo]) < 0) { // Descending
316 <            while(runHi < hi && c.compare(a[runHi], a[runHi - 1]) < 0)
316 >            while (runHi < hi && c.compare(a[runHi], a[runHi - 1]) < 0)
317                  runHi++;
318              reverseRange(a, lo, runHi);
319          } else {                              // Ascending

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines