[luavsq] getCountメソッドの名前をsizesに変更
@@ -169,7 +169,7 @@ | ||
169 | 169 | |
170 | 170 | --- |
171 | 171 | -- @return [int] |
172 | - function this:getCount() | |
172 | + function this:size() | |
173 | 173 | return #self._events; |
174 | 174 | end |
175 | 175 |
@@ -78,10 +78,10 @@ | ||
78 | 78 | return false; |
79 | 79 | end |
80 | 80 | if( self.id.lyricHandle ~= nil and item.id.lyricHandle ~= nil )then |
81 | - if( self.id.lyricHandle:getCount() ~= item.id.lyricHandle:getCount() )then | |
81 | + if( self.id.lyricHandle:size() ~= item.id.lyricHandle:size() )then | |
82 | 82 | return false; |
83 | 83 | end |
84 | - local count = self.id.lyricHandle:getCount(); | |
84 | + local count = self.id.lyricHandle:size(); | |
85 | 85 | local k; |
86 | 86 | for k = 0, count - 1, 1 do |
87 | 87 | if( not self.id.lyricHandle:getLyricAt( k ):equalsForSynth( item.id.lyricHandle:getLyricAt( k ) ) )then |
@@ -154,8 +154,8 @@ | ||
154 | 154 | return false; |
155 | 155 | end |
156 | 156 | if( vibRateThis ~= nil and vibRateItem ~= nil )then |
157 | - local numRateCount = vibRateThis:getCount(); | |
158 | - if( numRateCount ~= vibRateItem:getCount() )then | |
157 | + local numRateCount = vibRateThis:size(); | |
158 | + if( numRateCount ~= vibRateItem:size() )then | |
159 | 159 | return false; |
160 | 160 | end |
161 | 161 | local k; |
@@ -179,8 +179,8 @@ | ||
179 | 179 | return false; |
180 | 180 | end |
181 | 181 | if( vibDepthThis ~= nil and vibDepthItem ~= nil )then |
182 | - local numDepthCount = vibDepthThis:getCount(); | |
183 | - if( numDepthCount ~= vibDepthItem:getCount() )then | |
182 | + local numDepthCount = vibDepthThis:size(); | |
183 | + if( numDepthCount ~= vibDepthItem:size() )then | |
184 | 184 | return false; |
185 | 185 | end |
186 | 186 | local k; |
@@ -108,7 +108,7 @@ | ||
108 | 108 | |
109 | 109 | --- |
110 | 110 | -- @return (integer) |
111 | - function this:getCount() | |
111 | + function this:size() | |
112 | 112 | return #self._list; |
113 | 113 | end |
114 | 114 |
@@ -297,27 +297,27 @@ | ||
297 | 297 | result = result .. "Caption=" .. self.caption .. "\n"; |
298 | 298 | result = result .. "Length=" .. self.length .. "\n"; |
299 | 299 | result = result .. "StartDepth=" .. self.startDepth .. "\n"; |
300 | - result = result .. "DepthBPNum=" .. self.depthBP:getCount() .. "\n"; | |
301 | - if( self.depthBP:getCount() > 0 )then | |
300 | + result = result .. "DepthBPNum=" .. self.depthBP:size() .. "\n"; | |
301 | + if( self.depthBP:size() > 0 )then | |
302 | 302 | result = result .. "DepthBPX=" .. string.format( "%.6f", self.depthBP:getElement( 0 ).x ); |
303 | - for i = 1, self.depthBP:getCount() - 1, 1 do | |
303 | + for i = 1, self.depthBP:size() - 1, 1 do | |
304 | 304 | result = result .. "," .. string.format( "%.6f", self.depthBP:getElement( i ).x ); |
305 | 305 | end |
306 | 306 | result = result .. "\n" .. "DepthBPY=" .. self.depthBP:getElement( 0 ).y; |
307 | - for i = 1, self.depthBP:getCount() - 1, 1 do | |
307 | + for i = 1, self.depthBP:size() - 1, 1 do | |
308 | 308 | result = result .. "," .. self.depthBP:getElement( i ).y; |
309 | 309 | end |
310 | 310 | result = result .. "\n"; |
311 | 311 | end |
312 | 312 | result = result .. "StartRate=" .. self.startRate .. "\n"; |
313 | - result = result .. "RateBPNum=" .. self.rateBP:getCount(); | |
314 | - if( self.rateBP:getCount() > 0 )then | |
313 | + result = result .. "RateBPNum=" .. self.rateBP:size(); | |
314 | + if( self.rateBP:size() > 0 )then | |
315 | 315 | result = result .. "\n" .. "RateBPX=" .. string.format( "%.6f", self.rateBP:getElement( 0 ).x ); |
316 | - for i = 1, self.rateBP:getCount() - 1, 1 do | |
316 | + for i = 1, self.rateBP:size() - 1, 1 do | |
317 | 317 | result = result .. "," .. string.format( "%.6f", self.rateBP:getElement( i ).x ); |
318 | 318 | end |
319 | 319 | result = result .. "\n" .. "RateBPY=" .. self.rateBP:getElement( 0 ).y; |
320 | - for i = 1, self.rateBP:getCount() - 1, 1 do | |
320 | + for i = 1, self.rateBP:size() - 1, 1 do | |
321 | 321 | result = result .. "," .. self.rateBP:getElement( i ).y; |
322 | 322 | end |
323 | 323 | end |
@@ -346,10 +346,10 @@ | ||
346 | 346 | result = result .. "EndDyn=" .. self.endDyn .. "\n"; |
347 | 347 | result = result .. "Length=" .. self.length .. "\n"; |
348 | 348 | if( nil ~= self.dynBP )then |
349 | - if( self.dynBP:getCount() <= 0 )then | |
349 | + if( self.dynBP:size() <= 0 )then | |
350 | 350 | result = result .. "DynBPNum=0"; |
351 | 351 | else |
352 | - local c = self.dynBP:getCount(); | |
352 | + local c = self.dynBP:size(); | |
353 | 353 | result = result .. "DynBPNum=" .. c .. "\n"; |
354 | 354 | result = result .. "DynBPX=" .. string.format( "%.6f", self.dynBP:getElement( 0 ).x ); |
355 | 355 | for i = 1, c - 1, 1 do |
@@ -71,7 +71,7 @@ | ||
71 | 71 | "-- See tool/makefile and tool/SourceFilePacker.java.", |
72 | 72 | "", |
73 | 73 | "if( nil == luavsq )then", |
74 | - " luavsq = {};", | |
74 | + "\tluavsq = {};", | |
75 | 75 | "end" |
76 | 76 | }; |
77 | 77 | for( String line : license ){ |
@@ -146,6 +146,28 @@ | ||
146 | 146 | source = matcher.replaceAll( "\n" ); |
147 | 147 | } |
148 | 148 | |
149 | + // インデントをタブでやるようにする | |
150 | + int tabCount = 0; | |
151 | + while( true ){ | |
152 | + String patternString = "^"; | |
153 | + for( int i = 0; i < tabCount; i++ ){ | |
154 | + patternString += "\\t"; | |
155 | + } | |
156 | + tabCount++; | |
157 | + patternString += "[ ]{4}"; | |
158 | + pattern = Pattern.compile( patternString, Pattern.MULTILINE ); | |
159 | + matcher = pattern.matcher( source ); | |
160 | + if( matcher.find() ){ | |
161 | + String replace = ""; | |
162 | + for( int i = 0; i < tabCount; i++ ){ | |
163 | + replace += "\t"; | |
164 | + } | |
165 | + source = matcher.replaceAll( replace ); | |
166 | + }else{ | |
167 | + break; | |
168 | + } | |
169 | + } | |
170 | + | |
149 | 171 | return source; |
150 | 172 | } |
151 | 173 |
@@ -65,7 +65,7 @@ | ||
65 | 65 | |
66 | 66 | --- |
67 | 67 | -- @return (integer) |
68 | - function this:getCount() | |
68 | + function this:size() | |
69 | 69 | return #self.lyrics; |
70 | 70 | end |
71 | 71 |
@@ -3,7 +3,7 @@ | ||
3 | 3 | |
4 | 4 | function testConstruct() |
5 | 5 | local list = luavsq.EventList.new(); |
6 | - assert_equal( 0, list:getCount() ); | |
6 | + assert_equal( 0, list:size() ); | |
7 | 7 | end |
8 | 8 | |
9 | 9 | function testFindIndexFromId() |
@@ -87,12 +87,12 @@ | ||
87 | 87 | list:add( b, 14 ); |
88 | 88 | list:add( a, 20 ); |
89 | 89 | |
90 | - assert_equal( 2, list:getCount() ); | |
90 | + assert_equal( 2, list:size() ); | |
91 | 91 | assert_equal( 20, list:getElement( 0 ).internalId ); |
92 | 92 | |
93 | 93 | list:clear(); |
94 | 94 | |
95 | - assert_equal( 0, list:getCount() ); | |
95 | + assert_equal( 0, list:size() ); | |
96 | 96 | end |
97 | 97 | |
98 | 98 | function testIterator() |
@@ -138,21 +138,21 @@ | ||
138 | 138 | list:add( b, 2 ); |
139 | 139 | assert_equal( 100, list:getElement( 0 ).internalId ); |
140 | 140 | assert_equal( 2, list:getElement( 1 ).internalId ); |
141 | - assert_equal( 2, list:getCount() ); | |
141 | + assert_equal( 2, list:size() ); | |
142 | 142 | |
143 | 143 | list:removeAt( 0 ); |
144 | 144 | |
145 | - assert_equal( 1, list:getCount() ); | |
145 | + assert_equal( 1, list:size() ); | |
146 | 146 | assert_equal( 2, list:getElement( 0 ).internalId ); |
147 | 147 | end |
148 | 148 | |
149 | 149 | function testGetCount() |
150 | 150 | local list = luavsq.EventList.new(); |
151 | - assert_equal( 0, list:getCount() ); | |
151 | + assert_equal( 0, list:size() ); | |
152 | 152 | local event = luavsq.Event.new( 0, luavsq.Id.new( 0 ) ); |
153 | 153 | event.id.type = luavsq.IdType.Anote; |
154 | 154 | list:add( event ); |
155 | - assert_equal( 1, list:getCount() ); | |
155 | + assert_equal( 1, list:size() ); | |
156 | 156 | end |
157 | 157 | |
158 | 158 | function testGetAndSetElement() |
@@ -3,13 +3,13 @@ | ||
3 | 3 | |
4 | 4 | function testConstructWithString() |
5 | 5 | local list = luavsq.VibratoBPList.new( "2", "1.0,0.0", "128,1" ); |
6 | - assert_equal( 2, list:getCount() ); | |
6 | + assert_equal( 2, list:size() ); | |
7 | 7 | assert_equal( "0=1,1=128", list:getData() ); |
8 | 8 | end |
9 | 9 | |
10 | 10 | function testConstructWithArray() |
11 | 11 | local list = luavsq.VibratoBPList.new( { 1.0, 0.0 }, { 128, 1 } ); |
12 | - assert_equal( 2, list:getCount() ); | |
12 | + assert_equal( 2, list:size() ); | |
13 | 13 | assert_equal( "0=1,1=128", list:getData() ); |
14 | 14 | end |
15 | 15 |
@@ -29,7 +29,7 @@ | ||
29 | 29 | |
30 | 30 | function testGetCount() |
31 | 31 | local list = luavsq.VibratoBPList.new( { 0.0, 0.4, 1.0 }, { 1, 64, 128 } ); |
32 | - assert_equal( 3, list:getCount() ); | |
32 | + assert_equal( 3, list:size() ); | |
33 | 33 | end |
34 | 34 | |
35 | 35 | function testGetElement() |
@@ -59,7 +59,7 @@ | ||
59 | 59 | function testSetData() |
60 | 60 | local list = luavsq.VibratoBPList.new( {}, {} ); |
61 | 61 | list:setData( "0.4=64,0=1,1=128" ); |
62 | - assert_equal( 3, list:getCount() ); | |
62 | + assert_equal( 3, list:size() ); | |
63 | 63 | assert_equal( 0, list:getElement( 0 ).x ); |
64 | 64 | assert_equal( 1, list:getElement( 0 ).y ); |
65 | 65 | assert_equal( 0.4, list:getElement( 1 ).x ); |
@@ -118,11 +118,11 @@ | ||
118 | 118 | assert_equal( 1, #handle.lyrics ); |
119 | 119 | |
120 | 120 | assert_not_nil( handle.rateBP ); |
121 | - assert_equal( 0, handle.rateBP:getCount() ); | |
121 | + assert_equal( 0, handle.rateBP:size() ); | |
122 | 122 | assert_not_nil( handle.depthBP ); |
123 | - assert_equal( 0, handle.depthBP:getCount() ); | |
123 | + assert_equal( 0, handle.depthBP:size() ); | |
124 | 124 | assert_not_nil( handle.dynBP ); |
125 | - assert_equal( 0, handle.dynBP:getCount() ); | |
125 | + assert_equal( 0, handle.dynBP:size() ); | |
126 | 126 | |
127 | 127 | local lyric = handle.lyrics[1]; |
128 | 128 | assert_equal( "あ", lyric.phrase ); |
@@ -171,9 +171,9 @@ | ||
171 | 171 | local handle = luavsq.Handle.new( stream, index, lastLine ); |
172 | 172 | |
173 | 173 | assert_not_nil( handle.rateBP ); |
174 | - assert_equal( 0, handle.rateBP:getCount() ); | |
174 | + assert_equal( 0, handle.rateBP:size() ); | |
175 | 175 | assert_not_nil( handle.depthBP ); |
176 | - assert_equal( 0, handle.depthBP:getCount() ); | |
176 | + assert_equal( 0, handle.depthBP:size() ); | |
177 | 177 | end |
178 | 178 | |
179 | 179 | function testConstructSingerFromTextStream() |
@@ -4,7 +4,7 @@ | ||
4 | 4 | function testConstruct() |
5 | 5 | local handle = luavsq.LyricHandle.new(); |
6 | 6 | assert_equal( 0, handle.index ); |
7 | - assert_equal( 1, handle:getCount() ); | |
7 | + assert_equal( 1, handle:size() ); | |
8 | 8 | assert_equal( "a", handle:getLyricAt( 0 ).phrase ); |
9 | 9 | assert_equal( "a", handle:getLyricAt( 0 ):getPhoneticSymbol() ); |
10 | 10 | end |
@@ -12,7 +12,7 @@ | ||
12 | 12 | function testConstructWithPhrase() |
13 | 13 | local handle = luavsq.LyricHandle.new( "は", "h a" ); |
14 | 14 | assert_equal( 0, handle.index ); |
15 | - assert_equal( 1, handle:getCount() ); | |
15 | + assert_equal( 1, handle:size() ); | |
16 | 16 | assert_equal( "は", handle:getLyricAt( 0 ).phrase ); |
17 | 17 | assert_equal( "h a", handle:getLyricAt( 0 ):getPhoneticSymbol() ); |
18 | 18 | end |
@@ -21,7 +21,7 @@ | ||
21 | 21 | local handle = luavsq.LyricHandle.new( "は", "h a" ); |
22 | 22 | local lyric = luavsq.Lyric.new( "ら", "4 a" ); |
23 | 23 | handle:setLyricAt( 1, lyric ); |
24 | - assert_equal( 2, handle:getCount() ); | |
24 | + assert_equal( 2, handle:size() ); | |
25 | 25 | assert_true( handle:getLyricAt( 1 ):equals( lyric ) ); |
26 | 26 | end |
27 | 27 |