com.softsynth.jmsl
Interface Behavior
- All Known Implementing Classes:
- ScoreCollectionBehavior, UniformRandomBehavior
public interface Behavior
Behavior.java
Any class implementing this interface can be plugged into a
SequentialCollection and used to choose which child to launch
when the SequentialCollection is acting behaviorally.
A SequentialCollection can either launch all its children in strict sequential
order, or it can choose which child to launch every repeat.
To act behaviorally, set its behavior function with setBehavior(Behavior b).
To act sequentially, setBehavior(null).
Example of a simple behavior function follows:
// Chooses one child with uniformly random distribution
public Composable choose(SequentialCollection col) {
return (Composable)col.get(JMSLRandom.choose(col.size()));
}
- Author:
- Phil Burk and Nick Didkovsky
choose
Composable choose(SequentialCollection col)
- choose a child to launch
- Returns:
- next Composable child to launch