Question: Please write this code for me . i neeed it in java and makw sure you dont change any of the codee already given and

Please write this code for me. i neeed it in java and makw sure you dont change any of the codee already given and implement all the classes and dont remove any of the classes. tysm!!
this is the editor.java
package Editor;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import MyImplementations.MyArrayList;
import MyImplementations.MyStack;
import MyImplementations.MyString;
public class Editor {
/** cursor row position */
int row;
/** cursor column position */
int col;
/** the text of the editor */
MyArrayList text;
/** the undo stack */
MyStack undoStack;
/** the redo stack */
MyStack redoStack;
// Current file name
MyString fileName;
class EditorAction {
/** the row of the action */
int row;
/** the column of the action */
int col;
/** the text of the action */
MyString text;
/** the length of the action */
int length;
/** the action type */
ActionType type;
}
enum ActionType {
/** insert action */
INSERT,
/** delete action */
DELETE,
/** replace action */
REPLACE
}
/**
* Constructor
*/
public Editor(String myFilename){
this(new MyString(myFilename));
}
public Editor(MyString fileName){
this.fileName = fileName;
undoStack = new MyStack();
redoStack = new MyStack();
open(fileName);
}
/**
* Open the file with the given name and read the contents into the editor.
*/
void open(String fileName){
open(new MyString(fileName));
}
void open(MyString fileName){
// read the file into the text
// set the cursor to the beginning of the file
// set the file name
// WRITE YOUR CODE HERE
}
/**
* Save the current text to currently open file.
*/
void save(){
saveAs(fileName);
}
/**
* Save the current text to the given file.
*/
void saveAs(String fileName){
saveAs(new MyString(fileName));
}
void saveAs(MyString fileName){
// WRITE YOUR CODE HERE
}
/**
* Undo the last action.
*/
void undo(){
// WRITE YOUR CODE HERE
}
/**
* Redo the last undone action.
*/
void redo(){
// WRITE YOUR CODE HERE
}
/**
* Save the state of the EditorAction and push it onto the undo stack. used by insert and delete
* @param type
* @param s
*/
void saveState(ActionType type, MyString s){
// WRITE YOUR CODE HERE
}
/**
* Save the state of the EditorAction and push it onto the undo stack. used by replace
* @param type
* @param s
* @param length
*/
void saveState(ActionType type, MyString s, int length){
// WRITE YOUR CODE HERE
}
/**
* Insert the given string at the current cursor position.
* The cursor position is updated to point to the end of the inserted string.
*/
void insert(String s){
insert(new MyString(s));
}
void insert(MyString s){
insert(s, true);
}
void insert(MyString s, boolean saveState){
// WRITE YOUR CODE HERE
}
void delete(int n){
delete(n, true);
}
/**
* Delete n characters at the current cursor position.
* The cursor position is updated to point to the end of the deleted string.
*/
void delete(int n, boolean saveState){
// WRITE YOUR CODE HERE
}
/**
* Replace the character at the current cursor position with the given
* character.
* The cursor position is updated to point to the end of the deleted string.
*/
void replace(int n, String s){
replace(n, new MyString(s));
}
void replace(int n, MyString s){
replace(n, s, true);
}
/**
* Replace the n characters at the current cursor position with the given string.
* The cursor position is updated to point to the end of the replaced string.
*/
void replace(int n, MyString s, boolean saveState){
// WRITE YOUR CODE HERE
}
/**
* Find the first instance of given string in the editor and set the cursor to
* that position.
*/
int[] find(String s){
return find(new MyString(s));
}
int[] find(MyString s){
// WRITE YOUR CODE HERE
return null;
}
/**
* Move the cursor to the given position.
*/
void moveCursor(int row, int col){
// WRITE YOUR CODE HERE
}
/**
* Return the current cursor position.
*/
int[] getCursor(){
return new int[]{row, col};
}
/**
* Move the cursor to the given position.
*/
void moveCursor(int[] rowcol){
// WRITE YOUR CODE HERE
}
/** return the entire line in row */
MyString getText(int row){
return text.get(row);
}
/** return the line in row from col to the end */
MyString getText(int row, int col){
// WRITE YOUR CODE HERE
}
/** return the line from col1 to n character length */
MyString getText(int row, int col, int n){
// WRITE YOUR CODE HERE
}
}
Implement Undo Redo
Implement Undo Redo
undo()
Redo
saveState()
Review the contents of Editor.java and TestEditor.java under Editor
directory to understand the requirements.
Use terminal to compile and run the program.
Manually Check to see if the files AntiHeros.txt and
AntiHerosViaUndo.txt are the same
Manually Check to see if the files Jokers.txt and JokersViaRedo.txt are
the same.
Editor-test
assert (editor.getText(3,3).equals(Jokers[2]));
editor.save();
// Saveas AntiHerosViaUndo.txt
editor.saveAs("AntiHerosViaUndo.txt");
// undo
editor.undo();
assert(editor.getText(3,3).equals(AntiHeros[2]));
editor.undo();
assert(editor.g
public c
assert (editor.getText(3,
Please write this code for me . i neeed it in

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!