Improved code comments for template method example.

This commit is contained in:
Ilkka Seppala 2015-01-16 08:52:30 +02:00
parent 991653062d
commit b12243b94c
4 changed files with 16 additions and 3 deletions

View File

@ -2,8 +2,11 @@ package com.iluwatar;
/** /**
* *
* Template Method (StealingMethod) defines skeleton for the algorithm and * Template Method defines a skeleton for an algorithm. The algorithm subclasses
* subclasses (HitAndRunMethod, SubtleMethod) fill in the blanks. * provide implementation for the blank parts.
*
* In this example HalflingThief contains StealingMethod that can be changed.
* First the thief hits with HitAndRunMethod and then with SubtleMethod.
* *
*/ */
public class App { public class App {

View File

@ -1,5 +1,10 @@
package com.iluwatar; package com.iluwatar;
/**
*
* HitAndRunMethod implementation of StealingMethod.
*
*/
public class HitAndRunMethod extends StealingMethod { public class HitAndRunMethod extends StealingMethod {
@Override @Override

View File

@ -2,7 +2,7 @@ package com.iluwatar;
/** /**
* *
* Template Method base class. * StealingMethod defines skeleton for the algorithm.
* *
*/ */
public abstract class StealingMethod { public abstract class StealingMethod {

View File

@ -1,5 +1,10 @@
package com.iluwatar; package com.iluwatar;
/**
*
* SubtleMethod implementation of StealingMethod.
*
*/
public class SubtleMethod extends StealingMethod { public class SubtleMethod extends StealingMethod {
@Override @Override