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

« back to all changes in this revision

Viewing changes to TuxGuitar-tef/src/org/herac/tuxguitar/io/tef/base/TESong.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.io.tef.base;
 
2
 
 
3
import java.util.ArrayList;
 
4
import java.util.Iterator;
 
5
import java.util.List;
 
6
 
 
7
public class TESong {
 
8
        
 
9
        private int strings;
 
10
        private int measures;
 
11
        private TEInfo info;
 
12
        private TETempo tempo;
 
13
        private TETimeSignature timeSignature;
 
14
        private TERepeat[] repeats;
 
15
        private TEText[] texts;
 
16
        private TEChord[] chords;
 
17
        private TEPercussion[] percussions;
 
18
        private TERhythm[] rhythms;
 
19
        private TETrack[] tracks;
 
20
        private List components;
 
21
        private List tsChanges;
 
22
        
 
23
        public TESong(){
 
24
                this.components = new ArrayList();
 
25
                this.tsChanges = new ArrayList();
 
26
        }
 
27
        
 
28
        public TERhythm[] getRhythms() {
 
29
                return this.rhythms;
 
30
        }
 
31
        
 
32
        public void setRhythms(int length) {
 
33
                this.rhythms = new TERhythm[length];
 
34
        }
 
35
        
 
36
        public void setRhythm(int index,TERhythm rhythm) {
 
37
                this.rhythms[index] = rhythm;
 
38
        }
 
39
        
 
40
        public TEPercussion[] getPercussions() {
 
41
                return this.percussions;
 
42
        }
 
43
        
 
44
        public void setPercussions(int length) {
 
45
                this.percussions = new TEPercussion[length];
 
46
        }
 
47
        
 
48
        public void setPercussion(int index,TEPercussion percussions) {
 
49
                this.percussions[index] = percussions;
 
50
        }
 
51
        
 
52
        public TEChord[] getChords() {
 
53
                return this.chords;
 
54
        }
 
55
        
 
56
        public void setChords(int length) {
 
57
                this.chords = new TEChord[length];
 
58
        }
 
59
        
 
60
        public void setChord(int index,TEChord chord) {
 
61
                this.chords[index] = chord;
 
62
        }
 
63
        
 
64
        public TEInfo getInfo() {
 
65
                return this.info;
 
66
        }
 
67
        
 
68
        public void setInfo(TEInfo info) {
 
69
                this.info = info;
 
70
        }
 
71
        
 
72
        public TERepeat[] getRepeats() {
 
73
                return this.repeats;
 
74
        }
 
75
        
 
76
        public void setRepeats(int length) {
 
77
                this.repeats = new TERepeat[length];
 
78
        }
 
79
        
 
80
        public void setRepeat(int index,TERepeat repeat) {
 
81
                this.repeats[index] = repeat;
 
82
        }
 
83
        
 
84
        public TEText[] getTexts() {
 
85
                return this.texts;
 
86
        }
 
87
        
 
88
        public void setTexts(int length) {
 
89
                this.texts = new TEText[length];
 
90
        }
 
91
        
 
92
        public void setText(int index,TEText text) {
 
93
                this.texts[index] = text;
 
94
        }
 
95
        
 
96
        public TETrack[] getTracks() {
 
97
                return this.tracks;
 
98
        }
 
99
        
 
100
        public void setTracks(int length) {
 
101
                this.tracks = new TETrack[length];
 
102
        }
 
103
        
 
104
        public void setTrack(int index,TETrack track) {
 
105
                this.tracks[index] = track;
 
106
        }
 
107
        
 
108
        public TETimeSignature getTimeSignature() {
 
109
                return this.timeSignature;
 
110
        }
 
111
        
 
112
        public void setTimeSignature(TETimeSignature timeSignature) {
 
113
                this.timeSignature = timeSignature;
 
114
        }
 
115
        
 
116
        public TETempo getTempo() {
 
117
                return this.tempo;
 
118
        }
 
119
        
 
120
        public void setTempo(TETempo tempo) {
 
121
                this.tempo = tempo;
 
122
        }
 
123
        
 
124
        public int getStrings() {
 
125
                return this.strings;
 
126
        }
 
127
        
 
128
        public void setStrings(int strings) {
 
129
                this.strings = strings;
 
130
        }
 
131
        
 
132
        public int getMeasures() {
 
133
                return this.measures;
 
134
        }
 
135
        
 
136
        public void setMeasures(int measures) {
 
137
                this.measures = measures;
 
138
        }
 
139
        
 
140
        public List getComponents() {
 
141
                return this.components;
 
142
        }
 
143
        
 
144
        public void addTimeSignatureChange(TETimeSignatureChange tsChange){
 
145
                this.tsChanges.add(tsChange);
 
146
        }
 
147
        
 
148
        public TETimeSignature getTimeSignature(int measure){
 
149
                Iterator it = this.tsChanges.iterator();
 
150
                while(it.hasNext()){
 
151
                        TETimeSignatureChange change = (TETimeSignatureChange)it.next();
 
152
                        if(change.getMeasure() == measure){
 
153
                                return change.getTimeSignature();
 
154
                        }
 
155
                }
 
156
                return getTimeSignature();
 
157
        }
 
158
        
 
159
        public String toString(){
 
160
                String string = new String("[SONG] *** Tabledit file format ***\n");
 
161
                string +=  (this.getInfo().toString() + "\n");
 
162
                string +=  (this.getTempo().toString() + "\n");
 
163
                for(int i = 0; i < this.repeats.length; i ++){
 
164
                        string +=  (this.repeats[i].toString() + "\n");
 
165
                }
 
166
                for(int i = 0; i < this.texts.length; i ++){
 
167
                        string +=  (this.texts[i].toString() + "\n");
 
168
                }
 
169
                for(int i = 0; i < this.chords.length; i ++){
 
170
                        string +=  (this.chords[i].toString() + "\n");
 
171
                }
 
172
                for(int i = 0; i < this.percussions.length; i ++){
 
173
                        string +=  (this.percussions[i].toString() + "\n");
 
174
                }
 
175
                for(int i = 0; i < this.rhythms.length; i ++){
 
176
                        string +=  (this.rhythms[i].toString() + "\n");
 
177
                }
 
178
                for(int i = 0; i < this.tracks.length; i ++){
 
179
                        string +=  (this.tracks[i].toString() + "\n");
 
180
                }
 
181
                for(int i = 0; i < this.components.size(); i ++){
 
182
                        string +=  (this.components.get(i).toString() + "\n");
 
183
                }
 
184
                return string;
 
185
        }
 
186
}