package instantbach.data;
import instantbach.data.chord.ChordProperties;
import instantbach.data.chord.Note;
import java.util.ArrayList;
import instantbach.data.chord.Voice;
/**
* <p>Title: Chord Template</p>
*
* <p>Description: Represents the template for a chord, which constists of
* all possible voices in relation to note position</p>
*
* <p>Copyright: Copyright (c) 2007</p>
*
* <p>Company: </p>
*
* @author John Valentino II
* @version 1.0
*/
public class ChordTemplate implements ChordProperties {
/** Represent a list of all the possible notes for a chord */
private ArrayList<Voice> list;
/**
* Creates a template for a chord, which consists of all possible notes
*/
public ChordTemplate() {
list = new ArrayList<Voice>();
}
/**
* Adds the given voice of the givne note numeric value to this template
* @param position NotePosition
* @param numeric int
*/
public void addVoice(NotePosition position, int numeric) {
Voice voice = new Voice(position, new Note(numeric));
list.add(voice);
}
/**
* Returns the number of voices in this template
* @return int
*/
public int size() {
return list.size();
}
/**
* Returns the voice at the given index
* @param index int
* @return Voice
*/
public Voice getVoice(int index) {
if (index > -1 && index < size())
return list.get(index);
else
return null;
}
/**
* Returns the note numeric value at the given index
* @param index int
* @return int
*/
public int getNoteNumeric(int index) {
if (index > -1 && index < size()) {
Voice voice = list.get(index);
return voice.getNoteNumeric();
} else
return -1;
}
}