~ubuntu-branches/ubuntu/oneiric/tuxguitar/oneiric

« back to all changes in this revision

Viewing changes to TuxGuitar/src/org/herac/tuxguitar/song/models/TGScale.java

  • Committer: Bazaar Package Importer
  • Author(s): Philippe Coval
  • Date: 2008-06-19 00:30:30 UTC
  • mto: (5.1.2 sid)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20080619003030-h719szrhsngou7c6
Tags: upstream-1.0
ImportĀ upstreamĀ versionĀ 1.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
package org.herac.tuxguitar.song.models;
 
2
 
 
3
public abstract class TGScale {
 
4
        private final boolean[] notes = new boolean[12];
 
5
        
 
6
        private int key;
 
7
        
 
8
        public TGScale(){
 
9
                this.clear();
 
10
        }
 
11
        
 
12
        public void setKey(int key){
 
13
                this.key = key;
 
14
        }
 
15
        
 
16
        public int getKey(){
 
17
                return this.key;
 
18
        }
 
19
        
 
20
        public void setNote(int note,boolean on){
 
21
                this.notes[note] = on;
 
22
        }
 
23
        
 
24
        public boolean getNote(int note){
 
25
                return this.notes[((note + (12 - this.key)) % 12)];
 
26
        }
 
27
        
 
28
        public void clear(){
 
29
                this.setKey(0);
 
30
                for(int i = 0; i < this.notes.length; i++){
 
31
                        this.setNote(i,false);
 
32
                }
 
33
        }
 
34
        
 
35
}