Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(336)

Side by Side Diff: lib/coreimpl/dual_pivot_quicksort.dart

Issue 10910037: - Change "static final" to "static const" in the lib/coreimpl/ directory. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « lib/coreimpl/date.dart ('k') | lib/coreimpl/hash_map_set.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /** 5 /**
6 * Dual-Pivot Quicksort algorithm. 6 * Dual-Pivot Quicksort algorithm.
7 * 7 *
8 * This class implements the dual-pivot quicksort algorithm as presented in 8 * This class implements the dual-pivot quicksort algorithm as presented in
9 * Vladimir Yaroslavskiy's paper. 9 * Vladimir Yaroslavskiy's paper.
10 * 10 *
11 * Some improvements have been copied from Android's implementation. 11 * Some improvements have been copied from Android's implementation.
12 */ 12 */
13 class DualPivotQuicksort { 13 class DualPivotQuicksort {
14 // When a list has less then [:_INSERTION_SORT_THRESHOLD:] elements it will 14 // When a list has less then [:_INSERTION_SORT_THRESHOLD:] elements it will
15 // be sorted by an insertion sort. 15 // be sorted by an insertion sort.
16 static final int _INSERTION_SORT_THRESHOLD = 32; 16 static const int _INSERTION_SORT_THRESHOLD = 32;
17 17
18 /** 18 /**
19 * Sorts all elements of the given list [:a:] according to the given 19 * Sorts all elements of the given list [:a:] according to the given
20 * [:compare:] function. 20 * [:compare:] function.
21 * 21 *
22 * The [:compare:] function takes two arguments [:x:] and [:y:] and returns 22 * The [:compare:] function takes two arguments [:x:] and [:y:] and returns
23 * -1 if [:x < y:], 23 * -1 if [:x < y:],
24 * 0 if [:x == y:], and 24 * 0 if [:x == y:], and
25 * 1 if [:x > y:]. 25 * 1 if [:x > y:].
26 * 26 *
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 } else { 333 } else {
334 // The second partition looks as follows: 334 // The second partition looks as follows:
335 // [ * | >= pivot1 && <= pivot2 | * ] 335 // [ * | >= pivot1 && <= pivot2 | * ]
336 // ^ ^ 336 // ^ ^
337 // less great 337 // less great
338 // Simply sort it by recursive descent. 338 // Simply sort it by recursive descent.
339 _doSort(a, less, great, compare); 339 _doSort(a, less, great, compare);
340 } 340 }
341 } 341 }
342 } 342 }
OLDNEW
« no previous file with comments | « lib/coreimpl/date.dart ('k') | lib/coreimpl/hash_map_set.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698