}
double endTime = part.getEndTime();
//if to is shorter then the actual part, make a truncated copy
if(to < endTime) {
Part copy = part.copy(0.0, to);
part.empty();
part.addPhraseList(copy.getPhraseArray());
return;
} // other wise add cycles of itself to itself
// go through each whole cycle that needs to be gone through.
int startPoint = 1;
double cycleAt = to;
for(cycleAt = to; (int)(cycleAt/endTime) > 1; cycleAt -= endTime) {
Phrase [] phrases = part.getPhraseArray(); //go through phrases
for(int i=0; i<phrases.length; i++) {
//setStartTime to make it in phase with that cycle
phrases[i].setStartTime(phrases[i].getStartTime()+
startPoint*endTime);
part.addPhrase(phrases[i]);
}
startPoint++;
}
// copy in the remainding stuff in
double remainder = (to - (startPoint*endTime));
if( remainder > 0.0) {
Part copy = part.copy(0.0, remainder, true, true, false);
Phrase [] phrases = copy.getPhraseArray(); //go through phrases
for(int i=0; i<phrases.length; i++) {
//setStartTime to make it in phase with that cycle
phrases[i].setStartTime(phrases[i].getStartTime()+
startPoint*endTime);
part.addPhrase(phrases[i]);