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

« back to all changes in this revision

Viewing changes to TuxGuitar/src/org/herac/tuxguitar/song/helpers/TGSongSegment.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.helpers;
 
2
 
 
3
import java.util.ArrayList;
 
4
import java.util.List;
 
5
 
 
6
import org.herac.tuxguitar.song.factory.TGFactory;
 
7
import org.herac.tuxguitar.song.models.TGMeasureHeader;
 
8
 
 
9
public class TGSongSegment {
 
10
        private List headers;
 
11
        private List tracks;
 
12
        
 
13
        public TGSongSegment(){
 
14
                this.headers = new ArrayList();
 
15
                this.tracks = new ArrayList();
 
16
        }
 
17
        
 
18
        public List getHeaders() {
 
19
                return this.headers;
 
20
        }
 
21
        
 
22
        public List getTracks() {
 
23
                return this.tracks;
 
24
        }
 
25
        
 
26
        public void addTrack(int track,List measures){
 
27
                this.tracks.add(new TGTrackSegment(track,measures));
 
28
        }
 
29
        
 
30
        public boolean isEmpty(){
 
31
                return (this.headers.isEmpty() || this.tracks.isEmpty());
 
32
        }
 
33
        
 
34
        public TGSongSegment clone(TGFactory factory){
 
35
                TGSongSegment segment = new TGSongSegment();
 
36
                for(int i = 0;i < getHeaders().size();i++){
 
37
                        TGMeasureHeader header = (TGMeasureHeader)getHeaders().get(i);
 
38
                        segment.getHeaders().add(header.clone(factory));
 
39
                }
 
40
                for(int i = 0;i < getTracks().size();i++){
 
41
                        TGTrackSegment trackMeasure = (TGTrackSegment)getTracks().get(i);
 
42
                        segment.getTracks().add(trackMeasure.clone(factory,segment.getHeaders()));
 
43
                }
 
44
                return segment;
 
45
        }
 
46
}