musa-dsl 0.21.0 → 0.22.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +0 -1
  3. data/lib/musa-dsl.rb +1 -1
  4. data/lib/musa-dsl/core-ext.rb +1 -0
  5. data/lib/musa-dsl/core-ext/arrayfy.rb +9 -9
  6. data/lib/musa-dsl/core-ext/hashify.rb +42 -0
  7. data/lib/musa-dsl/core-ext/inspect-nice.rb +6 -1
  8. data/lib/musa-dsl/datasets/e.rb +22 -5
  9. data/lib/musa-dsl/datasets/gdv.rb +0 -1
  10. data/lib/musa-dsl/datasets/p.rb +28 -37
  11. data/lib/musa-dsl/datasets/pdv.rb +0 -1
  12. data/lib/musa-dsl/datasets/ps.rb +10 -78
  13. data/lib/musa-dsl/generative/markov.rb +1 -1
  14. data/lib/musa-dsl/logger/logger.rb +4 -3
  15. data/lib/musa-dsl/matrix/matrix.rb +0 -57
  16. data/lib/musa-dsl/midi/midi-voices.rb +4 -0
  17. data/lib/musa-dsl/neumas/string-to-neumas.rb +1 -0
  18. data/lib/musa-dsl/repl/repl.rb +30 -11
  19. data/lib/musa-dsl/sequencer/base-sequencer-implementation-every.rb +87 -0
  20. data/lib/musa-dsl/sequencer/base-sequencer-implementation-move.rb +439 -0
  21. data/lib/musa-dsl/sequencer/base-sequencer-implementation-play-helper.rb +3 -3
  22. data/lib/musa-dsl/sequencer/base-sequencer-implementation-play-timed.rb +210 -0
  23. data/lib/musa-dsl/sequencer/base-sequencer-implementation-play.rb +178 -0
  24. data/lib/musa-dsl/sequencer/base-sequencer-implementation.rb +150 -595
  25. data/lib/musa-dsl/sequencer/base-sequencer-public.rb +58 -5
  26. data/lib/musa-dsl/sequencer/base-sequencer-tick-based.rb +5 -9
  27. data/lib/musa-dsl/sequencer/base-sequencer-tickless-based.rb +1 -5
  28. data/lib/musa-dsl/sequencer/sequencer-dsl.rb +8 -0
  29. data/lib/musa-dsl/series/base-series.rb +43 -78
  30. data/lib/musa-dsl/series/flattener-timed-serie.rb +61 -0
  31. data/lib/musa-dsl/series/hash-or-array-serie-splitter.rb +95 -0
  32. data/lib/musa-dsl/series/holder-serie.rb +1 -1
  33. data/lib/musa-dsl/series/main-serie-constructors.rb +29 -83
  34. data/lib/musa-dsl/series/main-serie-operations.rb +60 -215
  35. data/lib/musa-dsl/series/proxy-serie.rb +1 -1
  36. data/lib/musa-dsl/series/quantizer-serie.rb +546 -0
  37. data/lib/musa-dsl/series/queue-serie.rb +1 -1
  38. data/lib/musa-dsl/series/series.rb +7 -2
  39. data/lib/musa-dsl/transport/input-midi-clock.rb +19 -12
  40. data/lib/musa-dsl/transport/transport.rb +25 -12
  41. data/musa-dsl.gemspec +2 -2
  42. metadata +11 -5
  43. data/lib/musa-dsl/sequencer/base-sequencer-implementation-control.rb +0 -216
  44. data/lib/musa-dsl/series/hash-serie-splitter.rb +0 -196
@@ -32,7 +32,7 @@ module Musa
32
32
  self
33
33
  end
34
34
 
35
- def _prototype
35
+ def _prototype!
36
36
  raise PrototypingSerieError, 'Cannot get prototype of a proxy serie'
37
37
  end
38
38
 
@@ -1,4 +1,5 @@
1
1
  require_relative '../core-ext/arrayfy'
2
+ require_relative '../core-ext/smart-proc-binder'
2
3
 
3
4
  using Musa::Extension::Arrayfy
4
5
  using Musa::Extension::ExplodeRanges
@@ -22,11 +23,11 @@ module Musa
22
23
  end
23
24
 
24
25
  def H(**series_hash)
25
- FromHash.new series_hash, false
26
+ FromHashOfSeries.new series_hash, false
26
27
  end
27
28
 
28
29
  def HC(**series_hash)
29
- FromHash.new series_hash, true
30
+ FromHashOfSeries.new series_hash, true
30
31
  end
31
32
 
32
33
  def A(*series)
@@ -37,14 +38,8 @@ module Musa
37
38
  FromArrayOfSeries.new series, true
38
39
  end
39
40
 
40
- def E(**args, &block)
41
- if args.key?(:start) && args.length == 1
42
- FromAutoEvalBlockOnSeed.new args[:start], &block
43
- elsif args.empty?
44
- FromEvalBlock.new &block
45
- else
46
- raise ArgumentError, 'only optional start: argument is allowed'
47
- end
41
+ def E(*value_args, **key_args, &block)
42
+ FromEvalBlockWithParameters.new *value_args, **key_args, &block
48
43
  end
49
44
 
50
45
  def FOR(from: nil, to: nil, step: nil)
@@ -166,14 +161,6 @@ module Musa
166
161
  mark_regarding! series[0]
167
162
  end
168
163
 
169
- def _prototype
170
- @sources = @sources.collect(&:prototype).freeze
171
- end
172
-
173
- def _instance
174
- @sources = @sources.collect(&:instance)
175
- end
176
-
177
164
  def _restart(restart_sources = true)
178
165
  @index = 0
179
166
  @sources[@index].restart if restart_sources
@@ -204,71 +191,46 @@ module Musa
204
191
 
205
192
  private_constant :Sequence
206
193
 
207
- class FromAutoEvalBlockOnSeed
194
+ class FromEvalBlockWithParameters
208
195
  include Serie
196
+ include Musa::Extension::SmartProcBinder
209
197
 
210
- attr_reader :start, :block
211
-
212
- def initialize(start, &block)
213
- @start = start
214
- @block = block
215
-
216
- @current = nil
217
- @first = true
218
-
219
- mark_as_prototype!
220
- end
221
-
222
- def _restart
223
- @current = nil
224
- @first = true
225
- end
226
-
227
- def _next_value
228
- if @first
229
- @first = false
230
- @current = @start
231
- else
232
- raise 'Block is undefined' unless @block
233
-
234
- @current = @block.call @current unless @current.nil?
235
- end
236
-
237
- @current
238
- end
239
- end
198
+ attr_reader :block
240
199
 
241
- private_constant :FromAutoEvalBlockOnSeed
200
+ def initialize(*values, **key_values, &block)
201
+ raise ArgumentError, 'Yield block is undefined' unless block
242
202
 
243
- class FromEvalBlock
244
- include Serie
203
+ @original_value_parameters = values
204
+ @original_key_parameters = key_values
245
205
 
246
- attr_reader :block
206
+ @block = SmartProcBinder.new(block)
247
207
 
248
- def initialize(&block)
249
- @block = block
250
208
  _restart
251
209
 
252
210
  mark_as_prototype!
253
211
  end
254
212
 
255
213
  def _restart
256
- @index = 0
214
+ @value_parameters = @original_value_parameters.collect(&:clone)
215
+ @key_parameters = @original_key_parameters.transform_values(&:clone)
216
+
217
+ @first = true
257
218
  @value = nil
258
219
  end
259
220
 
260
221
  def _next_value
261
- raise 'Block is undefined' unless @block
262
-
263
- @value = @block.call @index unless @value.nil? && @index > 0
264
- value = @value
265
- @index += 1
222
+ @value = if !@value.nil? || @value.nil? && @first
223
+ @value = @block.call(*@value_parameters, last_value: @value, **@key_parameters)
224
+ else
225
+ nil
226
+ end
266
227
 
267
- value
228
+ @first = false
229
+ @value
268
230
  end
269
231
  end
270
232
 
271
- private_constant :FromEvalBlock
233
+ private_constant :FromEvalBlockWithParameters
272
234
 
273
235
  class ForLoop
274
236
  include Serie
@@ -459,13 +421,13 @@ module Musa
459
421
 
460
422
  private_constant :RandomNumbersFromRange
461
423
 
462
- class FromHash
424
+ class FromHashOfSeries
463
425
  include Serie
464
426
 
465
427
  attr_reader :sources, :cycle
466
428
 
467
- def initialize(series_hash, cycle_all_series)
468
- @sources = series_hash.clone.transform_values(&:prototype).freeze
429
+ def initialize(hash_of_series, cycle_all_series)
430
+ @sources = hash_of_series.clone.transform_values(&:prototype).freeze
469
431
  @cycle = cycle_all_series
470
432
 
471
433
  _restart false
@@ -473,14 +435,6 @@ module Musa
473
435
  mark_as_prototype!
474
436
  end
475
437
 
476
- def _prototype
477
- @sources = @sources.clone.transform_values(&:prototype).freeze
478
- end
479
-
480
- def _instance
481
- @sources = @sources.clone.transform_values(&:instance)
482
- end
483
-
484
438
  def _restart(restart_sources = true)
485
439
  @have_current = false
486
440
  @value = nil
@@ -528,7 +482,7 @@ module Musa
528
482
  end
529
483
  end
530
484
 
531
- private_constant :FromHash
485
+ private_constant :FromHashOfSeries
532
486
 
533
487
  class FromArrayOfSeries
534
488
  include Serie
@@ -544,14 +498,6 @@ module Musa
544
498
  mark_as_prototype!
545
499
  end
546
500
 
547
- def _prototype
548
- @sources = @sources.collect(&:prototype).freeze
549
- end
550
-
551
- def _instance
552
- @sources = @sources.collect(&:instance)
553
- end
554
-
555
501
  def _restart(restart_sources = true)
556
502
  @have_current = false
557
503
  @value = nil
@@ -99,6 +99,8 @@ module Musa
99
99
  MergeSerieOfSeries.new self
100
100
  end
101
101
 
102
+ # TODO on with and map methods implement parameter passing with cloning on restart as on E()
103
+ #
102
104
  def with(block = nil, on_restart: nil, **with_series, &yield_block)
103
105
  block ||= yield_block
104
106
  ProcessWith.new self, with_series, on_restart, &block
@@ -110,16 +112,6 @@ module Musa
110
112
  ProcessWith.new self, &yield_block
111
113
  end
112
114
 
113
- # TODO: test case
114
- def slave
115
- slave_serie = Slave.new self
116
-
117
- @_slaves ||= []
118
- @_slaves << slave_serie
119
-
120
- slave_serie
121
- end
122
-
123
115
  ###
124
116
  ### Implementation
125
117
  ###
@@ -128,42 +120,33 @@ module Musa
128
120
  include Musa::Extension::SmartProcBinder
129
121
  include Serie
130
122
 
131
- attr_reader :source, :with_sources, :on_restart, :block
123
+ attr_reader :source, :on_restart, :block
124
+ def with_sources; @sources; end
132
125
 
133
126
  def initialize(serie, with_series = nil, on_restart = nil, &block)
134
127
  @source = serie
135
- @with_sources = with_series || {}
128
+ @sources = with_series || {}
136
129
  @on_restart = on_restart
137
130
  @block = SmartProcBinder.new(block) if block_given?
138
131
 
139
132
  if @source.prototype?
140
- @with_sources = @with_sources.transform_values { |s| s.prototype }
133
+ @sources = @sources.transform_values { |s| s.prototype }
141
134
  else
142
- @with_sources = @with_sources.transform_values { |s| s.instance }
135
+ @sources = @sources.transform_values { |s| s.instance }
143
136
  end
144
137
 
145
138
  mark_regarding! @source
146
139
  end
147
140
 
148
- def _prototype
149
- @source = @source.prototype
150
- @with_sources = @with_sources.transform_values { |s| s.prototype }
151
- end
152
-
153
- def _instance
154
- @source = @source.instance
155
- @with_sources = @with_sources.transform_values { |s| s.instance }
156
- end
157
-
158
141
  def _restart
159
142
  @source.restart
160
- @with_sources.values.each { |s| s.restart }
143
+ @sources.values.each { |s| s.restart }
161
144
  @on_restart.call if @on_restart
162
145
  end
163
146
 
164
147
  def _next_value
165
148
  main = @source.next_value
166
- others = @with_sources.transform_values { |v| v.next_value }
149
+ others = @sources.transform_values { |v| v.next_value }
167
150
 
168
151
  value = nil
169
152
 
@@ -179,7 +162,7 @@ module Musa
179
162
  end
180
163
 
181
164
  def infinite?
182
- @source.infinite? && !@with_sources.values.find { |s| !s.infinite? }
165
+ @source.infinite? && !@sources.values.find { |s| !s.infinite? }
183
166
  end
184
167
  end
185
168
 
@@ -188,12 +171,13 @@ module Musa
188
171
  class Switcher
189
172
  include Serie
190
173
 
191
- attr_accessor :selector, :sources
174
+ attr_accessor :sources
175
+ def selector; @source; end
192
176
 
193
177
  def initialize(selector, indexed_series, hash_series)
194
178
 
195
- @selector = selector
196
- get = @selector.prototype? ? :prototype : :instance
179
+ @source = selector
180
+ get = @source.prototype? ? :prototype : :instance
197
181
 
198
182
  if indexed_series && !indexed_series.empty?
199
183
  @sources = indexed_series.collect(&get)
@@ -201,35 +185,26 @@ module Musa
201
185
  @sources = hash_series.clone.transform_values(&get)
202
186
  end
203
187
 
204
- if get == :_prototype
188
+ if get == :_prototype!
205
189
  @sources.freeze
206
190
  end
207
191
 
208
- mark_regarding! @selector
209
- end
210
-
211
- def _prototype
212
- @selector = @selector.prototype
213
- @sources = @sources.collect(&:prototype).freeze if @sources.is_a? Array
214
- @sources.transform_values(&:prototype).freeze if @sources.is_a? Hash
215
- end
216
-
217
- def _instance
218
- @selector = @selector.instance
219
- @sources = @sources.collect(&:instance) if @sources.is_a? Array
220
- @sources.transform_values(&:_instance) if @sources.is_a? Hash
192
+ mark_regarding! @source
221
193
  end
222
194
 
223
195
  def _restart
224
- @selector.restart
225
- @sources.each(&:restart) if @sources.is_a? Array
226
- @sources.each { |_key, serie| serie.restart } if @sources.is_a? Hash
196
+ @source.restart
197
+ if @sources.is_a? Array
198
+ @sources.each(&:restart)
199
+ elsif @sources.is_a? Hash
200
+ @sources.each { |_key, serie| serie.restart }
201
+ end
227
202
  end
228
203
 
229
204
  def _next_value
230
205
  value = nil
231
206
 
232
- index_or_key = @selector.next_value
207
+ index_or_key = @source.next_value
233
208
 
234
209
  value = @sources[index_or_key].next_value unless index_or_key.nil?
235
210
 
@@ -237,7 +212,7 @@ module Musa
237
212
  end
238
213
 
239
214
  def infinite?
240
- @selector.infinite? && @sources.any? { |serie| serie.infinite? }
215
+ @source.infinite? && @sources.any? { |serie| serie.infinite? }
241
216
  end
242
217
  end
243
218
 
@@ -246,11 +221,12 @@ module Musa
246
221
  class MultiplexSelector
247
222
  include Serie
248
223
 
249
- attr_accessor :selector, :sources
224
+ def selector; @source; end
225
+ attr_accessor :sources
250
226
 
251
227
  def initialize(selector, indexed_series, hash_series)
252
- @selector = selector
253
- get = @selector.prototype? ? :prototype : :instance
228
+ @source = selector
229
+ get = @source.prototype? ? :prototype : :instance
254
230
 
255
231
  if indexed_series && !indexed_series.empty?
256
232
  @sources = indexed_series.collect(&get)
@@ -260,32 +236,23 @@ module Musa
260
236
 
261
237
  _restart false
262
238
 
263
- if get == :_prototype
239
+ if get == :_prototype!
264
240
  @sources.freeze
265
241
  end
266
242
 
267
- mark_regarding! @selector
268
- end
269
-
270
- def _prototype
271
- @selector = @selector.prototype
272
- @sources = @sources.collect(&:prototype).freeze if @sources.is_a? Array
273
- @sources.transform_values(&:prototype).freeze if @sources.is_a? Hash
274
- end
275
-
276
- def _instance
277
- @selector = @selector.instance
278
- @sources = @sources.collect(&:instance) if @sources.is_a? Array
279
- @sources.transform_values(&:_instance) if @sources.is_a? Hash
243
+ mark_regarding! @source
280
244
  end
281
245
 
282
246
  def _restart(restart_sources = true)
283
247
  @current_value = nil
284
248
 
285
249
  if restart_sources
286
- @selector.restart
287
- @sources.each(&:restart) if @sources.is_a? Array
288
- @sources.each { |_key, serie| serie.restart } if @sources.is_a? Hash
250
+ @source.restart
251
+ if @sources.is_a? Array
252
+ @sources.each(&:restart)
253
+ elsif @sources.is_a? Hash
254
+ @sources.each { |_key, serie| serie.restart }
255
+ end
289
256
  end
290
257
 
291
258
  @first = true
@@ -295,7 +262,7 @@ module Musa
295
262
  @current_value =
296
263
  if @first || !@current_value.nil?
297
264
  @first = false
298
- index_or_key = @selector.next_value
265
+ index_or_key = @source.next_value
299
266
  unless index_or_key.nil?
300
267
  @sources.each(&:next_value)
301
268
  @sources[index_or_key].current_value
@@ -304,7 +271,7 @@ module Musa
304
271
  end
305
272
 
306
273
  def infinite?
307
- @selector.infinite? && @sources.any? { |serie| serie.infinite? }
274
+ @source.infinite? && @sources.any? { |serie| serie.infinite? }
308
275
  end
309
276
  end
310
277
 
@@ -313,11 +280,12 @@ module Musa
313
280
  class SwitchFullSerie
314
281
  include Serie
315
282
 
316
- attr_accessor :selector, :sources
283
+ def selector; @source; end
284
+ attr_accessor :sources
317
285
 
318
286
  def initialize(selector, indexed_series, hash_series)
319
- @selector = selector
320
- get = @selector.prototype? ? :prototype : :instance
287
+ @source = selector
288
+ get = @source.prototype? ? :prototype : :instance
321
289
 
322
290
  if indexed_series && !indexed_series.empty?
323
291
  @sources = indexed_series.collect(&get)
@@ -325,27 +293,15 @@ module Musa
325
293
  @sources = hash_series.clone.transform_values(&get)
326
294
  end
327
295
 
328
- if get == :_prototype
296
+ if get == :_prototype!
329
297
  @sources.freeze
330
298
  end
331
299
 
332
- mark_regarding! @selector
333
- end
334
-
335
- def _prototype
336
- @selector = @selector.prototype
337
- @sources = @sources.collect(&:prototype).freeze if @sources.is_a? Array
338
- @sources.transform_values(&:prototype).freeze if @sources.is_a? Hash
339
- end
340
-
341
- def _instance
342
- @selector = @selector.instance
343
- @sources = @sources.collect(&:instance) if @sources.is_a? Array
344
- @sources.transform_values(&:_instance) if @sources.is_a? Hash
300
+ mark_regarding! @source
345
301
  end
346
302
 
347
303
  def _restart
348
- @selector.restart
304
+ @source.restart
349
305
  @sources.each(&:restart)
350
306
  end
351
307
 
@@ -355,7 +311,7 @@ module Musa
355
311
  value = @sources[@index_or_key].next_value unless @index_or_key.nil?
356
312
 
357
313
  if value.nil?
358
- @index_or_key = @selector.next_value
314
+ @index_or_key = @source.next_value
359
315
 
360
316
  value = next_value unless @index_or_key.nil?
361
317
  end
@@ -364,7 +320,7 @@ module Musa
364
320
  end
365
321
 
366
322
  def infinite?
367
- !!(@selector.infinite? || @sources.find(&:infinite?))
323
+ !!(@source.infinite? || @sources.find(&:infinite?))
368
324
  end
369
325
  end
370
326
 
@@ -381,14 +337,6 @@ module Musa
381
337
  mark_regarding! @source
382
338
  end
383
339
 
384
- def _prototype
385
- @source = @source.prototype
386
- end
387
-
388
- def _instance
389
- @source = @source.instance
390
- end
391
-
392
340
  def _restart
393
341
  @source.restart
394
342
  end
@@ -428,13 +376,13 @@ module Musa
428
376
  mark_regarding! @source
429
377
  end
430
378
 
431
- def _prototype
432
- @source = @source.prototype
379
+ def _prototype!
380
+ super
433
381
  @condition = calculate_condition
434
382
  end
435
383
 
436
- def _instance
437
- @source = @source.instance
384
+ def _instance!
385
+ super
438
386
  @condition = calculate_condition
439
387
  end
440
388
 
@@ -462,9 +410,7 @@ module Musa
462
410
  @source.infinite?
463
411
  end
464
412
 
465
- private
466
-
467
- def calculate_condition
413
+ private def calculate_condition
468
414
  if @external_condition
469
415
  @external_condition
470
416
  elsif @times
@@ -491,14 +437,6 @@ module Musa
491
437
  mark_regarding! @source
492
438
  end
493
439
 
494
- def _prototype
495
- @source = @source.prototype
496
- end
497
-
498
- def _instance
499
- @source = @source.instance
500
- end
501
-
502
440
  def _restart(restart_sources = true)
503
441
  @position = 0
504
442
  @source.restart if restart_sources
@@ -532,14 +470,6 @@ module Musa
532
470
  mark_regarding! @source
533
471
  end
534
472
 
535
- def _prototype
536
- @source = @source.prototype
537
- end
538
-
539
- def _instance
540
- @source = @source.instance
541
- end
542
-
543
473
  def _restart(restart_sources = true)
544
474
  @source.restart if restart_sources
545
475
  @first = true
@@ -572,13 +502,13 @@ module Musa
572
502
  mark_regarding! @source
573
503
  end
574
504
 
575
- def _prototype
576
- @source = @source.prototype
505
+ def _prototype!
506
+ super
577
507
  _restart false
578
508
  end
579
509
 
580
- def _instance
581
- @source = @source.instance
510
+ def _instance!
511
+ super
582
512
  _restart false
583
513
  end
584
514
 
@@ -631,14 +561,6 @@ module Musa
631
561
  mark_regarding! @source
632
562
  end
633
563
 
634
- def _prototype
635
- @source = @source.prototype
636
- end
637
-
638
- def _instance
639
- @source = @source.instance
640
- end
641
-
642
564
  def _restart(restart_sources = true)
643
565
  if restart_sources
644
566
  @source.restart
@@ -699,14 +621,6 @@ module Musa
699
621
  mark_regarding! @source
700
622
  end
701
623
 
702
- def _prototype
703
- @source = @source.prototype
704
- end
705
-
706
- def _instance
707
- @source = @source.instance
708
- end
709
-
710
624
  def _restart(restart_source = true)
711
625
  @source.restart if restart_source
712
626
  @pending_values = []
@@ -758,14 +672,6 @@ module Musa
758
672
  mark_regarding! @source
759
673
  end
760
674
 
761
- def _prototype
762
- @source = @source.prototype
763
- end
764
-
765
- def _instance
766
- @source = @source.instance
767
- end
768
-
769
675
  def _restart
770
676
  @source.restart
771
677
  end
@@ -798,14 +704,6 @@ module Musa
798
704
  mark_regarding! @source
799
705
  end
800
706
 
801
- def _prototype
802
- @source = @source.prototype
803
- end
804
-
805
- def _instance
806
- @source = @source.instance
807
- end
808
-
809
707
  def _restart
810
708
  @source.restart
811
709
  end
@@ -831,7 +729,8 @@ module Musa
831
729
  mark_as_instance!
832
730
  end
833
731
 
834
- def _prototype
732
+ def _prototype!
733
+ # TODO review why cannot get prototype of a cut serie
835
734
  raise PrototypingSerieError, 'Cannot get prototype of a cut serie'
836
735
  end
837
736
 
@@ -871,14 +770,6 @@ module Musa
871
770
  mark_regarding! @source
872
771
  end
873
772
 
874
- def _prototype
875
- @source = @source.prototype
876
- end
877
-
878
- def _instance
879
- @source = @source.instance
880
- end
881
-
882
773
  def _restart
883
774
  @index = 0
884
775
  end
@@ -916,12 +807,8 @@ module Musa
916
807
  mark_regarding! @source
917
808
  end
918
809
 
919
- def _prototype
920
- @source = @source.prototype
921
- end
922
-
923
- def _instance
924
- @source = @source.instance
810
+ def _instance!
811
+ super
925
812
  _restart false, true
926
813
  end
927
814
 
@@ -963,22 +850,12 @@ module Musa
963
850
  mark_regarding! @source
964
851
  end
965
852
 
966
- def _prototype
967
- @source = @source.prototype
968
- end
969
-
970
- def _instance
971
- @source = @source.instance
972
- end
973
-
974
853
  def _restart(restart_sources = true)
975
854
  @source.restart if restart_sources
976
855
  @values = @source.to_a
977
856
  end
978
857
 
979
858
  def _next_value
980
- _restart(false) if @needs_restart
981
-
982
859
  if !@values.empty?
983
860
  position = @random.rand(0...@values.size)
984
861
  value = @values[position]
@@ -1011,14 +888,6 @@ module Musa
1011
888
  mark_regarding! @source
1012
889
  end
1013
890
 
1014
- def _prototype
1015
- @source = @source.prototype
1016
- end
1017
-
1018
- def _instance
1019
- @source = @source.instance
1020
- end
1021
-
1022
891
  def _restart(restart_sources = true)
1023
892
  @source.restart if restart_sources
1024
893
 
@@ -1051,14 +920,6 @@ module Musa
1051
920
  mark_regarding! @source
1052
921
  end
1053
922
 
1054
- def _prototype
1055
- @source = @source.prototype
1056
- end
1057
-
1058
- def _instance
1059
- @source = @source.instance
1060
- end
1061
-
1062
923
  def _restart(restart_sources = true)
1063
924
  @source.restart if restart_sources
1064
925
  @history.clear
@@ -1092,14 +953,6 @@ module Musa
1092
953
  mark_regarding! @source
1093
954
  end
1094
955
 
1095
- def _prototype
1096
- @source = @source.prototype
1097
- end
1098
-
1099
- def _instance
1100
- @source = @source.instance
1101
- end
1102
-
1103
956
  def _restart(restart_sources = true)
1104
957
  @source.restart if restart_sources
1105
958
  end
@@ -1128,14 +981,6 @@ module Musa
1128
981
  mark_regarding! @source
1129
982
  end
1130
983
 
1131
- def _prototype
1132
- @source = @source.prototype
1133
- end
1134
-
1135
- def _instance
1136
- @source = @source.instance
1137
- end
1138
-
1139
984
  def _restart(restart_sources = true)
1140
985
  @source.restart if restart_sources
1141
986
  end