mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-10-12 18:16:16 +00:00
Comments for template method example.
This commit is contained in:
1 parent
94b289801b
commit
2e07a685b0
3 files changed
+17
No files matched your search
@@ -1,5 +1,12 @@
|
|||||||
package com.iluwatar;
|
package com.iluwatar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Template Method (StealingMethod) defines skeleton for the
|
||||||
|
* algorithm and subclasses (HitAndRunMethod, SubtleMethod)
|
||||||
|
* fill in the blanks.
|
||||||
|
*
|
||||||
|
*/
|
||||||
public class App
|
public class App
|
||||||
{
|
{
|
||||||
public static void main( String[] args )
|
public static void main( String[] args )
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
package com.iluwatar;
|
package com.iluwatar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Halfling thief uses StealingMethod to steal.
|
||||||
|
*
|
||||||
|
*/
|
||||||
public class HalflingThief {
|
public class HalflingThief {
|
||||||
|
|
||||||
private StealingMethod method;
|
private StealingMethod method;
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
package com.iluwatar;
|
package com.iluwatar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Template Method base class.
|
||||||
|
*
|
||||||
|
*/
|
||||||
public abstract class StealingMethod {
|
public abstract class StealingMethod {
|
||||||
|
|
||||||
protected abstract String pickTarget();
|
protected abstract String pickTarget();
|
||||||
|
|||||||
Reference in new issue
Block a user