Question: [Java] [Command Patterns] The simple editor application consists of two files: TestEditor.java and Document.java. incomplete code: drive.google.com/drive/folders/1tH8H5xjlCUaGC7_cpw7lgyY0l5zSnxWf?usp=sharing 1. Modify this editor so you can undo/redo

[Java] [Command Patterns]

The simple editor application consists of two files: TestEditor.java and Document.java.

incomplete code: drive.google.com/drive/folders/1tH8H5xjlCUaGC7_cpw7lgyY0l5zSnxWf?usp=sharing

1. Modify this editor so you can undo/redo actions. You will probably need an invoker.

2. Implement a parametrized multi-level undo / redo

myDocument.Write("Hey I just met you");

myDocument.Write("And this is crazy");

myDocument.Write("But heres my number");

myDocument.Undo(0);

System.out.println(myDocument.Read());

Will give the following output:

---- Contents of: callmemaybe ----

0:And this is crazy

1:But heres my number

and

myDocument.Write("Hey I just met you");

myDocument.Write("And this is crazy");

myDocument.Write("But heres my number");

myDocument.Undo(2);

System.out.println(myDocument.Read());

The following output:

---- Contents of: callmemaybe ----

0:Hey I just met you

1:And this is crazy

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 Databases Questions!