JMSL Tutorial: Collections
Finally, we want to point out that ParallelCollection and SequentialCollection
are both subclasses of MusicJob. As such, each can be customized
with PlayListeners plugged in with addStartPlayable(), addRepeatPlayable(),
and addStopPlayable().
Collections can therefore be enabled with autonomous, intelligent behavior,
building themselves on-the-fly and altering their own behavior during their
lifetime.
The applet below simply has the Collection print a message when it starts, repeats, and stops. Of course,
it could do much more interesting things, like change the behavior of its children,
generate data, plug in custom functions, etc.
You can examine the source code for this applet here.
Note that the Playable plugged in
with addRepeatPlayable() will occur after the children are launched (ie the first
time it happens will be when the first round of children are finished). This is evident
by examining the messages printed in the TextArea above.
(C) 1997 Phil Burk and Nick Didkovsky, All Rights Reserved
JMSL is based upon HMSL (C) Phil Burk, Larry Polansky and David Rosenboom.