Skip to content

Commit 934f99e

Browse files
committed
iluwatar#107 JavaDoc for Strategy
1 parent ed416ac commit 934f99e

File tree

2 files changed

+45
-36
lines changed

2 files changed

+45
-36
lines changed
Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,26 @@
1-
package com.iluwatar.strategy;
2-
3-
/**
4-
*
5-
* Strategy (DragonSlayingStrategy) encapsulates an algorithm. The containing
6-
* object (DragonSlayer) can alter its behavior by changing its strategy.
7-
*
8-
*/
9-
public class App {
10-
11-
public static void main(String[] args) {
12-
System.out.println("Green dragon spotted ahead!");
13-
DragonSlayer dragonSlayer = new DragonSlayer(new MeleeStrategy());
14-
dragonSlayer.goToBattle();
15-
System.out.println("Red dragon emerges.");
16-
dragonSlayer.changeStrategy(new ProjectileStrategy());
17-
dragonSlayer.goToBattle();
18-
System.out.println("Black dragon lands before you.");
19-
dragonSlayer.changeStrategy(new SpellStrategy());
20-
dragonSlayer.goToBattle();
21-
}
22-
}
1+
package com.iluwatar.strategy;
2+
3+
/**
4+
*
5+
* Strategy ({@link DragonSlayingStrategy}) encapsulates an algorithm. The containing
6+
* object ({@link DragonSlayer}) can alter its behavior by changing its strategy.
7+
*
8+
*/
9+
public class App {
10+
11+
/**
12+
* Program entry point
13+
* @param args command line args
14+
*/
15+
public static void main(String[] args) {
16+
System.out.println("Green dragon spotted ahead!");
17+
DragonSlayer dragonSlayer = new DragonSlayer(new MeleeStrategy());
18+
dragonSlayer.goToBattle();
19+
System.out.println("Red dragon emerges.");
20+
dragonSlayer.changeStrategy(new ProjectileStrategy());
21+
dragonSlayer.goToBattle();
22+
System.out.println("Black dragon lands before you.");
23+
dragonSlayer.changeStrategy(new SpellStrategy());
24+
dragonSlayer.goToBattle();
25+
}
26+
}
Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
1-
package com.iluwatar.strategy;
2-
3-
import org.junit.Test;
4-
5-
import com.iluwatar.strategy.App;
6-
7-
public class AppTest {
8-
9-
@Test
10-
public void test() {
11-
String[] args = {};
12-
App.main(args);
13-
}
14-
}
1+
package com.iluwatar.strategy;
2+
3+
import org.junit.Test;
4+
5+
import com.iluwatar.strategy.App;
6+
7+
/**
8+
*
9+
* Application test
10+
*
11+
*/
12+
public class AppTest {
13+
14+
@Test
15+
public void test() {
16+
String[] args = {};
17+
App.main(args);
18+
}
19+
}

0 commit comments

Comments
 (0)