[refactor] Remove unnecessary declarations in command pattern.
This commit is contained in:
parent
6da9686a50
commit
0fbb4f4003
@ -3,8 +3,8 @@ package com.iluwatar;
|
|||||||
public class Goblin extends Target {
|
public class Goblin extends Target {
|
||||||
|
|
||||||
public Goblin() {
|
public Goblin() {
|
||||||
this.setSize(Size.NORMAL);
|
setSize(Size.NORMAL);
|
||||||
this.setVisibility(Visibility.VISIBLE);
|
setVisibility(Visibility.VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -4,10 +4,6 @@ public class InvisibilitySpell extends Command {
|
|||||||
|
|
||||||
private Target target;
|
private Target target;
|
||||||
|
|
||||||
public InvisibilitySpell() {
|
|
||||||
target = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(Target target) {
|
public void execute(Target target) {
|
||||||
target.setVisibility(Visibility.INVISIBLE);
|
target.setVisibility(Visibility.INVISIBLE);
|
||||||
|
@ -3,14 +3,8 @@ package com.iluwatar;
|
|||||||
public class ShrinkSpell extends Command {
|
public class ShrinkSpell extends Command {
|
||||||
|
|
||||||
private Size oldSize;
|
private Size oldSize;
|
||||||
|
|
||||||
private Target target;
|
private Target target;
|
||||||
|
|
||||||
public ShrinkSpell() {
|
|
||||||
oldSize = null;
|
|
||||||
target = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(Target target) {
|
public void execute(Target target) {
|
||||||
oldSize = target.getSize();
|
oldSize = target.getSize();
|
||||||
|
@ -5,9 +5,8 @@ public class Wizard extends Target {
|
|||||||
private Command previousSpell;
|
private Command previousSpell;
|
||||||
|
|
||||||
public Wizard() {
|
public Wizard() {
|
||||||
this.setSize(Size.NORMAL);
|
setSize(Size.NORMAL);
|
||||||
this.setVisibility(Visibility.VISIBLE);
|
setVisibility(Visibility.VISIBLE);
|
||||||
previousSpell = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void castSpell(Command command, Target target) {
|
public void castSpell(Command command, Target target) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user