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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started