[refactor] Remove unnecessary declarations in command pattern.

This commit is contained in:
ruslanpa 2015-02-10 09:23:59 +02:00
parent 6da9686a50
commit 0fbb4f4003
4 changed files with 4 additions and 15 deletions

View File

@ -3,8 +3,8 @@ package com.iluwatar;
public class Goblin extends Target {
public Goblin() {
this.setSize(Size.NORMAL);
this.setVisibility(Visibility.VISIBLE);
setSize(Size.NORMAL);
setVisibility(Visibility.VISIBLE);
}
@Override

View File

@ -4,10 +4,6 @@ public class InvisibilitySpell extends Command {
private Target target;
public InvisibilitySpell() {
target = null;
}
@Override
public void execute(Target target) {
target.setVisibility(Visibility.INVISIBLE);

View File

@ -3,14 +3,8 @@ package com.iluwatar;
public class ShrinkSpell extends Command {
private Size oldSize;
private Target target;
public ShrinkSpell() {
oldSize = null;
target = null;
}
@Override
public void execute(Target target) {
oldSize = target.getSize();

View File

@ -5,9 +5,8 @@ public class Wizard extends Target {
private Command previousSpell;
public Wizard() {
this.setSize(Size.NORMAL);
this.setVisibility(Visibility.VISIBLE);
previousSpell = null;
setSize(Size.NORMAL);
setVisibility(Visibility.VISIBLE);
}
public void castSpell(Command command, Target target) {