public class Voice extends java.lang.Object implements java.lang.Comparable<Voice>
Voice
is a node in the LinkedList representing a
voice. Each node has only a previous pointer and a MidiNote
.
Only a previous pointer is needed because we allow for Voices to split and clone themselves,
keeping the beginning of their note sequences identical. This allows us to have multiple
LinkedLists of notes without needing multiple full List objects. Rather, they all point
back to their common prefix LinkedLists.Modifier and Type | Field and Description |
---|---|
private MidiNote |
mostRecentNote
The most recent note of this voice.
|
private Voice |
previous
The Voice ending at second to last note in this voice.
|
Constructor and Description |
---|
Voice(MidiNote note)
Create a new Voice.
|
Voice(MidiNote note,
Voice prev)
Create a new Voice with the given previous voice.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Voice o) |
boolean |
equals(java.lang.Object o) |
MidiNote |
getMostRecentNote()
Get the most recent note in this voice.
|
java.util.List<MidiNote> |
getNotes()
Get the List of notes which this node is the tail of, in chronological order.
|
int |
getNumLinksCorrect(java.util.List<java.util.List<MidiNote>> goldStandard)
Get the number of links in this Voice which are correct.
|
int |
getNumNotes()
Get the number of notes in the linked list with this node as its tail.
|
int |
getNumNotesCorrect()
Get the number of notes we've correctly grouped into this voice, based on the most common voice in the voice.
|
Voice |
getPrevious()
Get the voice ending at the previous note in this voice.
|
java.lang.String |
toString() |
private final Voice previous
private final MidiNote mostRecentNote
public Voice(MidiNote note, Voice prev)
note
- mostRecentNote
prev
- previous
public Voice(MidiNote note)
note
- mostRecentNote
public int getNumNotesCorrect()
public int getNumLinksCorrect(java.util.List<java.util.List<MidiNote>> goldStandard)
goldStandard
- The gold standard voices for this song.public int getNumNotes()
public java.util.List<MidiNote> getNotes()
public MidiNote getMostRecentNote()
mostRecentNote
public Voice getPrevious()
previous
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object