Comments for the strategy example.
This commit is contained in:
@ -1,5 +1,11 @@
|
|||||||
package com.iluwatar;
|
package com.iluwatar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Strategy (DragonSlayingStrategy) encapsulates the algorithm to use.
|
||||||
|
* The object (DragonSlayer) can alter its behavior by changing its strategy.
|
||||||
|
*
|
||||||
|
*/
|
||||||
public class App
|
public class App
|
||||||
{
|
{
|
||||||
public static void main( String[] args )
|
public static void main( String[] args )
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
package com.iluwatar;
|
package com.iluwatar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* DragonSlayer uses different strategies to slay the dragon.
|
||||||
|
*
|
||||||
|
*/
|
||||||
public class DragonSlayer {
|
public class DragonSlayer {
|
||||||
|
|
||||||
private DragonSlayingStrategy strategy;
|
private DragonSlayingStrategy strategy;
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
package com.iluwatar;
|
package com.iluwatar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Strategy interface.
|
||||||
|
*
|
||||||
|
*/
|
||||||
public interface DragonSlayingStrategy {
|
public interface DragonSlayingStrategy {
|
||||||
|
|
||||||
void execute();
|
void execute();
|
||||||
|
Reference in New Issue
Block a user