mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-10-14 02:16:06 +00:00
fix: Minor misspelling (#3161)
This commit is contained in:
1 parent
f0f4c7d4c0
commit
49172dd5be
5 files changed
+7
-7
No files matched your search
@@ -127,7 +127,7 @@ public class LambdaStrategy {
|
|||||||
|
|
||||||
public enum Strategy implements DragonSlayingStrategy {
|
public enum Strategy implements DragonSlayingStrategy {
|
||||||
MeleeStrategy(() -> LOGGER.info(
|
MeleeStrategy(() -> LOGGER.info(
|
||||||
"With your Excalibur you severe the dragon's head!")),
|
"With your Excalibur you sever the dragon's head!")),
|
||||||
ProjectileStrategy(() -> LOGGER.info(
|
ProjectileStrategy(() -> LOGGER.info(
|
||||||
"You shoot the dragon with the magical crossbow and it falls dead on the ground!")),
|
"You shoot the dragon with the magical crossbow and it falls dead on the ground!")),
|
||||||
SpellStrategy(() -> LOGGER.info(
|
SpellStrategy(() -> LOGGER.info(
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ public class LambdaStrategy {
|
|||||||
|
|
||||||
public enum Strategy implements DragonSlayingStrategy {
|
public enum Strategy implements DragonSlayingStrategy {
|
||||||
MeleeStrategy(() -> LOGGER.info(
|
MeleeStrategy(() -> LOGGER.info(
|
||||||
"With your Excalibur you severe the dragon's head!")),
|
"With your Excalibur you sever the dragon's head!")),
|
||||||
ProjectileStrategy(() -> LOGGER.info(
|
ProjectileStrategy(() -> LOGGER.info(
|
||||||
"You shoot the dragon with the magical crossbow and it falls dead on the ground!")),
|
"You shoot the dragon with the magical crossbow and it falls dead on the ground!")),
|
||||||
SpellStrategy(() -> LOGGER.info(
|
SpellStrategy(() -> LOGGER.info(
|
||||||
|
|||||||
+3
-3
@@ -127,7 +127,7 @@ public class App {
|
|||||||
// Java 8 functional implementation Strategy pattern
|
// Java 8 functional implementation Strategy pattern
|
||||||
LOGGER.info(GREEN_DRAGON_SPOTTED);
|
LOGGER.info(GREEN_DRAGON_SPOTTED);
|
||||||
dragonSlayer = new DragonSlayer(
|
dragonSlayer = new DragonSlayer(
|
||||||
() -> LOGGER.info("With your Excalibur you severe the dragon's head!"));
|
() -> LOGGER.info("With your Excalibur you sever the dragon's head!"));
|
||||||
dragonSlayer.goToBattle();
|
dragonSlayer.goToBattle();
|
||||||
LOGGER.info(RED_DRAGON_EMERGES);
|
LOGGER.info(RED_DRAGON_EMERGES);
|
||||||
dragonSlayer.changeStrategy(() -> LOGGER.info(
|
dragonSlayer.changeStrategy(() -> LOGGER.info(
|
||||||
@@ -162,13 +162,13 @@ Program output:
|
|||||||
13:06:36.634 [main] INFO com.iluwatar.strategy.App -- Black dragon lands before you.
|
13:06:36.634 [main] INFO com.iluwatar.strategy.App -- Black dragon lands before you.
|
||||||
13:06:36.634 [main] INFO com.iluwatar.strategy.SpellStrategy -- You cast the spell of disintegration and the dragon vaporizes in a pile of dust!
|
13:06:36.634 [main] INFO com.iluwatar.strategy.SpellStrategy -- You cast the spell of disintegration and the dragon vaporizes in a pile of dust!
|
||||||
13:06:36.634 [main] INFO com.iluwatar.strategy.App -- Green dragon spotted ahead!
|
13:06:36.634 [main] INFO com.iluwatar.strategy.App -- Green dragon spotted ahead!
|
||||||
13:06:36.634 [main] INFO com.iluwatar.strategy.App -- With your Excalibur you severe the dragon's head!
|
13:06:36.634 [main] INFO com.iluwatar.strategy.App -- With your Excalibur you sever the dragon's head!
|
||||||
13:06:36.634 [main] INFO com.iluwatar.strategy.App -- Red dragon emerges.
|
13:06:36.634 [main] INFO com.iluwatar.strategy.App -- Red dragon emerges.
|
||||||
13:06:36.635 [main] INFO com.iluwatar.strategy.App -- You shoot the dragon with the magical crossbow and it falls dead on the ground!
|
13:06:36.635 [main] INFO com.iluwatar.strategy.App -- You shoot the dragon with the magical crossbow and it falls dead on the ground!
|
||||||
13:06:36.635 [main] INFO com.iluwatar.strategy.App -- Black dragon lands before you.
|
13:06:36.635 [main] INFO com.iluwatar.strategy.App -- Black dragon lands before you.
|
||||||
13:06:36.635 [main] INFO com.iluwatar.strategy.App -- You cast the spell of disintegration and the dragon vaporizes in a pile of dust!
|
13:06:36.635 [main] INFO com.iluwatar.strategy.App -- You cast the spell of disintegration and the dragon vaporizes in a pile of dust!
|
||||||
13:06:36.635 [main] INFO com.iluwatar.strategy.App -- Green dragon spotted ahead!
|
13:06:36.635 [main] INFO com.iluwatar.strategy.App -- Green dragon spotted ahead!
|
||||||
13:06:36.637 [main] INFO com.iluwatar.strategy.LambdaStrategy -- With your Excalibur you severe the dragon's head!
|
13:06:36.637 [main] INFO com.iluwatar.strategy.LambdaStrategy -- With your Excalibur you sever the dragon's head!
|
||||||
13:06:36.637 [main] INFO com.iluwatar.strategy.App -- Red dragon emerges.
|
13:06:36.637 [main] INFO com.iluwatar.strategy.App -- Red dragon emerges.
|
||||||
13:06:36.637 [main] INFO com.iluwatar.strategy.LambdaStrategy -- You shoot the dragon with the magical crossbow and it falls dead on the ground!
|
13:06:36.637 [main] INFO com.iluwatar.strategy.LambdaStrategy -- You shoot the dragon with the magical crossbow and it falls dead on the ground!
|
||||||
13:06:36.637 [main] INFO com.iluwatar.strategy.App -- Black dragon lands before you.
|
13:06:36.637 [main] INFO com.iluwatar.strategy.App -- Black dragon lands before you.
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ public class App {
|
|||||||
// Java 8 functional implementation Strategy pattern
|
// Java 8 functional implementation Strategy pattern
|
||||||
LOGGER.info(GREEN_DRAGON_SPOTTED);
|
LOGGER.info(GREEN_DRAGON_SPOTTED);
|
||||||
dragonSlayer = new DragonSlayer(
|
dragonSlayer = new DragonSlayer(
|
||||||
() -> LOGGER.info("With your Excalibur you severe the dragon's head!"));
|
() -> LOGGER.info("With your Excalibur you sever the dragon's head!"));
|
||||||
dragonSlayer.goToBattle();
|
dragonSlayer.goToBattle();
|
||||||
LOGGER.info(RED_DRAGON_EMERGES);
|
LOGGER.info(RED_DRAGON_EMERGES);
|
||||||
dragonSlayer.changeStrategy(() -> LOGGER.info(
|
dragonSlayer.changeStrategy(() -> LOGGER.info(
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public class LambdaStrategy {
|
|||||||
*/
|
*/
|
||||||
public enum Strategy implements DragonSlayingStrategy {
|
public enum Strategy implements DragonSlayingStrategy {
|
||||||
MELEE_STRATEGY(() -> LOGGER.info(
|
MELEE_STRATEGY(() -> LOGGER.info(
|
||||||
"With your Excalibur you severe the dragon's head!")),
|
"With your Excalibur you sever the dragon's head!")),
|
||||||
PROJECTILE_STRATEGY(() -> LOGGER.info(
|
PROJECTILE_STRATEGY(() -> LOGGER.info(
|
||||||
"You shoot the dragon with the magical crossbow and it falls dead on the ground!")),
|
"You shoot the dragon with the magical crossbow and it falls dead on the ground!")),
|
||||||
SPELL_STRATEGY(() -> LOGGER.info(
|
SPELL_STRATEGY(() -> LOGGER.info(
|
||||||
|
|||||||
Reference in new issue
Block a user