Files
java-design-patterns/command/src/main/java/com/iluwatar/App.java

28 lines
625 B
Java
Raw Normal View History

2014-08-17 14:42:10 +03:00
package com.iluwatar;
2014-08-31 10:56:56 +03:00
/**
*
* In Command pattern actions are objects that can
* be executed and undone. The commands in this example
* are spells cast by the wizard on the goblin.
*
*/
2014-08-17 14:42:10 +03:00
public class App
{
public static void main( String[] args )
{
Wizard wizard = new Wizard();
Goblin goblin = new Goblin();
goblin.printStatus();
wizard.castSpell(new ShrinkSpell(), goblin);
goblin.printStatus();
wizard.castSpell(new InvisibilitySpell(), goblin);
goblin.printStatus();
wizard.undoLastSpell();
goblin.printStatus();
}
}