[luavsq] VibratoBPのソート時にVibratoBPList._comparatorを使っていたのを、VibratoBP.compareを使うように変えた
@@ -59,7 +59,7 @@ | ||
59 | 59 | for i = 1, len, 1 do |
60 | 60 | self._list[i] = VibratoBP.new( x[i], y[i] ); |
61 | 61 | end |
62 | - table.sort( self._list, VibratoBPList._comparator ); | |
62 | + table.sort( self._list, VibratoBP.compare ); | |
63 | 63 | end |
64 | 64 | end |
65 | 65 |
@@ -81,7 +81,7 @@ | ||
81 | 81 | return false; |
82 | 82 | end |
83 | 83 | end |
84 | - table.sort( self._list, VibratoBPList._comparator ); | |
84 | + table.sort( self._list, VibratoBP.compare ); | |
85 | 85 | end |
86 | 86 | |
87 | 87 | --- |
@@ -176,7 +176,7 @@ | ||
176 | 176 | j = j + 1 |
177 | 177 | end |
178 | 178 | end |
179 | - table.sort( self._list, VibratoBPList._comparator ); | |
179 | + table.sort( self._list, VibratoBP.compare ); | |
180 | 180 | end |
181 | 181 | |
182 | 182 | if( #arguments == 3 )then |
@@ -187,17 +187,3 @@ | ||
187 | 187 | |
188 | 188 | return this; |
189 | 189 | end |
190 | - | |
191 | ---- | |
192 | --- 2 つの VibratoBP を比較する | |
193 | --- @param a (VibratoBP) 比較対象のオブジェクト | |
194 | --- @param b (VibratoBP) 比較対象のオブジェクト | |
195 | --- @return (boolean) a が b よりも小さい場合は true、そうでない場合は false を返す | |
196 | --- @name <i>_comparator</i> | |
197 | -function VibratoBPList._comparator( a, b ) | |
198 | - if( a:compareTo( b ) < 0 )then | |
199 | - return true; | |
200 | - else | |
201 | - return false; | |
202 | - end | |
203 | -end |
@@ -71,12 +71,11 @@ | ||
71 | 71 | end |
72 | 72 | |
73 | 73 | --- |
74 | --- 引数で与えられた 2 つのインスタンスの順序比較し、第 1 引数のものが第 2 引数のものより大きければ 1 を返す。 | |
75 | --- 小さければ -1 を返す。同順であれば 0 を返す。 | |
76 | --- @param a (VibratoBP) | |
77 | --- @param b (VibratoBP) | |
78 | --- @return (integer) | |
74 | +-- 2 つの Event を比較する | |
75 | +-- @param a (VibratoBP) 比較対象のオブジェクト | |
76 | +-- @param b (VibratoBP) 比較対象のオブジェクト | |
77 | +-- @return (boolean) a が b よりも小さい場合は true、そうでない場合は false を返す | |
79 | 78 | -- @name <i>compare</i> |
80 | 79 | function VibratoBP.compare( a, b ) |
81 | - return a:compareTo( b ); | |
80 | + return (a:compareTo( b ) < 0); | |
82 | 81 | end |
@@ -27,9 +27,9 @@ | ||
27 | 27 | function testCompare() |
28 | 28 | local a = luavsq.VibratoBP.new( 2.0, 3 ); |
29 | 29 | local b = luavsq.VibratoBP.new( 2.0, 10 ); |
30 | - assert_equal( 0, luavsq.VibratoBP.compare( a, b ) ); | |
30 | + assert_false( luavsq.VibratoBP.compare( a, b ) ); | |
31 | 31 | |
32 | 32 | local c = luavsq.VibratoBP.new( 1.0, 3 ); |
33 | - assert_equal( 1, luavsq.VibratoBP.compare( b, c ) ); | |
34 | - assert_equal( -1, luavsq.VibratoBP.compare( c, b ) ); | |
33 | + assert_false( luavsq.VibratoBP.compare( b, c ) ); | |
34 | + assert_true( luavsq.VibratoBP.compare( c, b ) ); | |
35 | 35 | end |