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

« back to all changes in this revision

Viewing changes to TuxGuitar/src/org/herac/tuxguitar/song/models/TGTupleto.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
/*
 
2
 * Created on 05-dic-2005
 
3
 *
 
4
 * TODO To change the template for this generated file go to
 
5
 * Window - Preferences - Java - Code Style - Code Templates
 
6
 */
 
7
package org.herac.tuxguitar.song.models;
 
8
 
 
9
import org.herac.tuxguitar.song.factory.TGFactory;
 
10
 
 
11
/**
 
12
 * @author julian
 
13
 *
 
14
 * TODO To change the template for this generated type comment go to
 
15
 * Window - Preferences - Java - Code Style - Code Templates
 
16
 */
 
17
public abstract class TGTupleto {
 
18
        public static final TGTupleto NORMAL = newTupleto(1,1);
 
19
        
 
20
        /**
 
21
         * Cantidad de Duraciones que entran en los tiempos
 
22
         */
 
23
        private int enters;
 
24
        /**
 
25
         * Tiempos
 
26
         */
 
27
        private int times;
 
28
        
 
29
        public TGTupleto(){
 
30
                this.enters = 1;
 
31
                this.times = 1;
 
32
        }
 
33
        
 
34
        public int getEnters() {
 
35
                return this.enters;
 
36
        }
 
37
        
 
38
        public void setEnters(int enters) {
 
39
                this.enters = enters;
 
40
        }
 
41
        
 
42
        public int getTimes() {
 
43
                return this.times;
 
44
        }
 
45
        
 
46
        public void setTimes(int times) {
 
47
                this.times = times;
 
48
        }
 
49
        
 
50
        public long convertTime(long time){
 
51
                return time * this.times / this.enters;
 
52
        }
 
53
        
 
54
        public boolean isEqual(TGTupleto tupleto){
 
55
                return (tupleto.getEnters() == getEnters() && tupleto.getTimes() == getTimes());
 
56
        }
 
57
        
 
58
        public TGTupleto clone(TGFactory factory){
 
59
                TGTupleto tupleto = factory.newTupleto();
 
60
                copy(tupleto);
 
61
                return tupleto;
 
62
        }
 
63
        
 
64
        public void copy(TGTupleto tupleto){
 
65
                tupleto.setEnters(this.enters);
 
66
                tupleto.setTimes(this.times);
 
67
        }
 
68
        
 
69
        private static TGTupleto newTupleto(int enters,int times){
 
70
                TGTupleto tupleto = new TGFactory().newTupleto();
 
71
                tupleto.setEnters(enters);
 
72
                tupleto.setTimes(times);
 
73
                return tupleto;
 
74
        }
 
75
        
 
76
}