X-Git-Url: https://ruin.nu/git/?p=moosique.git;a=blobdiff_plain;f=MooNote.java;h=fb73341e327f969ff51a50c23fbc5387d9f36b2b;hp=023de207da3aa053ffafff81f2febabe076ea996;hb=1f2ba8a0848ee0c5f0ea94f7bc40ea502c0dff74;hpb=a8dda23889d7c48a8b3313e2a141ed378bf8ff1c diff --git a/MooNote.java b/MooNote.java index 023de20..fb73341 100644 --- a/MooNote.java +++ b/MooNote.java @@ -7,7 +7,7 @@ import javax.sound.midi.*; * @author Einar Pehrson */ -public class MooNote extends MidiEvent implements Cloneable { +public class MooNote extends MidiEvent implements Cloneable, Comparable { private MidiEvent noteOffEvent; private ShortMessage noteOnMsg, noteOffMsg; @@ -161,4 +161,13 @@ public class MooNote extends MidiEvent implements Cloneable { new MidiEvent((ShortMessage)noteOffEvent.getMessage().clone(), noteOffEvent.getTick()) ); } + + /** + * Compares this note to another note. + * @return a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object + */ + public int compareTo(Object o) { + return (int)(((MidiEvent)o).getTick() - getTick()); + } + }