Skip to content

Commit b12243b

Browse files
committed
Improved code comments for template method example.
1 parent 9916530 commit b12243b

File tree

4 files changed

+16
-3
lines changed

4 files changed

+16
-3
lines changed

template-method/src/main/java/com/iluwatar/App.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@
22

33
/**
44
*
5-
* Template Method (StealingMethod) defines skeleton for the algorithm and
6-
* subclasses (HitAndRunMethod, SubtleMethod) fill in the blanks.
5+
* Template Method defines a skeleton for an algorithm. The algorithm subclasses
6+
* provide implementation for the blank parts.
7+
*
8+
* In this example HalflingThief contains StealingMethod that can be changed.
9+
* First the thief hits with HitAndRunMethod and then with SubtleMethod.
710
*
811
*/
912
public class App {

template-method/src/main/java/com/iluwatar/HitAndRunMethod.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
package com.iluwatar;
22

3+
/**
4+
*
5+
* HitAndRunMethod implementation of StealingMethod.
6+
*
7+
*/
38
public class HitAndRunMethod extends StealingMethod {
49

510
@Override

template-method/src/main/java/com/iluwatar/StealingMethod.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
/**
44
*
5-
* Template Method base class.
5+
* StealingMethod defines skeleton for the algorithm.
66
*
77
*/
88
public abstract class StealingMethod {

template-method/src/main/java/com/iluwatar/SubtleMethod.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
package com.iluwatar;
22

3+
/**
4+
*
5+
* SubtleMethod implementation of StealingMethod.
6+
*
7+
*/
38
public class SubtleMethod extends StealingMethod {
49

510
@Override

0 commit comments

Comments
 (0)