// Move all notes from one Phrase to another private void moveAll(Phrase fromPhrase, Phrase toPhrase) { Note theNote; while ((fromPhrase.size() > 0)) { theNote = fromPhrase.getNote(0); toPhrase.addNote(theNote); fromPhrase.removeNote(0); } }
// Recombine before, Phrase and after into longer Phrase public static void zoomOut(Phrase before, Phrase thePhrase, Phrase after) { for (int i = 0; i < thePhrase.size(); ++i) { before.addNote(thePhrase.getNote(i)); } for (int i = 0; i < after.size(); ++i) { before.addNote(after.getNote(i)); } thePhrase.empty(); for (int i = 0; i < before.size(); ++i) { thePhrase.addNote(before.getNote(i)); } before.empty(); after.empty(); }
// Move measures from the start of one Phrase to another private void moveMeasures(Phrase fromPhrase, Phrase toPhrase, double nMeasures) { double beatCount = nMeasures * fromPhrase.getNumerator(); double beatValue; Note theNote; while ((beatCount > 0.005) && (fromPhrase.size() > 0)) { theNote = fromPhrase.getNote(0); beatValue = theNote.getRhythmValue(); toPhrase.addNote(theNote); fromPhrase.removeNote(0); beatCount -= beatValue; } }