// How many measures in a Phrase ? private double countMeasures(Phrase p) { double answer = 0.0; for (int i = 0; i < p.size(); ++i) { answer = answer + p.getNote(i).getRhythmValue(); } return answer / p.getNumerator(); }
// 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; } }