JMSL Tutorial: Collections
In this tutorial, we introduce a stricter notion of hierarchies, specifically
as they are implemented in Collections.
A MusicJob, as you recall, is a JMSL class that does something on a schedule.
A MusicJob can be put into a hierarchy like the one shown below, because
it implements the Composable interface. The Composable interface provides methods for communicating
scheduling information from child to parent, and from parent to child.
| | |
MusicJob MusicJob MusicJob
The hierarchy shown above will launch each MusicJob in sequence,
one after the other. Each will go through its start(), repeat(), stop() cycle
before the next MusicJob gets launched.
So clearly, there has to
be a way for a MusicJob child to let its parent know when it is finished,
and for the parent to tell the next child to get started.
The Composable interface provides this means.
You really don't need to know the ins and outs of the Composable interface,
because most of the time you will be customizing predefined Composables like
MusicJob, ParallelCollection, and SequentialCollection instead of building your
own from scratch. However, for more details on this interface, see the
JMSL documentation on Composable.
Now let's find out how to build collections.
(C) 1997 Phil Burk and Nick Didkovsky, All Rights Reserved
JMSL is based upon HMSL (C) Phil Burk, Larry Polansky and David Rosenboom.