File tree Expand file tree Collapse file tree 4 files changed +16
-3
lines changed
template-method/src/main/java/com/iluwatar Expand file tree Collapse file tree 4 files changed +16
-3
lines changed Original file line number Diff line number Diff line change 2
2
3
3
/**
4
4
*
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.
7
10
*
8
11
*/
9
12
public class App {
Original file line number Diff line number Diff line change 1
1
package com .iluwatar ;
2
2
3
+ /**
4
+ *
5
+ * HitAndRunMethod implementation of StealingMethod.
6
+ *
7
+ */
3
8
public class HitAndRunMethod extends StealingMethod {
4
9
5
10
@ Override
Original file line number Diff line number Diff line change 2
2
3
3
/**
4
4
*
5
- * Template Method base class .
5
+ * StealingMethod defines skeleton for the algorithm .
6
6
*
7
7
*/
8
8
public abstract class StealingMethod {
Original file line number Diff line number Diff line change 1
1
package com .iluwatar ;
2
2
3
+ /**
4
+ *
5
+ * SubtleMethod implementation of StealingMethod.
6
+ *
7
+ */
3
8
public class SubtleMethod extends StealingMethod {
4
9
5
10
@ Override
You can’t perform that action at this time.
0 commit comments