Change Contents of the Bubble
View this PageEdit this PageUploads to this PageHistory of this PageHomeRecent ChangesSearchHelp Guide


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