• R/O
  • SSH
  • HTTPS

cadencii: コミット


コミットメタ情報

リビジョン1837 (tree)
日時2011-12-01 04:04:08
作者kbinani

ログメッセージ

[luavsq] VibratoBPのソート時にVibratoBPList._comparatorを使っていたのを、VibratoBP.compareを使うように変えた

変更サマリ

差分

--- luavsq/trunk/VibratoBPList.lua (revision 1836)
+++ luavsq/trunk/VibratoBPList.lua (revision 1837)
@@ -59,7 +59,7 @@
5959 for i = 1, len, 1 do
6060 self._list[i] = VibratoBP.new( x[i], y[i] );
6161 end
62- table.sort( self._list, VibratoBPList._comparator );
62+ table.sort( self._list, VibratoBP.compare );
6363 end
6464 end
6565
@@ -81,7 +81,7 @@
8181 return false;
8282 end
8383 end
84- table.sort( self._list, VibratoBPList._comparator );
84+ table.sort( self._list, VibratoBP.compare );
8585 end
8686
8787 ---
@@ -176,7 +176,7 @@
176176 j = j + 1
177177 end
178178 end
179- table.sort( self._list, VibratoBPList._comparator );
179+ table.sort( self._list, VibratoBP.compare );
180180 end
181181
182182 if( #arguments == 3 )then
@@ -187,17 +187,3 @@
187187
188188 return this;
189189 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
--- luavsq/trunk/VibratoBP.lua (revision 1836)
+++ luavsq/trunk/VibratoBP.lua (revision 1837)
@@ -71,12 +71,11 @@
7171 end
7272
7373 ---
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 を返す
7978 -- @name <i>compare</i>
8079 function VibratoBP.compare( a, b )
81- return a:compareTo( b );
80+ return (a:compareTo( b ) < 0);
8281 end
--- luavsq/trunk/test/VibratoBPTest.lua (revision 1836)
+++ luavsq/trunk/test/VibratoBPTest.lua (revision 1837)
@@ -27,9 +27,9 @@
2727 function testCompare()
2828 local a = luavsq.VibratoBP.new( 2.0, 3 );
2929 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 ) );
3131
3232 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 ) );
3535 end
旧リポジトリブラウザで表示