com.softsynth.jmsl
Interface DimensionComparison
- All Known Implementing Classes:
- CompareDim
public interface DimensionComparison
Used to write your own MusicShape sorting method.
Each element in a MusicShape is an array of double.
For example the double array {1.0, 65.0, 120.0} might be one
element of a three dimensional MusicShape. This element could representing midi
note 65 played with velocity 120 for a duration of 1.0 seconds.
A MusicShape might have a few or hundreds of such elements.
This interface defines a class that can be used to sort the elements of a MusicShape.
MusicShape has a sort method with this signature:
// Sort elements start through end along dimension dim
// using a class that implements DimensionComparison
public void sort(int start,
int end,
int dim,
DimensionComparison cf)
- Author:
- Nick Didkovskyand Phil Burk
Method Summary |
int |
compare(double[] e1,
double[] e2,
int dim)
Custom comparison method. |
compare
int compare(double[] e1,
double[] e2,
int dim)
- Custom comparison method.
- Returns:
- -1 if (e1 lt e2), 0 if (e1 eq e2), 1 if (e1 gt e2)