Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

[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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

PostgreSQL Up And Running A Practical Guide To The Advanced Open Source Database

Authors: Regina Obe, Leo Hsu

3rd Edition

1491963417, 978-1491963418

More Books

Students also viewed these Databases questions