advanced linked lists listing continued defines private storage class for creating the list nodes class _editbuffernode def __init__selftext )self text text self prev none self next none constructor the constructor is defined in lines - of listing the firstline and lastline reference variables act as the head and tail pointers for the doubly linked list the number of lines in the buffer is maintained using numlines and the current entry mode is specified by the boolean insertmode the current cursor position within the buffer must be trackedwhich is done using curline and curcolndx the former is linked list external reference since it points to node in the doubly linked list and the latter is an index value referencing position within the vector for the current line the line number on which the cursor is currently positioned is also maintained since it will be needed by the getline(method the adt definition calls for newly created buffer to be initially set to empty while an empty buffer contains no visible charactersit will contain single blank line that consists of lone newline character node is created and initialized with vector containing single newline character the nodes in the doubly linked list will be instances of the editbuffernode classthe definition of which is provided in lines - the cursor is initially placed at the home positionwhich in an empty document corresponds to the newline character in the newly created blank line finallythe initial entry mode is set to insert mode cursor movement number of operations in the edit buffer adt handle movement of the cursorwhich allows for character manipulation at different points in the buffer these routines modify the current cursor position by appropriately adjusting the curlinecurlinendxand curcolndx fields vertical movement of the cursor is handled by four methodsmovedochome()movedocend()movedown()and moveup(the cursor can be moved up or down one line or multiple lines at time but it can never be moved outside the valid range implementation of the moveup(method is provided in lines - of listing by definitionthe number of lines the cursor is to be moved must be positiveotherwise the cursor is not moved in additionthe cursor cannot be moved further up than the first line in the document these conditions are evaluated by the first two logical expressions if nlines would result in the cursor being moved beyond the first linenlines has to be adjusted to limit the movement to the first line nexta for loop is used to move the curline reference up the indicated number of