2
* Created on 26-dic-2005
4
* TODO To change the template for this generated file go to
5
* Window - Preferences - Java - Code Style - Code Templates
7
package org.herac.tuxguitar.song.models.effects;
9
import java.util.ArrayList;
10
import java.util.Iterator;
11
import java.util.List;
13
import org.herac.tuxguitar.song.factory.TGFactory;
18
* TODO To change the template for this generated type comment go to
19
* Window - Preferences - Java - Code Style - Code Templates
21
public abstract class TGEffectBend {
22
public static final int SEMITONE_LENGTH = 1;
23
public static final int MAX_POSITION_LENGTH = 12;
24
public static final int MAX_VALUE_LENGTH = (SEMITONE_LENGTH * 12);
28
public TGEffectBend(){
29
this.points = new ArrayList();
32
public void addPoint(int position,int value){
33
this.points.add(new BendPoint(position,value));
36
public List getPoints(){
40
public TGEffectBend clone(TGFactory factory){
41
TGEffectBend effect = factory.newEffectBend();
42
Iterator it = getPoints().iterator();
44
BendPoint point = (BendPoint)it.next();
45
effect.addPoint(point.getPosition(),point.getValue());
50
public class BendPoint{
54
public BendPoint(int position,int value){
55
this.position = position;
59
public int getPosition() {
63
public int getValue() {
67
public long getTime(long duration){
68
return (duration * getPosition() / MAX_POSITION_LENGTH);
71
public Object clone(){
72
return new BendPoint(getPosition(),getValue());