Cleanup code

This commit is contained in:
Rakesh Venkatesh 2020-08-04 16:34:41 +02:00
parent b9f17824fa
commit f234baf258
3 changed files with 12 additions and 13 deletions

View File

@ -75,19 +75,18 @@ public class Wizard {
Next we present the spell hierarchy. Next we present the spell hierarchy.
```java ```java
public abstract class Command { public interface Command {
public abstract void execute(Target target); void execute(Target target);
public abstract void undo(); void undo();
public abstract void redo(); void redo();
@Override String toString();
public abstract String toString();
} }
public class InvisibilitySpell extends Command { public class InvisibilitySpell implements Command {
private Target target; private Target target;
@ -117,7 +116,7 @@ public class InvisibilitySpell extends Command {
} }
} }
public class ShrinkSpell extends Command { public class ShrinkSpell implements Command {
private Size oldSize; private Size oldSize;
private Target target; private Target target;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 75 KiB

View File

@ -4,7 +4,7 @@ package com.iluwatar.command {
+ App() + App()
+ main(args : String[]) {static} + main(args : String[]) {static}
} }
abstract class Command { interface Command {
+ Command() + Command()
+ execute(Target) {abstract} + execute(Target) {abstract}
+ redo() {abstract} + redo() {abstract}
@ -78,6 +78,6 @@ InvisibilitySpell --> "-target" Target
ShrinkSpell --> "-target" Target ShrinkSpell --> "-target" Target
Target --> "-visibility" Visibility Target --> "-visibility" Visibility
Goblin --|> Target Goblin --|> Target
InvisibilitySpell --|> Command InvisibilitySpell ..|> Command
ShrinkSpell --|> Command ShrinkSpell ..|> Command
@enduml @enduml