diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2012-04-23 16:04:56 +0200 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2012-04-23 17:54:50 +0200 |
commit | 0f0144c74088e396fc1440166bed5a7c6d5f44f4 (patch) | |
tree | fd7cc379f1926a3e6a0b94ccb22dd071384cdeb1 /src/library/scala/util/Sorting.scala | |
parent | 2b09d8caf5497c4e016a3e1179e5f7e842766176 (diff) | |
download | scala-0f0144c74088e396fc1440166bed5a7c6d5f44f4.tar.gz scala-0f0144c74088e396fc1440166bed5a7c6d5f44f4.tar.bz2 scala-0f0144c74088e396fc1440166bed5a7c6d5f44f4.zip |
migrates stdlib and compiler to tags
* all usages of ClassManifest and Manifest are replaced with tags
* all manifest tests are replaced with tag tests
Diffstat (limited to 'src/library/scala/util/Sorting.scala')
-rw-r--r-- | src/library/scala/util/Sorting.scala | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/library/scala/util/Sorting.scala b/src/library/scala/util/Sorting.scala index bf460a118f..7d98e57741 100644 --- a/src/library/scala/util/Sorting.scala +++ b/src/library/scala/util/Sorting.scala @@ -8,7 +8,7 @@ package scala.util -import scala.reflect.ClassManifest +import scala.reflect.ClassTag import scala.math.Ordering /** The Sorting object provides functions that can sort various kinds of @@ -39,14 +39,14 @@ object Sorting { /** Sort an array of K where K is Ordered, preserving the existing order * where the values are equal. */ - def stableSort[K: ClassManifest: Ordering](a: Array[K]) { + def stableSort[K: ArrayTag: Ordering](a: Array[K]) { stableSort(a, 0, a.length-1, new Array[K](a.length), Ordering[K].lt _) } /** Sorts an array of `K` given an ordering function `f`. * `f` should return `true` iff its first parameter is strictly less than its second parameter. */ - def stableSort[K: ClassManifest](a: Array[K], f: (K, K) => Boolean) { + def stableSort[K: ArrayTag](a: Array[K], f: (K, K) => Boolean) { stableSort(a, 0, a.length-1, new Array[K](a.length), f) } @@ -57,14 +57,14 @@ object Sorting { * @param f the comparison function. * @return the sorted sequence of items. */ - def stableSort[K: ClassManifest](a: Seq[K], f: (K, K) => Boolean): Array[K] = { + def stableSort[K: ArrayTag](a: Seq[K], f: (K, K) => Boolean): Array[K] = { val ret = a.toArray stableSort(ret, f) ret } /** Sorts an arbitrary sequence of items that are viewable as ordered. */ - def stableSort[K: ClassManifest: Ordering](a: Seq[K]): Array[K] = + def stableSort[K: ArrayTag: Ordering](a: Seq[K]): Array[K] = stableSort(a, Ordering[K].lt _) /** Stably sorts a sequence of items given an extraction function that will @@ -74,8 +74,8 @@ object Sorting { * @param f the comparison function. * @return the sorted sequence of items. */ - def stableSort[K: ClassManifest, M: Ordering](a: Seq[K], f: K => M): Array[K] = - stableSort(a)(implicitly[ClassManifest[K]], Ordering[M] on f) + def stableSort[K: ArrayTag, M: Ordering](a: Seq[K], f: K => M): Array[K] = + stableSort(a)(implicitly[ArrayTag[K]], Ordering[M] on f) private def sort1[K: Ordering](x: Array[K], off: Int, len: Int) { val ord = Ordering[K] @@ -498,7 +498,7 @@ object Sorting { sort2(off, len) } - private def stableSort[K : ClassManifest](a: Array[K], lo: Int, hi: Int, scratch: Array[K], f: (K,K) => Boolean) { + private def stableSort[K : ArrayTag](a: Array[K], lo: Int, hi: Int, scratch: Array[K], f: (K,K) => Boolean) { if (lo < hi) { val mid = (lo+hi) / 2 stableSort(a, lo, mid, scratch, f) |