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 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 */
912public class App {
Original file line number Diff line number Diff line change 11package com .iluwatar ;
22
3+ /**
4+ *
5+ * HitAndRunMethod implementation of StealingMethod.
6+ *
7+ */
38public class HitAndRunMethod extends StealingMethod {
49
510 @ Override
Original file line number Diff line number Diff line change 22
33/**
44 *
5- * Template Method base class .
5+ * StealingMethod defines skeleton for the algorithm .
66 *
77 */
88public abstract class StealingMethod {
Original file line number Diff line number Diff line change 11package com .iluwatar ;
22
3+ /**
4+ *
5+ * SubtleMethod implementation of StealingMethod.
6+ *
7+ */
38public class SubtleMethod extends StealingMethod {
49
510 @ Override
You can’t perform that action at this time.
0 commit comments