void reverse() 
  {
    Tree prev = this.prev;
    prev.next = null;
    this.prev = null;
    Tree back = this;
    Tree tmp = this;
    // reverse the list for the other nodes
    Tree next;
    for (Tree t = this.next; t != null; back = t, t = next) {
      next = t.next;
      t.next = back;
      back.prev = t;
    }
    // reverse the list for this node
    tmp.next = prev;
    prev.prev = tmp;
  }