-
Notifications
You must be signed in to change notification settings - Fork 0
/
Chord.java
50 lines (43 loc) · 957 Bytes
/
Chord.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/**
* Class that contains the midi representation of notes in a chord and the name of the
* chord itself. To be used in the ChordTraverser project.
* By Micah Nacht
* November 2015
*/
import java.util.*;
public class Chord{
private List<Integer> notes;
private String name;
/**
* Constructor that takes in arguments for the note values and name of the chord.
*/
public Chord(String name, List<Integer> notes){
this.notes = notes;
this.name = name;
}
/**
* Returns the list of notes held in this chord.
*/
public List<Integer> getNotes(){
return notes;
}
/**
* Returns a particular note in this chord.
*/
public int getNote(int index) throws IndexOutOfBoundsException{
return notes.get(index);
}
/**
* Returs the name of this chord.
* TODO: combine with toString.
*/
public String getName(){
return name;
}
/**
* Also returns the name of this chord.
*/
public String toString(){
return name;
}
}