/Users/lyon/j4p/src/sound/musica/Scale.java

1    /** 
2     * Created by IntelliJ IDEA. 
3     * User: dlyon 
4     * Date: Oct 27, 2003 
5     * Time: 2:15:52 PM 
6     * To change this template use Options | File Templates. 
7     */ 
8    package sound.musica; 
9     
10   public class Scale implements ScaleInterface { 
11       //- Define Scales 
12       private int[] intervals = null; 
13       private String name; 
14    
15       public Scale(String _name, int _intervals[]) { 
16           intervals = _intervals; 
17           name = _name; 
18       } 
19    
20       public int[] getIntervals() { 
21           return intervals; 
22       } 
23    
24       public String toString() { 
25           String s = "Intervals: for "+name+"\t"; 
26           int j = 1; 
27           for (int i = 0; i < intervals.length; i++) 
28               s += "\t" + intervals[i]; 
29           s += "\nSequence:\t"; 
30    
31           for (int i = 0; i < intervals.length; i++) { 
32               j += intervals[i]; 
33               s += "\t" + j; 
34           } 
35           return s; 
36       } 
37    
38       public String getName() { 
39           return name; 
40       } 
41   } 
42