Skip to content

Commit 0fbb4f4

Browse files
committed
[refactor] Remove unnecessary declarations in command pattern.
1 parent 6da9686 commit 0fbb4f4

File tree

4 files changed

+4
-15
lines changed

4 files changed

+4
-15
lines changed

command/src/main/java/com/iluwatar/Goblin.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
public class Goblin extends Target {
44

55
public Goblin() {
6-
this.setSize(Size.NORMAL);
7-
this.setVisibility(Visibility.VISIBLE);
6+
setSize(Size.NORMAL);
7+
setVisibility(Visibility.VISIBLE);
88
}
99

1010
@Override

command/src/main/java/com/iluwatar/InvisibilitySpell.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@ public class InvisibilitySpell extends Command {
44

55
private Target target;
66

7-
public InvisibilitySpell() {
8-
target = null;
9-
}
10-
117
@Override
128
public void execute(Target target) {
139
target.setVisibility(Visibility.INVISIBLE);

command/src/main/java/com/iluwatar/ShrinkSpell.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,8 @@
33
public class ShrinkSpell extends Command {
44

55
private Size oldSize;
6-
76
private Target target;
87

9-
public ShrinkSpell() {
10-
oldSize = null;
11-
target = null;
12-
}
13-
148
@Override
159
public void execute(Target target) {
1610
oldSize = target.getSize();

command/src/main/java/com/iluwatar/Wizard.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@ public class Wizard extends Target {
55
private Command previousSpell;
66

77
public Wizard() {
8-
this.setSize(Size.NORMAL);
9-
this.setVisibility(Visibility.VISIBLE);
10-
previousSpell = null;
8+
setSize(Size.NORMAL);
9+
setVisibility(Visibility.VISIBLE);
1110
}
1211

1312
public void castSpell(Command command, Target target) {

0 commit comments

Comments
 (0)