public interface SimpleTextEditor { /* This is a simple text editor interface, which assumes a text editor is built for a file consisting of lines of text. Each line of text is to be viewed as a separate String. In addition, this editor has a cursor associated with some line in the text. Initially, the cursor is set to the the line (-1) just before the first line in the text (which initially doesn't even exist yet). The methods of the text editor are designed to update and print the text file using the cursor. */ public boolean isEmpty(); // Return true iff the text is completely empty (and cursor is at line -1) public int size(); // Return the current number of lines of text. public boolean isCursorAtLastLine(); // Return true iff the cursor is at the last line in the text or // the text is empty. public void cursorDown() throws BoundaryViolationException; // Set the cursor to be the text line after its current position. public void cursorUp() throws BoundaryViolationException; // Set the cursor to be the text line before its current position. public void moveCursorToLine(int i) throws BoundaryViolationException; // Set the cursor to be the line ranked i (the first line is line 0). public int cursorLineNum(); // Return the line number (rank) of the current cursor line. public void insertAfterCursor(String s); // Insert String s in the line after the current cursor, moving the // cursor to the line inserted. public void insertBeforeCursor(String s) throws BoundaryViolationException; // Insert String s in the line before the current cursor, moving the // cursor to the line inserted. public void replaceAtCursor(String s) throws BoundaryViolationException; // Replace the String at the current cursor with the String s, keeping // the cursor at this line. public void removeAtCursor() throws BoundaryViolationException; // Remove the entire (String) line at the current cursor; setting the cursor // to now be the position of the next line, unless the cursor was the last // line, in which case the cursor should move to the new last line. public void print(); // Print the entire text to the console. }