X-Git-Url: http://nitlanguage.org diff --git a/tests/bench_complex_sort.nit b/tests/bench_complex_sort.nit index ad72cc6..2eef2cb 100644 --- a/tests/bench_complex_sort.nit +++ b/tests/bench_complex_sort.nit @@ -22,7 +22,7 @@ end class A super Elt - var _a: Int + var a: Int redef fun val1: Int do return _a init(i: Int) do _a = i @@ -30,7 +30,7 @@ end class Elt2 super Elt - var _b: Int + var b: Int redef fun val1: Int do return _b/2 redef fun val2: Int do return _b init initelt2(i: Int) do _b = i @@ -43,8 +43,8 @@ end class C super Elt - var _c: Int - var _d: Int + var c: Int + var d: Int redef fun val1: Int do return _c end redef fun val2: Int do return _d end @@ -73,9 +73,10 @@ class E init(i: Int) do initelt2(i) end -class EltSorter - super AbstractSorter[Elt] - redef fun compare(a: Elt, b: Elt): Int +class EltComparator + super Comparator + redef type COMPARED: Elt + redef fun compare(a, b) do if _is_val1 then return a.val1 <=> b.val1 @@ -89,7 +90,7 @@ class EltSorter _is_val1 = not _is_val1 end - var _is_val1: Bool = false + var is_val1: Bool = false init do end end @@ -121,9 +122,9 @@ for i in [0..n[ do array.push(generator) end -var sorter = new EltSorter +var comparator = new EltComparator for i in [0..n[ do - sorter.sort(array) - sorter.toggle + comparator.sort(array) + comparator.toggle end