public void replace(int p, String s) {
   first();
   p--;
   for (int i = p; i >= 0; i--) {
     down();
   }
   DLLNode temp = new DLLNode(s);
   temp = cursor;
   temp.data = s;
 }
 public EditableList() {
   n = 0;
   head = new DLLNode(null);
   tail = new DLLNode(null);
   cursor = new DLLNode(null);
   head.next = tail;
   head.prev = null;
   tail.prev = head;
   tail.next = null;
   cursor = tail;
 }
 // add s after the cursor node
 // point cursor to the new node
 // (if cursor is off the end do nothing)
 public void addAfter(String s) {
   if (cursor == tail) { // do nothing!
   } else {
     DLLNode temp = new DLLNode(s);
     temp.prev = cursor;
     temp.next = cursor.next;
     cursor.next.prev = temp;
     cursor.next = temp;
     cursor = temp;
     n++;
   }
 }
  // add s before the cursor and
  // put the cursor on the new node
  public void add(String s) {

    if (cursor == head) {
      System.out.println("hit the head");
    } else {
      DLLNode temp = new DLLNode(s);
      temp.prev = cursor.prev;
      temp.next = cursor;
      cursor.prev.next = temp;
      cursor.prev = temp;
      cursor = temp;
      n++;
    }
  }