repeatNextInserting
Here is the code from class on 21 Sept. 2005. Copy-paste this into your SongNode class, then Compile All, if you want to use it in your HW4.
/**
* Repeat the input phrase for the number of times specified.
* But do an insertion, to save the rest of the list.
* @param nextOne node to be copied into the list
* @param count number of times to copy it in.
**/
public void repeatNextInserting(SongNode nextOne, int count){
SongNode current = this; // Start from here
SongNode copy; // Where we keep the current copy
for (int i=1; i <= count; i++)
{
copy = nextOne.copyNode(); // Make a copy
current.insertAfter(copy); // INSERT after current
current = copy; // Now append to copy
}
}
Links to this Page
- Syllabus-Fall 2005 last edited on 15 November 2005 at 10:53 am by lawn-199-77-210-179.lawn.gatech.edu
- Homeworks-Fall 2005 last edited on 6 March 2006 at 8:51 pm by user-11215qe.dsl.mindspring.com